mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 16:26:47 +00:00
Minor visual tweaks.
- Drawing full divider under predicted apps - Enabling dynamic search bar elevation - Increasing fast scroller pop-up size - Insetting the padding to prevent the scroll bar from overlapping with app titles Bug: 20299865 Change-Id: I48ffde43c2158c23b54cd43fede722da41ccc111
This commit is contained in:
@@ -29,12 +29,20 @@ import com.android.launcher3.util.Thunk;
|
||||
public class BaseContainerRecyclerView extends RecyclerView
|
||||
implements RecyclerView.OnItemTouchListener {
|
||||
|
||||
/**
|
||||
* Listener to get notified when the absolute scroll changes.
|
||||
*/
|
||||
public interface OnScrollToListener {
|
||||
void onScrolledTo(int x, int y);
|
||||
}
|
||||
|
||||
private static final int SCROLL_DELTA_THRESHOLD_DP = 4;
|
||||
|
||||
/** Keeps the last known scrolling delta/velocity along y-axis. */
|
||||
@Thunk int mDy = 0;
|
||||
@Thunk int mScrollY;
|
||||
private float mDeltaThreshold;
|
||||
private RecyclerView.OnScrollListener mScrollListenerProxy;
|
||||
private OnScrollToListener mScrollToListener;
|
||||
|
||||
public BaseContainerRecyclerView(Context context) {
|
||||
this(context, null);
|
||||
@@ -60,8 +68,9 @@ public class BaseContainerRecyclerView extends RecyclerView
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
mDy = dy;
|
||||
if (mScrollListenerProxy != null) {
|
||||
mScrollListenerProxy.onScrolled(recyclerView, dx, dy);
|
||||
mScrollY += dy;
|
||||
if (mScrollToListener != null) {
|
||||
mScrollToListener.onScrolledTo(0, mScrollY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,8 +78,8 @@ public class BaseContainerRecyclerView extends RecyclerView
|
||||
/**
|
||||
* Sets an additional scroll listener, only needed for LMR1 version of the support lib.
|
||||
*/
|
||||
public void setOnScrollListenerProxy(RecyclerView.OnScrollListener listener) {
|
||||
mScrollListenerProxy = listener;
|
||||
public void setOnScrollListenerProxy(OnScrollToListener listener) {
|
||||
mScrollToListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,6 +105,17 @@ public class BaseContainerRecyclerView extends RecyclerView
|
||||
// DO NOT REMOVE, NEEDED IMPLEMENTATION FOR M BUILDS
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the scroll position, used to workaround a RecyclerView issue with scrolling to
|
||||
* position.
|
||||
*/
|
||||
protected void updateScrollY(int scrollY) {
|
||||
mScrollY = scrollY;
|
||||
if (mScrollToListener != null) {
|
||||
mScrollToListener.onScrolledTo(0, mScrollY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this {@link MotionEvent} should trigger the scroll to be stopped.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user