5/ Remove OverviewInteractionState
- We can move the background call to UiThreadHelper, the last sysui flags and back button alpha to SystemUiProxy (and dedupe values there as well) Bug: 141886704 Change-Id: I22183608700c6d71355597c7a08eefa19f4381fd
This commit is contained in:
1 parent
8ff53f7e65
commit
bfcee430fe
12 files changed
+105
-168
No files matched your search
@@ -24,18 +24,18 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.quickstep.OverviewInteractionState;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
|
||||
public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler {
|
||||
|
||||
private static final String TAG = "BackButtonAlphaHandler";
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private final OverviewInteractionState mOverviewInteractionState;
|
||||
|
||||
public BackButtonAlphaHandler(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(mLauncher);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,14 +49,23 @@ public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler
|
||||
if (!config.playNonAtomicComponent()) {
|
||||
return;
|
||||
}
|
||||
float fromAlpha = mOverviewInteractionState.getBackButtonAlpha();
|
||||
|
||||
if (!SysUINavigationMode.getMode(mLauncher).hasGestures) {
|
||||
// If the nav mode is not gestural, then force back button alpha to be 1
|
||||
UiThreadHelper.setBackButtonAlphaAsync(mLauncher, UiFactory.SET_BACK_BUTTON_ALPHA, 1f,
|
||||
true /* animate */);
|
||||
return;
|
||||
}
|
||||
|
||||
float fromAlpha = SystemUiProxy.INSTANCE.get(mLauncher).getLastBackButtonAlpha();
|
||||
float toAlpha = toState.hideBackButton ? 0 : 1;
|
||||
if (Float.compare(fromAlpha, toAlpha) != 0) {
|
||||
ValueAnimator anim = ValueAnimator.ofFloat(fromAlpha, toAlpha);
|
||||
anim.setDuration(config.duration);
|
||||
anim.addUpdateListener(valueAnimator -> {
|
||||
final float alpha = (float) valueAnimator.getAnimatedValue();
|
||||
mOverviewInteractionState.setBackButtonAlpha(alpha, false);
|
||||
UiThreadHelper.setBackButtonAlphaAsync(mLauncher, UiFactory.SET_BACK_BUTTON_ALPHA,
|
||||
alpha, false /* animate */);
|
||||
});
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user