diff options
author | cretin45 <cretin45@gmail.com> | 2016-02-03 15:16:52 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-02-03 15:17:23 -0800 |
commit | 15d36326dffc038551fcdc1632176402700e33a8 (patch) | |
tree | d7ab2d3c0e8400c8c1e9769b7ea48830f159ec80 /src/com/android/launcher3/LauncherStateTransitionAnimation.java | |
parent | de0af4b16944370c015c11cf1db151e6ee8e9232 (diff) | |
download | android_packages_apps_Trebuchet-15d36326dffc038551fcdc1632176402700e33a8.tar.gz android_packages_apps_Trebuchet-15d36326dffc038551fcdc1632176402700e33a8.tar.bz2 android_packages_apps_Trebuchet-15d36326dffc038551fcdc1632176402700e33a8.zip |
Trebuchet: Fix background flicker when opening all apps
Issue-id: OPO-422
Change-Id: I96136f61fe3b2263f77d162952cf189927334b8b
Diffstat (limited to 'src/com/android/launcher3/LauncherStateTransitionAnimation.java')
-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); |