summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-03 22:39:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-03 22:39:30 +0000
commit131e0b1d1830134cf39945282a87e910271ab79f (patch)
treeb90772e499f61389d25234b7c7dea2813cbae799 /src
parent93fbeb17caa512bdaa1f69cbf726cdbd9f98b814 (diff)
parent745df7c4836a59e61c9718681d8d032c31b3ee47 (diff)
downloadandroid_packages_apps_Trebuchet-131e0b1d1830134cf39945282a87e910271ab79f.tar.gz
android_packages_apps_Trebuchet-131e0b1d1830134cf39945282a87e910271ab79f.tar.bz2
android_packages_apps_Trebuchet-131e0b1d1830134cf39945282a87e910271ab79f.zip
Merge "Skipping touch dispatch when it happens withing the window gesture region" into ub-launcher3-master
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/LauncherRootView.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 9f6e5cd43..e738eb7af 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -8,11 +8,15 @@ import android.app.ActivityManager;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Insets;
import android.graphics.Paint;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
+import android.view.WindowInsets;
public class LauncherRootView extends InsettableFrameLayout {
@@ -23,6 +27,9 @@ public class LauncherRootView extends InsettableFrameLayout {
@ViewDebug.ExportedProperty(category = "launcher")
private final Rect mConsumedInsets = new Rect();
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private final RectF mTouchExcludeRegion = new RectF();
+
private View mAlignedView;
private WindowStateListener mWindowStateListener;
@@ -145,6 +152,31 @@ public class LauncherRootView extends InsettableFrameLayout {
}
}
+ @Override
+ public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
+ if (Utilities.ATLEAST_Q) {
+ Insets gestureInsets = insets.getMandatorySystemGestureInsets();
+ mTouchExcludeRegion.set(gestureInsets.left, gestureInsets.top,
+ gestureInsets.right, gestureInsets.bottom);
+ }
+ return super.dispatchApplyWindowInsets(insets);
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ float x = ev.getX();
+ float y = ev.getY();
+ if (y < mTouchExcludeRegion.top
+ || x < mTouchExcludeRegion.left
+ || x > (getWidth() - mTouchExcludeRegion.right)
+ || y > (getHeight() - mTouchExcludeRegion.bottom)) {
+ return false;
+ }
+ }
+ return super.dispatchTouchEvent(ev);
+ }
+
public interface WindowStateListener {
void onWindowFocusChanged(boolean hasFocus);