summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/CellLayout.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-09-02 14:45:39 -0700
committerTony Wickham <twickham@google.com>2015-09-04 21:57:25 +0000
commit489fc56df80293f107fe706b19456edab10b9872 (patch)
tree50622608ec6a7faf48514f3d5fa9e5fd6adf6868 /src/com/android/launcher3/CellLayout.java
parent1268855200e519985e2c845ba84d2d613fa4a36c (diff)
downloadandroid_packages_apps_Trebuchet-489fc56df80293f107fe706b19456edab10b9872.tar.gz
android_packages_apps_Trebuchet-489fc56df80293f107fe706b19456edab10b9872.tar.bz2
android_packages_apps_Trebuchet-489fc56df80293f107fe706b19456edab10b9872.zip
Don't repeat ReorderPreviewAnimation for folders/widgets in power save mode.
Since power save mode (introduced in Lollipop, also known as battery saver) disables animations, the ReorderPreviewAnimation looks bad - instead of displaced folders subtly and smoothly moving up and down, they violently jump between up and down positions in rapid succession. Setting the animation to not repeat in this case avoids this issue. Bug: 23675090 Change-Id: I8149610af75e7023dca28a942b3447228083cd33 (cherry picked from commit 9e0702f4af33db569c9ed79bdf311204abe40dd5)
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r--src/com/android/launcher3/CellLayout.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 84e2d49c2..c018341ff 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -37,6 +37,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Build;
import android.os.Parcelable;
+import android.os.PowerManager;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
@@ -47,6 +48,7 @@ import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
+import android.widget.Toast;
import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler;
import com.android.launcher3.FolderIcon.FolderRingAnimator;
@@ -2133,8 +2135,18 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
}
ValueAnimator va = LauncherAnimUtils.ofFloat(child, 0f, 1f);
a = va;
- va.setRepeatMode(ValueAnimator.REVERSE);
- va.setRepeatCount(ValueAnimator.INFINITE);
+
+ // Animations are disabled in power save mode, causing the repeated animation to jump
+ // spastically between beginning and end states. Since this looks bad, we don't repeat
+ // the animation in power save mode.
+ PowerManager powerManager = (PowerManager) getContext()
+ .getSystemService(Context.POWER_SERVICE);
+ boolean powerSaverOn = Utilities.ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode();
+ if (!powerSaverOn) {
+ va.setRepeatMode(ValueAnimator.REVERSE);
+ va.setRepeatCount(ValueAnimator.INFINITE);
+ }
+
va.setDuration(mode == MODE_HINT ? HINT_DURATION : PREVIEW_DURATION);
va.setStartDelay((int) (Math.random() * 60));
va.addUpdateListener(new AnimatorUpdateListener() {