summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Workspace.java
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-07-25 17:57:40 -0700
committerMichael Jurka <mikejurka@google.com>2011-07-26 15:49:50 -0700
commitb9e14974ae5c03bd996bc102ed23a24126449990 (patch)
tree85306d50b2094e73679f8490f190999271ea986a /src/com/android/launcher2/Workspace.java
parentbf361decc703800d7db41ac87d1e3c87011b2c32 (diff)
downloadandroid_packages_apps_Trebuchet-b9e14974ae5c03bd996bc102ed23a24126449990.tar.gz
android_packages_apps_Trebuchet-b9e14974ae5c03bd996bc102ed23a24126449990.tar.bz2
android_packages_apps_Trebuchet-b9e14974ae5c03bd996bc102ed23a24126449990.zip
Solving transient wallpaper flash when rotating All Apps
- also cleaning up some code Change-Id: Ic9399e604aac3115d92186a70799bf80ecaf31c6
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r--src/com/android/launcher2/Workspace.java77
1 files changed, 49 insertions, 28 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index a198c6d35..23b8c2d99 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -991,38 +991,59 @@ public class Workspace extends SmoothPagedView
mDrawBackground = true;
}
- private void showBackgroundGradientForAllApps() {
- showBackgroundGradient();
+ private void showBackgroundGradientForAllApps(boolean animated) {
+ showBackgroundGradient(animated);
}
- private void showBackgroundGradient() {
+ private void showBackgroundGradient(boolean animated) {
if (mBackground == null) return;
- if (mBackgroundFadeOutAnimation != null) mBackgroundFadeOutAnimation.cancel();
- if (mBackgroundFadeInAnimation != null) mBackgroundFadeInAnimation.cancel();
- mBackgroundFadeInAnimation = ValueAnimator.ofFloat(getBackgroundAlpha(), 1f);
- mBackgroundFadeInAnimation.addUpdateListener(new AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator animation) {
- setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
- }
- });
- mBackgroundFadeInAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
- mBackgroundFadeInAnimation.setDuration(BACKGROUND_FADE_IN_DURATION);
- mBackgroundFadeInAnimation.start();
+ if (mBackgroundFadeOutAnimation != null) {
+ mBackgroundFadeOutAnimation.cancel();
+ mBackgroundFadeOutAnimation = null;
+ }
+ if (mBackgroundFadeInAnimation != null) {
+ mBackgroundFadeInAnimation.cancel();
+ mBackgroundFadeInAnimation = null;
+ }
+ final float finalAlpha = 1f;
+ if (animated) {
+ mBackgroundFadeInAnimation = ValueAnimator.ofFloat(getBackgroundAlpha(), finalAlpha);
+ mBackgroundFadeInAnimation.addUpdateListener(new AnimatorUpdateListener() {
+ public void onAnimationUpdate(ValueAnimator animation) {
+ setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
+ }
+ });
+ mBackgroundFadeInAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
+ mBackgroundFadeInAnimation.setDuration(BACKGROUND_FADE_IN_DURATION);
+ mBackgroundFadeInAnimation.start();
+ } else {
+ setBackgroundAlpha(finalAlpha);
+ }
}
- private void hideBackgroundGradient(float finalAlpha) {
+ private void hideBackgroundGradient(float finalAlpha, boolean animated) {
if (mBackground == null) return;
- if (mBackgroundFadeInAnimation != null) mBackgroundFadeInAnimation.cancel();
- if (mBackgroundFadeOutAnimation != null) mBackgroundFadeOutAnimation.cancel();
- mBackgroundFadeOutAnimation = ValueAnimator.ofFloat(getBackgroundAlpha(), finalAlpha);
- mBackgroundFadeOutAnimation.addUpdateListener(new AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator animation) {
- setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
- }
- });
- mBackgroundFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
- mBackgroundFadeOutAnimation.setDuration(BACKGROUND_FADE_OUT_DURATION);
- mBackgroundFadeOutAnimation.start();
+ if (mBackgroundFadeInAnimation != null) {
+ mBackgroundFadeInAnimation.cancel();
+ mBackgroundFadeInAnimation = null;
+ }
+ if (mBackgroundFadeOutAnimation != null) {
+ mBackgroundFadeOutAnimation.cancel();
+ mBackgroundFadeOutAnimation = null;
+ }
+ if (animated) {
+ mBackgroundFadeOutAnimation = ValueAnimator.ofFloat(getBackgroundAlpha(), finalAlpha);
+ mBackgroundFadeOutAnimation.addUpdateListener(new AnimatorUpdateListener() {
+ public void onAnimationUpdate(ValueAnimator animation) {
+ setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
+ }
+ });
+ mBackgroundFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
+ mBackgroundFadeOutAnimation.setDuration(BACKGROUND_FADE_OUT_DURATION);
+ mBackgroundFadeOutAnimation.start();
+ } else {
+ setBackgroundAlpha(finalAlpha);
+ }
}
public void setBackgroundAlpha(float alpha) {
@@ -1523,7 +1544,7 @@ public class Workspace extends SmoothPagedView
}
setChildrenDrawnWithCacheEnabled(true);
- showBackgroundGradientForAllApps();
+ showBackgroundGradientForAllApps(animated);
}
@Override
@@ -1876,7 +1897,7 @@ public class Workspace extends SmoothPagedView
}
hideBackgroundGradient(springLoaded ? getResources().getInteger(
- R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f : 0f);
+ R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f : 0f, animated);
}
/**