mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Reset home bounce as unseen for users upgrading from Android O/N to P.
Change-Id: I18b80f874180c8cc94e3101bcbceb75ecd4c28bc Fixes: 78647939 Test: Manual test
This commit is contained in:
@@ -36,6 +36,8 @@ import android.support.annotation.WorkerThread;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.launcher3.MainThreadExecutor;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.DiscoveryBounce;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
|
||||
@@ -55,6 +57,8 @@ public class OverviewInteractionState {
|
||||
|
||||
private static final String TAG = "OverviewFlags";
|
||||
|
||||
private static final String HAS_ENABLED_QUICKSTEP_ONCE = "launcher.has_enabled_quickstep_once";
|
||||
|
||||
// We do not need any synchronization for this variable as its only written on UI thread.
|
||||
private static OverviewInteractionState INSTANCE;
|
||||
|
||||
@@ -80,6 +84,7 @@ public class OverviewInteractionState {
|
||||
|
||||
private final SwipeUpGestureEnabledSettingObserver mSwipeUpSettingObserver;
|
||||
|
||||
private final Context mContext;
|
||||
private final Handler mUiHandler;
|
||||
private final Handler mBgHandler;
|
||||
|
||||
@@ -91,6 +96,7 @@ public class OverviewInteractionState {
|
||||
private Runnable mOnSwipeUpSettingChangedListener;
|
||||
|
||||
private OverviewInteractionState(Context context) {
|
||||
mContext = context;
|
||||
mUiHandler = new Handler(this::handleUiMessage);
|
||||
mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
|
||||
|
||||
@@ -133,6 +139,8 @@ public class OverviewInteractionState {
|
||||
break;
|
||||
case MSG_SET_SWIPE_UP_ENABLED:
|
||||
mSwipeUpEnabled = msg.arg1 != 0;
|
||||
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
||||
|
||||
if (mOnSwipeUpSettingChangedListener != null) {
|
||||
mOnSwipeUpSettingChangedListener.run();
|
||||
}
|
||||
@@ -179,6 +187,7 @@ public class OverviewInteractionState {
|
||||
mResolver.registerContentObserver(Settings.Secure.getUriFor(SWIPE_UP_SETTING_NAME),
|
||||
false, this);
|
||||
mSwipeUpEnabled = getValue();
|
||||
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,4 +210,14 @@ public class OverviewInteractionState {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void resetHomeBounceSeenOnQuickstepEnabledFirstTime() {
|
||||
if (mSwipeUpEnabled && !Utilities.getPrefs(mContext).getBoolean(
|
||||
HAS_ENABLED_QUICKSTEP_ONCE, true)) {
|
||||
Utilities.getPrefs(mContext).edit()
|
||||
.putBoolean(HAS_ENABLED_QUICKSTEP_ONCE, true)
|
||||
.putBoolean(DiscoveryBounce.HOME_BOUNCE_SEEN, false)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user