summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibXZR <i@xzr.moe>2022-01-29 16:32:00 +0800
committeralk3pInjection <webmaster@raspii.tech>2022-02-17 10:03:45 +0800
commit2d22a4d8e3291c8eaeed7a5fd6f62f48f850242e (patch)
tree36ae2617f39b075a9504d08d963f7191a69249ae
parent205535f99d7c4fe6aea496e3b6d1f77ccfaf24e2 (diff)
Launcher3: Use system toggle for dt2s gesturesugisawa
Change-Id: I603f08a1d1592d3468463aeb95235609be90cf97
-rw-r--r--src/com/android/launcher3/touch/WorkspaceTouchListener.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
index 96955dcdf8..a5637b9208 100644
--- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java
+++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.touch;
+import static android.provider.Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE;
+
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
@@ -25,9 +27,11 @@ import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_LONGPRESS;
import android.content.Context;
+import android.content.ContentResolver;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.PowerManager;
+import android.provider.Settings;
import android.view.GestureDetector;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
@@ -74,6 +78,8 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
private final GestureDetector mGestureDetector;
+ private final ContentResolver mContentResolver;
+
public WorkspaceTouchListener(Launcher launcher, Workspace workspace) {
mLauncher = launcher;
mWorkspace = workspace;
@@ -82,6 +88,7 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
mTouchSlop = 2 * ViewConfiguration.get(launcher).getScaledTouchSlop();
mPm = (PowerManager) workspace.getContext().getSystemService(Context.POWER_SERVICE);
mGestureDetector = new GestureDetector(workspace.getContext(), this);
+ mContentResolver = workspace.getContext().getContentResolver();
}
@Override
@@ -189,7 +196,8 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
@Override
public boolean onDoubleTap(MotionEvent event) {
- mPm.goToSleep(event.getEventTime());
+ if (Settings.Secure.getInt(mContentResolver, DOUBLE_TAP_SLEEP_GESTURE, 0) == 1)
+ mPm.goToSleep(event.getEventTime());
return true;
}
}