summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
authorMario Bertschler <bmario@google.com>2017-01-30 17:05:24 -0800
committerMario Bertschler <bmario@google.com>2017-05-03 10:32:57 -0700
commit48198d004af64d0d7c8b86bc243087f68dc374c9 (patch)
tree503173ab33803b465990dff9ed62a8731d5f7e80 /src/com/android/launcher3/allapps
parent2526ba8215976432806c69c468f7b556e7877513 (diff)
downloadandroid_packages_apps_Trebuchet-48198d004af64d0d7c8b86bc243087f68dc374c9.tar.gz
android_packages_apps_Trebuchet-48198d004af64d0d7c8b86bc243087f68dc374c9.tar.bz2
android_packages_apps_Trebuchet-48198d004af64d0d7c8b86bc243087f68dc374c9.zip
All Apps transition with gradient and scrim.
The transition is behind a feature flag and turned off by default. Change-Id: I155840ba82b5a573d874376797db5f739a52d706
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java3
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java47
2 files changed, 47 insertions, 3 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index af6763107..7be8e8f0e 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -492,7 +492,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams();
navBarBgLp.height = insets.bottom;
navBarBg.setLayoutParams(navBarBgLp);
- navBarBg.setVisibility(View.VISIBLE);
+ navBarBg.setVisibility(FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS
+ ? View.INVISIBLE : View.VISIBLE);
}
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 30ed180e7..121ce4ce1 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -22,6 +22,10 @@ import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
+import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.dynamicui.ExtractedColors;
+import com.android.launcher3.graphics.RadialGradientView;
+import com.android.launcher3.graphics.ScrimView;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.Themes;
@@ -91,6 +95,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
// Used in discovery bounce animation to provide the transition without workspace changing.
private boolean mIsTranslateWithoutWorkspace = false;
private AnimatorSet mDiscoBounceAnimation;
+ private RadialGradientView mGradientView;
+ private ScrimView mScrimView;
public AllAppsTransitionController(Launcher l) {
mLauncher = l;
@@ -247,7 +253,9 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
if (!mLauncher.isAllAppsVisible()) {
mLauncher.tryAndUpdatePredictedApps();
mAppsView.setVisibility(View.VISIBLE);
- mAppsView.setRevealDrawableColor(mHotseatBackgroundColor);
+ if (!FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) {
+ mAppsView.setRevealDrawableColor(mHotseatBackgroundColor);
+ }
}
}
}
@@ -263,6 +271,36 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
mLauncher.activateLightSystemBars(forceLight, true /* statusBar */, true /* navBar */);
}
+ private void updateAllAppsBg(float progress) {
+ // gradient
+ if (mGradientView == null) {
+ mGradientView = (RadialGradientView) mLauncher.findViewById(R.id.gradient_bg);
+ mGradientView.setVisibility(View.VISIBLE);
+ onExtractedColorsChanged();
+ }
+ mGradientView.setProgress(progress);
+
+ // scrim
+ if (mScrimView == null) {
+ mScrimView = (ScrimView) mLauncher.findViewById(R.id.scrim_bg);
+ mScrimView.setVisibility(View.VISIBLE);
+ }
+ mScrimView.setProgress(progress);
+ }
+
+ public void onExtractedColorsChanged() {
+ if (FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) {
+ if (mGradientView != null) {
+ int color1 = mLauncher.getExtractedColors()
+ .getColor(ExtractedColors.ALLAPPS_GRADIENT_MAIN_INDEX);
+ int color2 = mLauncher.getExtractedColors()
+ .getColor(ExtractedColors.ALLAPPS_GRADIENT_SECONDARY_INDEX);
+ mGradientView.onExtractedColorsChanged(color1, color2);
+ mGradientView.requestLayout();
+ }
+ }
+ }
+
/**
* @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace
*/
@@ -280,7 +318,12 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
int bgAlpha = Color.alpha((int) mEvaluator.evaluate(alpha,
mHotseatBackgroundColor, mAllAppsBackgroundColor));
- mAppsView.setRevealDrawableColor(ColorUtils.setAlphaComponent(color, bgAlpha));
+ if (FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) {
+ updateAllAppsBg(alpha);
+ } else {
+ mAppsView.setRevealDrawableColor(ColorUtils.setAlphaComponent(color, bgAlpha));
+ }
+
mAppsView.getContentView().setAlpha(alpha);
mAppsView.setTranslationY(shiftCurrent);