mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Cleaning up overscroll effect in launcher workspace
-> Making sure workspace is drawn above the hotseat and qsb -> Dimming the dock divider and page indicator during overscroll Change-Id: I40766aa88e58db2d102c11d1ae8b2455aa459a07
This commit is contained in:
@@ -69,6 +69,8 @@ public class DragLayer extends FrameLayout {
|
||||
private float mDropViewAlpha;
|
||||
private boolean mHoverPointClosesFolder = false;
|
||||
private Rect mHitRect = new Rect();
|
||||
private int mWorkspaceIndex = -1;
|
||||
private int mHotseatIndex = -1;
|
||||
|
||||
/**
|
||||
* Used to create a new DragLayer from XML.
|
||||
@@ -81,6 +83,7 @@ public class DragLayer extends FrameLayout {
|
||||
|
||||
// Disable multitouch across the workspace/all apps/customize tray
|
||||
setMotionEventSplittingEnabled(false);
|
||||
setChildrenDrawingOrderEnabled(true);
|
||||
}
|
||||
|
||||
public void setup(Launcher launcher, DragController controller) {
|
||||
@@ -609,6 +612,44 @@ public class DragLayer extends FrameLayout {
|
||||
mFadeOutAnim.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onViewAdded(View child) {
|
||||
super.onViewAdded(child);
|
||||
updateChildIndices();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onViewRemoved(View child) {
|
||||
super.onViewRemoved(child);
|
||||
updateChildIndices();
|
||||
}
|
||||
|
||||
private void updateChildIndices() {
|
||||
if (mLauncher != null) {
|
||||
mWorkspaceIndex = indexOfChild(mLauncher.getWorkspace());
|
||||
mHotseatIndex = indexOfChild(mLauncher.getHotseat());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getChildDrawingOrder(int childCount, int i) {
|
||||
if (mWorkspaceIndex == -1 || mHotseatIndex == -1 ||
|
||||
mLauncher.getWorkspace().isDrawingBackgroundGradient()) {
|
||||
return i;
|
||||
}
|
||||
|
||||
// This ensures that the workspace is drawn above the hotseat and qsb,
|
||||
// except when the workspace is drawing a background gradient, in which
|
||||
// case we want the workspace to stay behind these elements.
|
||||
if (i == mHotseatIndex) {
|
||||
return mWorkspaceIndex;
|
||||
} else if (i == mWorkspaceIndex) {
|
||||
return mHotseatIndex;
|
||||
} else {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
Reference in New Issue
Block a user