diff options
author | Adam Cohen <adamcohen@google.com> | 2014-07-09 23:53:15 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2014-07-18 17:56:42 -0700 |
commit | 6c5891a9fce95eee3d87823d11d21889743e9c68 (patch) | |
tree | 3373b4ee43895f19ae90f472a3b42d12b1ab3634 /src/com/android/launcher3/DragLayer.java | |
parent | cc83d8dbfe2d99d95d9cf651c9559093d3c89c1e (diff) | |
download | android_packages_apps_Trebuchet-6c5891a9fce95eee3d87823d11d21889743e9c68.tar.gz android_packages_apps_Trebuchet-6c5891a9fce95eee3d87823d11d21889743e9c68.tar.bz2 android_packages_apps_Trebuchet-6c5891a9fce95eee3d87823d11d21889743e9c68.zip |
Preliminary work on Material Transitions
-> Early exploration of AllApps Hero transition with
circular reveal
-> Stripping a bunch of dead code from AppsCustomizeTabHost
-> Moved background scrim to DragLayer
-> Removed "SMALL" state from workspace: replaced with
NORMAL_HIDDEN and OVERVIEW_HIDDEN. This is mainly to
reduce the overall usage of the z-space model between
allapps/widgets and workspace. There are vestigial
remains of this model, mainly due to the overview
mode, and a bit for spring-loaded.
Change-Id: If2302a24394f0ec66621f01ffa2fc4934aa10c3f
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r-- | src/com/android/launcher3/DragLayer.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java index c54db0127..8bcc407d6 100644 --- a/src/com/android/launcher3/DragLayer.java +++ b/src/com/android/launcher3/DragLayer.java @@ -77,6 +77,10 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang private int mTopViewIndex; private int mChildCountOnLastUpdate = -1; + // Darkening scrim + private Drawable mBackground; + private float mBackgroundAlpha = 0; + /** * Used to create a new DragLayer from XML. * @@ -91,8 +95,10 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang setChildrenDrawingOrderEnabled(true); setOnHierarchyChangeListener(this); - mLeftHoverDrawable = getResources().getDrawable(R.drawable.page_hover_left_holo); - mRightHoverDrawable = getResources().getDrawable(R.drawable.page_hover_right_holo); + final Resources res = getResources(); + mLeftHoverDrawable = res.getDrawable(R.drawable.page_hover_left_holo); + mRightHoverDrawable = res.getDrawable(R.drawable.page_hover_right_holo); + mBackground = res.getDrawable(R.drawable.apps_customize_bg); } public void setup(Launcher launcher, DragController controller) { @@ -862,8 +868,17 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang @Override protected void dispatchDraw(Canvas canvas) { + // Draw the background gradient below children. + if (mBackground != null && mBackgroundAlpha > 0.0f) { + int alpha = (int) (mBackgroundAlpha * 255); + mBackground.setAlpha(alpha); + mBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); + mBackground.draw(canvas); + } + super.dispatchDraw(canvas); + // Draw screen hover indicators above children. if (mInScrollArea && !LauncherAppState.getInstance().isScreenLarge()) { Workspace workspace = mLauncher.getWorkspace(); int width = getMeasuredWidth(); @@ -887,6 +902,17 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang } } + public void setBackgroundAlpha(float alpha) { + if (alpha != mBackgroundAlpha) { + mBackgroundAlpha = alpha; + invalidate(); + } + } + + public float getBackgroundAlpha() { + return mBackgroundAlpha; + } + public void setTouchCompleteListener(TouchCompleteListener listener) { mTouchCompleteListener = listener; } |