Merge "Listen for cases where touch controllers change, and update them" into ub-launcher3-master

This commit is contained in:
Sunny Goyal authored and Android (Google) Code Review committed 2018-04-12 00:37:22 +00:00
commit 2998e43256
4 files changed
+23 -6

No files matched your search

@@ -16,12 +16,11 @@
package com.android.launcher3.uioverrides;
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.LauncherState.ALL_APPS;
import android.content.Context;
import android.content.SharedPreferences;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
@@ -59,6 +58,10 @@ public class UiFactory {
}
}
public static void setOnTouchControllersChangedListener(Context context, Runnable listener) {
OverviewInteractionState.getInstance(context).setOnSwipeUpSettingChangedListener(listener);
}
public static StateHandler[] getStateHandler(Launcher launcher) {
return new StateHandler[] {
launcher.getAllAppsController(), launcher.getWorkspace(),
@@ -15,7 +15,6 @@
*/
package com.android.quickstep;
import static com.android.launcher3.Utilities.getPrefs;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON;
@@ -86,6 +85,8 @@ public class OverviewInteractionState {
private boolean mBackButtonVisible = true;
private boolean mSwipeUpEnabled = true;
private Runnable mOnSwipeUpSettingChangedListener;
private OverviewInteractionState(Context context) {
mUiHandler = new Handler(this::handleUiMessage);
mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
@@ -124,12 +125,19 @@ public class OverviewInteractionState {
break;
case MSG_SET_SWIPE_UP_ENABLED:
mSwipeUpEnabled = msg.arg1 != 0;
if (mOnSwipeUpSettingChangedListener != null) {
mOnSwipeUpSettingChangedListener.run();
}
break;
}
applyFlags();
return true;
}
public void setOnSwipeUpSettingChangedListener(Runnable listener) {
mOnSwipeUpSettingChangedListener = listener;
}
@WorkerThread
private void applyFlags() {
if (mISystemUiProxy == null) {