Cleanup how we set back button alpha

Add BackButtonAlphaHandler to set back button alpha, instead of setting
it from multiple places.

Also force back button alpha to be 1 if swipe up is disabled (b/80091187)

Change-Id: I49b63a0e6b033a3a947a847669a398f1b9ff0564
This commit is contained in:
Tony Wickham
2018-05-16 18:15:38 -07:00
committed by Tony
parent 8417a7b514
commit 4e21c1b552
6 changed files with 78 additions and 29 deletions

View File

@@ -42,7 +42,6 @@ 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;
@@ -224,8 +223,6 @@ public abstract class AbstractStateChangeTouchController
cancelAtomicComponentsController();
}
mProgressMultiplier = initCurrentAnimation(animComponents);
mCurrentAnimation.getAnimationPlayer().addUpdateListener(animation ->
setBackButtonAlphaWithProgress((float) animation.getAnimatedValue()));
mCurrentAnimation.dispatchOnStart();
return true;
}
@@ -284,7 +281,6 @@ public abstract class AbstractStateChangeTouchController
mAtomicComponentsController.setPlayFraction(fraction - mAtomicComponentsStartProgress);
}
maybeUpdateAtomicAnim(mFromState, mToState, fraction);
setBackButtonAlphaWithProgress(fraction);
}
/**
@@ -477,14 +473,6 @@ 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,