summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2016-06-20 21:20:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-06-20 21:20:32 +0000
commit91f3b1c0b8dbe2bf3f50e6913eb870e40486cbe6 (patch)
tree6dcea860ed05cc5de8b314a2a63150c8e6d8efd1 /src/com/android
parent61edb5422b0803144533ef45f09b635b776d7b71 (diff)
parenta0c5647f521384e4c4edf4e15516a1b4afbde80b (diff)
downloadandroid_packages_apps_Trebuchet-91f3b1c0b8dbe2bf3f50e6913eb870e40486cbe6.tar.gz
android_packages_apps_Trebuchet-91f3b1c0b8dbe2bf3f50e6913eb870e40486cbe6.tar.bz2
android_packages_apps_Trebuchet-91f3b1c0b8dbe2bf3f50e6913eb870e40486cbe6.zip
Merge "Fixing a crash on APPS->WORKSPACE transition when animation is automated without dragging. b/29424335" into ub-launcher3-calgary
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/Hotseat.java9
-rw-r--r--src/com/android/launcher3/Launcher.java2
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java47
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;
+ }
}