Animate discovery bounce for all apps pull up interaction
b/30221381
> Will not support landscape case. If the user knows how to enable
rotation, it's very unlikely they don't know how to bring up apps drawer
> If unlocked using finger unlock immediately after screen is turned
off, bounce is not shown due to delay in ACTION_SCREEN_OFF broadcast
Change-Id: Ia8b7e572eaa4aeab8b1add1e5660fee3a63ba21c
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 7423e20..2cfe319 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -198,6 +198,7 @@
static final String INTRO_SCREEN_DISMISSED = "launcher.intro_screen_dismissed";
static final String FIRST_RUN_ACTIVITY_DISPLAYED = "launcher.first_run_activity_displayed";
+ static final String APPS_VIEW_SHOWN = "launcher.apps_view_shown";
/** The different states that Launcher can be in. */
enum State { NONE, WORKSPACE, WORKSPACE_SPRING_LOADED, APPS, APPS_SPRING_LOADED,
@@ -288,6 +289,7 @@
private IconCache mIconCache;
private ExtractedColors mExtractedColors;
private LauncherAccessibilityDelegate mAccessibilityDelegate;
+ private boolean mIsResumeFromActionScreenOff;
@Thunk boolean mUserPresent = true;
private boolean mVisible = false;
private boolean mHasFocus = false;
@@ -1079,6 +1081,10 @@
InstallShortcutReceiver.disableAndFlushInstallQueue(this);
}
+ if (shouldShowDiscoveryBounce()) {
+ mAllAppsController.showDiscoveryBounce();
+ }
+ mIsResumeFromActionScreenOff = false;
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onResume();
}
@@ -1623,6 +1629,7 @@
mAppsView.reset();
}
}
+ mIsResumeFromActionScreenOff = true;
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
mUserPresent = true;
updateAutoAdvanceState();
@@ -3348,6 +3355,7 @@
*/
public void showAppsView(boolean animated, boolean resetListToTop, boolean updatePredictedApps,
boolean focusSearchBar) {
+ markAppsViewShown();
if (resetListToTop) {
mAppsView.scrollToTop();
}
@@ -4358,10 +4366,6 @@
!mSharedPrefs.getBoolean(FIRST_RUN_ACTIVITY_DISPLAYED, false);
}
- protected boolean hasRunFirstRunActivity() {
- return mSharedPrefs.getBoolean(FIRST_RUN_ACTIVITY_DISPLAYED, false);
- }
-
public boolean showFirstRunActivity() {
if (shouldRunFirstRunActivity() &&
hasFirstRunActivity()) {
@@ -4381,6 +4385,29 @@
editor.apply();
}
+ private void markAppsViewShown() {
+ if (mSharedPrefs.getBoolean(APPS_VIEW_SHOWN, false)) {
+ return;
+ }
+ mSharedPrefs.edit().putBoolean(APPS_VIEW_SHOWN, true).apply();
+ }
+
+ private boolean shouldShowDiscoveryBounce() {
+ if (mState != mState.WORKSPACE) {
+ return false;
+ }
+ if (mLauncherCallbacks != null && mLauncherCallbacks.shouldShowDiscoveryBounce()) {
+ return true;
+ }
+ if (!mIsResumeFromActionScreenOff) {
+ return false;
+ }
+ if (mSharedPrefs.getBoolean(APPS_VIEW_SHOWN, false)) {
+ return false;
+ }
+ return true;
+ }
+
/**
* To be overridden by subclasses to indicate that there is an in-activity full-screen intro
* screen that must be displayed and dismissed.