mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Quickstep onboarding backward compatibility for devices release with Android N & O.
Quickstep introduces swipe up gesture to open Overview and removes the Recents button. We still want to show shelf bounce animation for Android N & O users with Recents button because Overview is updated and swiping up from there takes users to All Apps. Test: manual test Change-Id: I917c91564c47c78d2dc3883b8a7bf7824b5f5bc8 Fixes: 78647939
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
|
||||
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
|
||||
|
||||
import android.view.View;
|
||||
@@ -47,10 +46,6 @@ public class AllAppsState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public void onStateEnabled(Launcher launcher) {
|
||||
if (!launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false)) {
|
||||
launcher.getSharedPrefs().edit().putBoolean(SHELF_BOUNCE_SEEN, true).apply();
|
||||
}
|
||||
|
||||
AbstractFloatingView.closeAllOpenViews(launcher);
|
||||
dispatchWindowStateChanged(launcher);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
|
||||
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
|
||||
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
|
||||
|
||||
@@ -59,10 +58,6 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public void onStateEnabled(Launcher launcher) {
|
||||
if (!launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false)) {
|
||||
launcher.getSharedPrefs().edit().putBoolean(HOME_BOUNCE_SEEN, true).apply();
|
||||
}
|
||||
|
||||
RecentsView rv = launcher.getOverviewPanel();
|
||||
rv.setOverviewStateEnabled(true);
|
||||
AbstractFloatingView.closeAllOpenViews(launcher);
|
||||
|
||||
@@ -21,6 +21,8 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
|
||||
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -28,6 +30,7 @@ import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.LauncherStateManager.StateHandler;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.quickstep.OverviewInteractionState;
|
||||
@@ -88,6 +91,55 @@ public class UiFactory {
|
||||
recents.reset();
|
||||
}
|
||||
|
||||
public static void onCreate(Launcher launcher) {
|
||||
if (!launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false)) {
|
||||
launcher.getStateManager().addStateListener(new LauncherStateManager.StateListener() {
|
||||
@Override
|
||||
public void onStateSetImmediately(LauncherState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
boolean swipeUpEnabled = OverviewInteractionState.getInstance(launcher)
|
||||
.isSwipeUpGestureEnabled();
|
||||
LauncherState prevState = launcher.getStateManager().getLastState();
|
||||
|
||||
if (((swipeUpEnabled && finalState == OVERVIEW) || (!swipeUpEnabled
|
||||
&& finalState == ALL_APPS && prevState == NORMAL))) {
|
||||
launcher.getSharedPrefs().edit().putBoolean(HOME_BOUNCE_SEEN, true).apply();
|
||||
launcher.getStateManager().removeStateListener(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false)) {
|
||||
launcher.getStateManager().addStateListener(new LauncherStateManager.StateListener() {
|
||||
@Override
|
||||
public void onStateSetImmediately(LauncherState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
LauncherState prevState = launcher.getStateManager().getLastState();
|
||||
|
||||
if (finalState == ALL_APPS && prevState == OVERVIEW) {
|
||||
launcher.getSharedPrefs().edit().putBoolean(SHELF_BOUNCE_SEEN, true).apply();
|
||||
launcher.getStateManager().removeStateListener(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void onStart(Context context) {
|
||||
RecentsModel model = RecentsModel.getInstance(context);
|
||||
if (model != null) {
|
||||
|
||||
@@ -283,6 +283,7 @@ public class Launcher extends BaseDraggingActivity
|
||||
mDragController = new DragController(this);
|
||||
mAllAppsController = new AllAppsTransitionController(this);
|
||||
mStateManager = new LauncherStateManager(this);
|
||||
UiFactory.onCreate(this);
|
||||
|
||||
mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ public class UiFactory {
|
||||
|
||||
public static void onLauncherStateOrFocusChanged(Launcher launcher) { }
|
||||
|
||||
public static void onCreate(Launcher launcher) { }
|
||||
|
||||
public static void onStart(Launcher launcher) { }
|
||||
|
||||
public static void onLauncherStateOrResumeChanged(Launcher launcher) { }
|
||||
|
||||
Reference in New Issue
Block a user