Merge branch 'aosp-13' into 13-wip

This commit is contained in:
MrSluffy committed 2023-10-21 09:52:01 +08:00
commit 19bf26dd5a
1558 files changed
+103731 -36693

No files matched your search

@@ -43,7 +43,7 @@ import android.widget.TextView;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.FastScrollRecyclerView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.graphics.FastScrollThumbDrawable;
@@ -119,7 +119,6 @@ public class RecyclerViewFastScroller extends View {
// prevent jumping, this offset is applied as the user scrolls.
protected int mTouchOffsetY;
protected int mThumbOffsetY;
protected int mRvOffsetY;
// Fast scroller popup
private TextView mPopupView;
@@ -127,7 +126,7 @@ public class RecyclerViewFastScroller extends View {
private String mPopupSectionName;
private Insets mSystemGestureInsets;
protected BaseRecyclerView mRv;
protected FastScrollRecyclerView mRv;
private RecyclerView.OnScrollListener mOnScrollListener;
private int mDownX;
@@ -172,7 +171,14 @@ public class RecyclerViewFastScroller extends View {
ta.recycle();
}
public void setRecyclerView(BaseRecyclerView rv, TextView popupView) {
/** Sets the popup view to show while the scroller is being dragged */
public void setPopupView(TextView popupView) {
mPopupView = popupView;
mPopupView.setBackground(
new FastScrollThumbDrawable(mThumbPaint, Utilities.isRtl(getResources())));
}
public void setRecyclerView(FastScrollRecyclerView rv) {
if (mRv != null && mOnScrollListener != null) {
mRv.removeOnScrollListener(mOnScrollListener);
}
@@ -190,10 +196,6 @@ public class RecyclerViewFastScroller extends View {
mRv.onUpdateScrollbar(dy);
}
});
mPopupView = popupView;
mPopupView.setBackground(
new FastScrollThumbDrawable(mThumbPaint, Utilities.isRtl(getResources())));
}
public void reattachThumbToScroll() {
@@ -202,16 +204,11 @@ public class RecyclerViewFastScroller extends View {
public void setThumbOffsetY(int y) {
if (mThumbOffsetY == y) {
int rvCurrentOffsetY = mRv.getCurrentScrollY();
if (mRvOffsetY != rvCurrentOffsetY) {
mRvOffsetY = mRv.getCurrentScrollY();
}
return;
}
updatePopupY(y);
mThumbOffsetY = y;
invalidate();
mRvOffsetY = mRv.getCurrentScrollY();
}
public int getThumbOffsetY() {
@@ -284,15 +281,7 @@ public class RecyclerViewFastScroller extends View {
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mRv.onFastScrollCompleted();
mTouchOffsetY = 0;
mLastTouchY = 0;
mIgnoreDragGesture = false;
if (mIsDragging) {
mIsDragging = false;
animatePopupVisibility(false);
showActiveScrollbar(false);
}
endFastScrolling();
break;
}
if (DEBUG) {
@@ -306,6 +295,7 @@ public class RecyclerViewFastScroller extends View {
}
private void calcTouchOffsetAndPrepToFastScroll(int downY, int lastY) {
ActivityContext.lookupContext(getContext()).hideKeyboard();
mIsDragging = true;
if (mCanThumbDetach) {
mIsThumbDetached = true;
@@ -330,8 +320,22 @@ public class RecyclerViewFastScroller extends View {
setThumbOffsetY((int) mLastTouchY);
}
/** End any active fast scrolling touch handling, if applicable. */
public void endFastScrolling() {
mRv.onFastScrollCompleted();
mTouchOffsetY = 0;
mLastTouchY = 0;
mIgnoreDragGesture = false;
if (mIsDragging) {
mIsDragging = false;
animatePopupVisibility(false);
showActiveScrollbar(false);
}
}
@Override
public void onDraw(Canvas canvas) {
if (mThumbOffsetY < 0) {
if (mThumbOffsetY < 0 || mRv == null) {
return;
}
int saveCount = canvas.save();