diff options
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsTransitionController.java | 47 |
3 files changed, 29 insertions, 29 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 9f86a0b25..5245509ed 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -218,4 +218,13 @@ public class Hotseat extends FrameLayout mBackgroundColor = color; } } + + public void setBackgroundTransparent(boolean enable) { + // This causes re-layout. Should replace the logic with simply setting the background alpha + if (enable) { + setBackground(null); + } else { + setBackground(mBackground); + } + } } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 6124c895a..e24adf996 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1396,6 +1396,8 @@ public class Launcher extends Activity mDragController.addDropTarget(mWorkspace); mDropTargetBar.setup(mDragController); + mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace); + if (TestingUtils.MEMORY_DUMP_ENABLED) { TestingUtils.addWeightWatcher(this); } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index c443b1e2b..4bdd9f4ee 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -4,11 +4,9 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; -import android.graphics.drawable.Drawable; import android.util.Log; import android.view.MotionEvent; import android.view.View; -import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; @@ -39,7 +37,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul private final Interpolator mAccelInterpolator = new AccelerateInterpolator(2f); private final Interpolator mDecelInterpolator = new DecelerateInterpolator(1f); - private final Interpolator mAccelDecelInterpolator = new AccelerateDecelerateInterpolator(); private static final float ANIMATION_DURATION = 2000; public static final float ALL_APPS_FINAL_ALPHA = .8f; @@ -49,8 +46,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul private AllAppsContainerView mAppsView; private Workspace mWorkspace; private Hotseat mHotseat; - private Drawable mHotseatBackground; - private float mHotseatAlpha; + private float mHotseatBackgroundAlpha; + private float mStatusBarHeight; private final Launcher mLauncher; @@ -87,7 +84,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul @Override public boolean onInterceptTouchEvent(MotionEvent ev) { - init(); if (ev.getAction() == MotionEvent.ACTION_DOWN) { mNoIntercept = false; if (mLauncher.getWorkspace().isInOverviewMode() || mLauncher.isWidgetsViewVisible()) { @@ -138,45 +134,32 @@ public class AllAppsTransitionController implements TouchController, VerticalPul return mProgressTransY / mTranslation > 1 - RECATCH_REJECTION_FRACTION; } - private void init() { - if (mAppsView != null) { - return; - } - mAppsView = mLauncher.getAppsView(); - mHotseat = mLauncher.getHotseat(); - mWorkspace = mLauncher.getWorkspace(); - - mStatusBarHeight = mLauncher.getDragLayer().getInsets().height(); - if (mHotseatBackground == null) { - mHotseatBackground = mHotseat.getBackground(); - mHotseatAlpha = mHotseatBackground.getAlpha() / 255f; - } - } - @Override public void onScrollStart(boolean start) { - init(); cancelAnimation(); mCurrentAnimation = LauncherAnimUtils.createAnimatorSet(); preparePull(start); - mCurY = mAppsView.getTranslationY(); } /** * @param start {@code true} if start of new drag. */ public void preparePull(boolean start) { + // Initialize values that should not change until #onScrollEnd + mCurY = mAppsView.getTranslationY(); + mStatusBarHeight = mLauncher.getDragLayer().getInsets().top; mHotseat.setVisibility(View.VISIBLE); mHotseat.bringToFront(); if (start) { if (!mLauncher.isAllAppsVisible()) { mLauncher.tryAndUpdatePredictedApps(); - mHotseat.setBackground(null); + mHotseatBackgroundAlpha = mHotseat.getBackground().getAlpha() / 255f; + mHotseat.setBackgroundTransparent(true /* transparent */); mAppsView.setVisibility(View.VISIBLE); mAppsView.getContentView().setVisibility(View.VISIBLE); mAppsView.getContentView().setBackground(null); mAppsView.getRevealView().setVisibility(View.VISIBLE); - mAppsView.getRevealView().setAlpha(mHotseatAlpha); + mAppsView.getRevealView().setAlpha(mHotseatBackgroundAlpha); DeviceProfile grid= mLauncher.getDeviceProfile(); if (!grid.isLandscape) { @@ -235,7 +218,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul float alpha = calcAlphaAllApps(progress); float workspaceHotseatAlpha = 1 - alpha; - mAppsView.getRevealView().setAlpha(Math.min(ALL_APPS_FINAL_ALPHA, Math.max(mHotseatAlpha, + mAppsView.getRevealView().setAlpha(Math.min(ALL_APPS_FINAL_ALPHA, Math.max(mHotseatBackgroundAlpha, mDecelInterpolator.getInterpolation(alpha)))); mAppsView.getContentView().setAlpha(alpha); mAppsView.setTranslationY(progress); @@ -292,7 +275,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul } public void animateToAllApps(AnimatorSet animationOut, long duration) { - if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){ + if (animationOut == null){ return; } if (mDetector.isRestingState()) { @@ -330,7 +313,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul } public void animateToWorkspace(AnimatorSet animationOut, long duration) { - if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){ + if (animationOut == null){ return; } if(mDetector.isRestingState()) { @@ -382,7 +365,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul return; } mAppsView.setVisibility(View.INVISIBLE); - mHotseat.setBackground(mHotseatBackground); + mHotseat.setBackgroundTransparent(false /* transparent */); mHotseat.setVisibility(View.VISIBLE); setProgress(mTranslation); if (!mStateAlreadyChanged) { @@ -401,4 +384,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul private void cleanUpAnimation() { mCurrentAnimation = null; } + + public void setupViews(AllAppsContainerView appsView, Hotseat hotseat, Workspace workspace) { + mAppsView = appsView; + mHotseat = hotseat; + mWorkspace = workspace; + } } |