summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-27 07:23:13 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-27 07:23:13 +0000
commitdf0843e569b93e77355990f7a71fe39746b43493 (patch)
treeb5fb050ecef07e3f2020513a526f6a99f46554c4 /quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
parent4ac63b28ced5d5b09eaae39adca68377a2a7ef5b (diff)
parentaea65680e6f3da83636dbc6af2ef1381de06d2a8 (diff)
downloadandroid_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.tar.gz
android_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.tar.bz2
android_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.zip
Snap for 4807121 from aea65680e6f3da83636dbc6af2ef1381de06d2a8 to pi-release
Change-Id: Id61934dcc353f297ad35ca1fbd7ffe385a2503a3
Diffstat (limited to 'quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java')
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java b/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
new file mode 100644
index 000000000..2e6dcc0e7
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.uioverrides;
+
+import android.animation.ValueAnimator;
+
+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;
+
+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.getInstance(mLauncher);
+ }
+
+ @Override
+ public void setState(LauncherState state) {
+ UiFactory.onLauncherStateOrFocusChanged(mLauncher);
+ }
+
+ @Override
+ public void setStateWithAnimation(LauncherState toState,
+ AnimatorSetBuilder builder, LauncherStateManager.AnimationConfig config) {
+ if (!config.playNonAtomicComponent()) {
+ return;
+ }
+ float fromAlpha = mOverviewInteractionState.getBackButtonAlpha();
+ 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);
+ });
+ builder.play(anim);
+ }
+ }
+}