summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-08-03 15:16:44 -0700
committerMichael Jurka <mikejurka@google.com>2011-08-04 15:37:22 -0700
commit7bdb25a9894970da74248c9cdc606d0e1ba05c99 (patch)
treec82653a0946b58501222b7b79d4e6e01f336155d /src
parent46180f8132c4b69878f406ac2fb06032d00ff567 (diff)
downloadandroid_packages_apps_Trebuchet-7bdb25a9894970da74248c9cdc606d0e1ba05c99.tar.gz
android_packages_apps_Trebuchet-7bdb25a9894970da74248c9cdc606d0e1ba05c99.tar.bz2
android_packages_apps_Trebuchet-7bdb25a9894970da74248c9cdc606d0e1ba05c99.zip
Updating All Apps background
- Making background of All Apps black - Drawing background within All Apps (perf gains) Change-Id: I164274235bc347de04fab0702b7e7075e499e6c0
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Launcher.java5
-rw-r--r--src/com/android/launcher2/Workspace.java73
2 files changed, 31 insertions, 47 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 481bc05e5..c02563857 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2173,7 +2173,12 @@ public final class Launcher extends Activity
@Override
public void run() {
exitSpringLoadedDragMode();
+
if (successfulDrop) {
+ // Before we show workspace, hide all apps again because
+ // exitSpringLoadedDragMode made it visible. This is a bit hacky; we should
+ // clean up our state transition functions
+ mAppsCustomizeTabHost.setVisibility(View.GONE);
showWorkspace(true);
}
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 26c00ad8d..b411fbbb3 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1000,37 +1000,7 @@ public class Workspace extends SmoothPagedView
mDrawBackground = true;
}
- private void showBackgroundGradientForAllApps(boolean animated) {
- showBackgroundGradient(animated);
- }
-
- private void showBackgroundGradient(boolean animated) {
- if (mBackground == null) return;
- 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, boolean animated) {
+ private void animateBackgroundGradient(float finalAlpha, boolean animated) {
if (mBackground == null) return;
if (mBackgroundFadeInAnimation != null) {
mBackgroundFadeInAnimation.cancel();
@@ -1040,18 +1010,21 @@ public class Workspace extends SmoothPagedView
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);
+ float startAlpha = getBackgroundAlpha();
+ if (finalAlpha != startAlpha) {
+ if (animated) {
+ mBackgroundFadeOutAnimation = ValueAnimator.ofFloat(startAlpha, 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);
+ }
}
}
@@ -1552,8 +1525,6 @@ public class Workspace extends SmoothPagedView
updateWallpaperOffsetImmediately();
}
setChildrenDrawnWithCacheEnabled(true);
-
- showBackgroundGradientForAllApps(animated);
}
@Override
@@ -1925,8 +1896,16 @@ public class Workspace extends SmoothPagedView
}
}
- hideBackgroundGradient(springLoaded ? getResources().getInteger(
- R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f : 0f, animated);
+ if (springLoaded) {
+ // Right now we're covered by Apps Customize
+ // Show the background gradient immediately, so the gradient will
+ // be showing once AppsCustomize disappears
+ animateBackgroundGradient(getResources().getInteger(
+ R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false);
+ } else {
+ // Fade the background gradient away
+ animateBackgroundGradient(0f, true);
+ }
}
/**