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
+23
View File
@@ -175,6 +175,7 @@ public class Workspace extends SmoothPagedView
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
private int mDragViewMultiplyColor;
private float mOverscrollFade = 0;
// Paint used to draw external drop outline
private final Paint mExternalDragOutlinePaint = new Paint();
@@ -1152,7 +1153,11 @@ public class Workspace extends SmoothPagedView
cl.setPivotX(cl.getMeasuredWidth() * (index == 0 ? 0.75f : 0.25f));
cl.setTranslationX(translationX);
cl.setRotationY(rotation);
setFadeForOverScroll(Math.abs(scrollProgress));
} else {
if (mOverscrollFade != 0) {
setFadeForOverScroll(0);
}
// We don't want to mess with the translations during transitions
if (!isSwitchingState()) {
resetCellLayoutTransforms((CellLayout) getChildAt(0), true);
@@ -1230,6 +1235,10 @@ public class Workspace extends SmoothPagedView
super.onDraw(canvas);
}
boolean isDrawingBackgroundGradient() {
return (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground);
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
@@ -3454,6 +3463,20 @@ public class Workspace extends SmoothPagedView
}
}
void setFadeForOverScroll(float fade) {
if (!isScrollingIndicatorEnabled()) return;
mOverscrollFade = fade;
float reducedFade = 0.5f + 0.5f * (1 - fade);
final ViewGroup parent = (ViewGroup) getParent();
final ImageView dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
final ImageView scrollIndicator = getScrollingIndicator();
cancelScrollingIndicatorAnimations();
dockDivider.setAlpha(reducedFade);
scrollIndicator.setAlpha(1 - fade);
}
void hideDockDivider(boolean immediately) {
final ViewGroup parent = (ViewGroup) getParent();
final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));