summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Ng <ngmatthew@google.com>2018-05-09 11:40:44 -0700
committerMatthew Ng <ngmatthew@google.com>2018-05-18 00:48:51 +0000
commit8b92fe336be8d7d06925b50f63fe15538d2fe1db (patch)
tree1596eae8cab974f9ef24597087b22546631d1268 /src
parent48059dc7061b3144ba0b2f49d4ac4da7f7471752 (diff)
downloadandroid_packages_apps_Trebuchet-8b92fe336be8d7d06925b50f63fe15538d2fe1db.tar.gz
android_packages_apps_Trebuchet-8b92fe336be8d7d06925b50f63fe15538d2fe1db.tar.bz2
android_packages_apps_Trebuchet-8b92fe336be8d7d06925b50f63fe15538d2fe1db.zip
Fade back button in and out tied with the overview/shelf (2/3)
Back button changes opacity when moving the shelf during swipe up between home screen and overview. The alpha changes depending on the progress of the swipe up animation. When going from app to home and vice versa, the fade animation does not tie with the swipe up progress. The fade animation also masks the back button drawable when ime visibility changes. Change-Id: I51e42930640ba711e81880b385bb722d7ee8ad33 Fixes: 74581837 Fixes: 76900236 Test: swipe up from home screen to overview
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java9
-rw-r--r--src/com/android/launcher3/touch/AbstractStateChangeTouchController.java12
2 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 2c3e3ee7b..b5c821ac2 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -25,9 +25,11 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.PropertySetter;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ScrimView;
@@ -182,6 +184,13 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
anim.setDuration(config.duration);
anim.setInterpolator(builder.getInterpolator(ANIM_VERTICAL_PROGRESS, interpolator));
anim.addListener(getProgressAnimatorListener());
+ if (toState.hideBackButton) {
+ anim.addUpdateListener(animation -> {
+ final float alpha = (float) animation.getAnimatedValue();
+ UiFactory.setBackButtonAlpha(mLauncher, 1 - Utilities.boundToRange(alpha, 0, 1),
+ false /* animate */);
+ });
+ }
builder.play(anim);
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index e29250a5e..8ffa62813 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -42,6 +42,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -221,6 +222,8 @@ public abstract class AbstractStateChangeTouchController
cancelAtomicComponentsController();
}
mProgressMultiplier = initCurrentAnimation(animComponents);
+ mCurrentAnimation.getAnimationPlayer().addUpdateListener(animation ->
+ setBackButtonAlphaWithProgress((float) animation.getAnimatedValue()));
mCurrentAnimation.dispatchOnStart();
return true;
}
@@ -279,6 +282,7 @@ public abstract class AbstractStateChangeTouchController
mAtomicComponentsController.setPlayFraction(fraction - mAtomicComponentsStartProgress);
}
maybeUpdateAtomicAnim(mFromState, mToState, fraction);
+ setBackButtonAlphaWithProgress(fraction);
}
/**
@@ -471,6 +475,14 @@ public abstract class AbstractStateChangeTouchController
}
}
+ private void setBackButtonAlphaWithProgress(float progress) {
+ if (mFromState.hideBackButton ^ mToState.hideBackButton) {
+ progress = Utilities.boundToRange(progress, 0, 1);
+ final float alpha = mToState.hideBackButton ? 1 - progress : progress;
+ UiFactory.setBackButtonAlpha(mLauncher, alpha, false /* animate */);
+ }
+ }
+
private void logReachedState(int logAction) {
// Transition complete. log the action
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,