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:
Adam Cohen
2011-11-01 17:29:52 -07:00
parent 4a4f5c3557
commit 21b411074e
4 changed files with 79 additions and 13 deletions

View File

@@ -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);