summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-11-25 00:02:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-11-25 00:02:12 +0000
commit6e83dc4031b78ac6e65102b2d936e9e769686fec (patch)
tree2df31aeb5c28f0b698401a52eaf16452194bfe2f
parent1a690cb785a1b1644ad4c97e8b755528b2222cfc (diff)
parent112ac95571c9b81921a912d67b9c369fb523a235 (diff)
downloadandroid_packages_apps_Trebuchet-6e83dc4031b78ac6e65102b2d936e9e769686fec.tar.gz
android_packages_apps_Trebuchet-6e83dc4031b78ac6e65102b2d936e9e769686fec.tar.bz2
android_packages_apps_Trebuchet-6e83dc4031b78ac6e65102b2d936e9e769686fec.zip
Merge "Skip to the end of the folder open animation in battery saver mode." into ub-launcher3-burnaby-polish
-rw-r--r--src/com/android/launcher3/CellLayout.java6
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/Utilities.java7
3 files changed, 12 insertions, 5 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 5f64a829b..0a2a01728 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -36,7 +36,6 @@ 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;
@@ -2183,10 +2182,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
// 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) {
+ if (!Utilities.isPowerSaverOn(getContext())) {
va.setRepeatMode(ValueAnimator.REVERSE);
va.setRepeatCount(ValueAnimator.INFINITE);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 7b335d15f..ad3087726 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3102,6 +3102,10 @@ public class Launcher extends Activity
}
oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
oa.start();
+ if (Utilities.isPowerSaverOn(this)) {
+ // Animations are disabled in battery saver mode, so just skip to the end state.
+ oa.end();
+ }
}
private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index d14d056fe..735cbebb7 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -46,6 +46,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Bundle;
+import android.os.PowerManager;
import android.os.Process;
import android.text.Spannable;
import android.text.SpannableString;
@@ -759,4 +760,10 @@ public final class Utilities {
return context.getSharedPreferences(
LauncherFiles.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE);
}
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public static boolean isPowerSaverOn(Context context) {
+ PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ return ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode();
+ }
}