diff options
author | cretin45 <cretin45@gmail.com> | 2016-02-03 15:16:52 -0800 |
---|---|---|
committer | Tom Powell <zifnab@zifnab06.net> | 2017-03-26 16:14:45 -0700 |
commit | e2678cea5161d8d9616074d7bf4c28ae6f404793 (patch) | |
tree | c68e1ff54660d3e254f4ed118335d689850565cb | |
parent | bb93ea94e6273dd27dd3263a239976292fa8dc44 (diff) | |
download | android_packages_apps_Trebuchet-e2678cea5161d8d9616074d7bf4c28ae6f404793.tar.gz android_packages_apps_Trebuchet-e2678cea5161d8d9616074d7bf4c28ae6f404793.tar.bz2 android_packages_apps_Trebuchet-e2678cea5161d8d9616074d7bf4c28ae6f404793.zip |
Trebuchet: Fix background flicker when opening all apps
Issue-id: OPO-422
Change-Id: I96136f61fe3b2263f77d162952cf189927334b8b
-rw-r--r-- | src/com/android/launcher3/LauncherStateTransitionAnimation.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java index a0fa61d08..4c97727c1 100644 --- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java +++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java @@ -24,6 +24,7 @@ import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.annotation.SuppressLint; import android.content.res.Resources; +import android.graphics.drawable.Drawable; import android.util.Log; import android.view.View; import android.view.animation.AccelerateInterpolator; @@ -287,6 +288,14 @@ public class LauncherStateTransitionAnimation { // Setup the animation for the content view contentView.setVisibility(View.VISIBLE); + /* + * Because the contentView and revealView overlap, if their backgrounds have alpha, + * it will blend and cause a flicker. So get the current alpha of the contentView (for + * later) and set to 0. When the animation is done, reset the alpha. + */ + final Drawable contentBackground = contentView.getBackground(); + final int alpha = contentBackground.getAlpha(); + contentBackground.setAlpha(0); contentView.setAlpha(0f); contentView.setTranslationY(revealViewToYDrift); layerViews.put(contentView, BUILD_AND_SET_LAYER); @@ -327,6 +336,7 @@ public class LauncherStateTransitionAnimation { // Hide the reveal view revealView.setVisibility(View.INVISIBLE); + contentBackground.setAlpha(alpha); // Disable all necessary layers for (View v : layerViews.keySet()) { @@ -521,6 +531,9 @@ public class LauncherStateTransitionAnimation { animation.play(workspaceAnim); } + final Drawable contentBackground = contentView.getBackground(); + final int alpha = contentBackground.getAlpha(); + // hideAppsCustomizeHelper is called in some cases when it is already hidden // don't perform all these no-op animations. In particularly, this was causing // the all-apps button to pop in and out. @@ -528,6 +541,7 @@ public class LauncherStateTransitionAnimation { int width = revealView.getMeasuredWidth(); int height = revealView.getMeasuredHeight(); float revealRadius = (float) Math.hypot(width / 2, height / 2); + contentBackground.setAlpha(0); revealView.setVisibility(View.VISIBLE); revealView.setAlpha(1f); revealView.setTranslationY(0); @@ -650,6 +664,7 @@ public class LauncherStateTransitionAnimation { contentView.setTranslationX(0); contentView.setTranslationY(0); contentView.setAlpha(1); + contentBackground.setAlpha(alpha); } if (overlaySearchBarView != null) { overlaySearchBarView.setAlpha(1f); |