summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Lee <llee@cyngn.com>2015-05-28 22:51:33 (GMT)
committerStephen Bird <sbird@cyngn.com>2015-06-01 17:25:23 (GMT)
commit3e0d08d7ff471efc3ffd1b73135243fc5d0afc09 (patch)
tree8d5b6a6fe7ba2f9d9c6845adb5a4e7d1d0a1ec0f
parent7025ea24402546e4d40facc519dc2d3d8a5f4cf1 (diff)
downloadandroid_packages_apps_Trebuchet-3e0d08d7ff471efc3ffd1b73135243fc5d0afc09.zip
android_packages_apps_Trebuchet-3e0d08d7ff471efc3ffd1b73135243fc5d0afc09.tar.gz
android_packages_apps_Trebuchet-3e0d08d7ff471efc3ffd1b73135243fc5d0afc09.tar.bz2
Fix power save mode broken ui/animations
Conflicts: src/com/android/launcher3/Folder.java Change-Id: I7dc0123300ff2e9aa64713c1091d13ecc93001f3
-rw-r--r--src/com/android/launcher3/Workspace.java44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6f94445..811c4b2 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -64,8 +64,6 @@ import android.view.ViewPropertyAnimator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.accessibility.AccessibilityManager;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
@@ -2305,7 +2303,7 @@ public class Workspace extends SmoothPagedView
float finalHotseatAndPageIndicatorAlpha = (stateIsNormal || stateIsSpringLoaded) ? 1f : 0f;
final float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f;
- float finalWorkspaceTranslationY = stateIsOverview || stateIsOverviewHidden ?
+ final float finalWorkspaceTranslationY = stateIsOverview || stateIsOverviewHidden ?
getOverviewModeTranslationY() : 0;
boolean workspaceToAllApps = (oldStateIsNormal && stateIsNormalHidden);
@@ -2414,6 +2412,15 @@ public class Workspace extends SmoothPagedView
.translationY(finalWorkspaceTranslationY)
.setDuration(duration)
.setInterpolator(mZoomInInterpolator);
+ scale.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ // in low power mode the animation doesn't play, so set the end value here
+ setScaleX(mNewScale);
+ setScaleY(mNewScale);
+ setTranslationY(finalWorkspaceTranslationY);
+ }
+ });
anim.play(scale);
for (int index = 0; index < getChildCount(); index++) {
final int i = index;
@@ -2427,11 +2434,20 @@ public class Workspace extends SmoothPagedView
layerViews.add(cl);
}
if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) {
+ final View shortcutAndWidgets = cl.getShortcutsAndWidgets();
LauncherViewPropertyAnimator alphaAnim =
- new LauncherViewPropertyAnimator(cl.getShortcutsAndWidgets());
+ new LauncherViewPropertyAnimator(shortcutAndWidgets);
alphaAnim.alpha(mNewAlphas[i])
.setDuration(duration)
.setInterpolator(mZoomInInterpolator);
+ alphaAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ // in low power mode the animation doesn't play,
+ // so set the end value here
+ shortcutAndWidgets.setAlpha(mNewAlphas[i]);
+ }
+ });
anim.play(alphaAnim);
}
if (mOldBackgroundAlphas[i] != 0 ||
@@ -2455,7 +2471,8 @@ public class Workspace extends SmoothPagedView
if (pageIndicator != null) {
pageIndicatorAlpha = new LauncherViewPropertyAnimator(pageIndicator)
.alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
- pageIndicatorAlpha.addListener(new AlphaUpdateListener(pageIndicator));
+ pageIndicatorAlpha.addListener(
+ new AlphaUpdateListener(pageIndicator, finalHotseatAndPageIndicatorAlpha));
} else {
// create a dummy animation so we don't need to do null checks later
pageIndicatorAlpha = ValueAnimator.ofFloat(0, 0);
@@ -2463,15 +2480,19 @@ public class Workspace extends SmoothPagedView
Animator hotseatAlpha = new LauncherViewPropertyAnimator(hotseat)
.alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
- hotseatAlpha.addListener(new AlphaUpdateListener(hotseat));
+ hotseatAlpha.addListener(
+ new AlphaUpdateListener(hotseat, finalHotseatAndPageIndicatorAlpha));
Animator searchBarAlpha = new LauncherViewPropertyAnimator(searchBar)
.alpha(finalSearchBarAlpha).withLayer();
- if (mShowSearchBar) searchBarAlpha.addListener(new AlphaUpdateListener(searchBar));
+ if (mShowSearchBar) {
+ searchBarAlpha.addListener(new AlphaUpdateListener(searchBar, finalSearchBarAlpha));
+ }
Animator overviewPanelAlpha = new LauncherViewPropertyAnimator(overviewPanel)
.alpha(finalOverviewPanelAlpha).withLayer();
- overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel));
+ overviewPanelAlpha.addListener(
+ new AlphaUpdateListener(overviewPanel, finalOverviewPanelAlpha));
// For animation optimations, we may need to provide the Launcher transition
// with a set of views on which to force build layers in certain scenarios.
@@ -2580,8 +2601,10 @@ public class Workspace extends SmoothPagedView
static class AlphaUpdateListener implements AnimatorUpdateListener, AnimatorListener {
View view;
- public AlphaUpdateListener(View v) {
+ float endAlpha;
+ public AlphaUpdateListener(View v, float target) {
view = v;
+ endAlpha = target;
}
@Override
@@ -2607,6 +2630,9 @@ public class Workspace extends SmoothPagedView
@Override
public void onAnimationEnd(Animator arg0) {
+ // in low power mode the animation doesn't play, so we need to set the end alpha
+ // before calling updateVisibility
+ view.setAlpha(endAlpha);
updateVisibility(view);
}