summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTracy Zhou <tracyzhou@google.com>2019-01-25 20:36:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-01-25 20:36:23 +0000
commit7eebfc564982bdb64ea34d04f0955647dc40192a (patch)
treec1540c2fd8e1311723bcee19975afe3d035b1d20 /src
parentd182943d3d28a5356dc7a8631e4fb3325a15ed1e (diff)
parentc49f3de3bdf10f6b6523864f3a22a903e96fa27b (diff)
downloadandroid_packages_apps_Trebuchet-7eebfc564982bdb64ea34d04f0955647dc40192a.tar.gz
android_packages_apps_Trebuchet-7eebfc564982bdb64ea34d04f0955647dc40192a.tar.bz2
android_packages_apps_Trebuchet-7eebfc564982bdb64ea34d04f0955647dc40192a.zip
Merge "Make bounce animations less aggressive" into ub-launcher3-master
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/allapps/DiscoveryBounce.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java
index 76b25655c..7467119b5 100644
--- a/src/com/android/launcher3/allapps/DiscoveryBounce.java
+++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java
@@ -25,6 +25,7 @@ import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager;
+import android.content.SharedPreferences;
import android.os.Handler;
import android.view.MotionEvent;
@@ -43,6 +44,10 @@ public class DiscoveryBounce extends AbstractFloatingView {
public static final String HOME_BOUNCE_SEEN = "launcher.apps_view_shown";
public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen";
+ public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count";
+ public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count";
+
+ public static final int BOUNCE_MAX_COUNT = 3;
private final Launcher mLauncher;
private final Animator mDiscoBounceAnimation;
@@ -137,6 +142,7 @@ public class DiscoveryBounce extends AbstractFloatingView {
new Handler().postDelayed(() -> showForHomeIfNeeded(launcher, false), DELAY_MS);
return;
}
+ incrementHomeBounceCount(launcher);
new DiscoveryBounce(launcher, 0).show(HOTSEAT);
}
@@ -165,6 +171,7 @@ public class DiscoveryBounce extends AbstractFloatingView {
// TODO: Move these checks to the top and call this method after invalidate handler.
return;
}
+ incrementShelfBounceCount(launcher);
new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher)))
.show(PREDICTION);
@@ -197,4 +204,22 @@ public class DiscoveryBounce extends AbstractFloatingView {
PersonalWorkSlidingTabStrip.KEY_SHOWED_PEEK_WORK_TAB, false)
&& UserManagerCompat.getInstance(launcher).hasWorkProfile();
}
+
+ private static void incrementShelfBounceCount(Launcher launcher) {
+ SharedPreferences sharedPrefs = launcher.getSharedPrefs();
+ int count = sharedPrefs.getInt(SHELF_BOUNCE_COUNT, 0);
+ if (count > BOUNCE_MAX_COUNT) {
+ return;
+ }
+ sharedPrefs.edit().putInt(SHELF_BOUNCE_COUNT, count + 1).apply();
+ }
+
+ private static void incrementHomeBounceCount(Launcher launcher) {
+ SharedPreferences sharedPrefs = launcher.getSharedPrefs();
+ int count = sharedPrefs.getInt(HOME_BOUNCE_COUNT, 0);
+ if (count > BOUNCE_MAX_COUNT) {
+ return;
+ }
+ sharedPrefs.edit().putInt(HOME_BOUNCE_COUNT, count + 1).apply();
+ }
}