All Apps transition with gradient and scrim.

The transition is behind a feature flag and
turned off by default.

Change-Id: I155840ba82b5a573d874376797db5f739a52d706
This commit is contained in:
Mario Bertschler
2017-01-30 17:05:24 -08:00
parent 2526ba8215
commit 48198d004a
15 changed files with 400 additions and 10 deletions

View File

@@ -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);