abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2View.java
diff options
context:
space:
mode:
authorJules Aguillon2022-11-11 16:14:44 +0100
committerJules Aguillon2022-11-11 16:14:44 +0100
commitd644d2bf0e84beb942142ef8deee143c9e54ce8c (patch)
tree9a79190a0db4491963df315a9ed17784adcdf9b0 /srcs/juloo.keyboard2/Keyboard2View.java
parentfc68f2e07d501a350c3b520c30029683a1d05534 (diff)
downloadunexpected-keyboard-d644d2bf0e84beb942142ef8deee143c9e54ce8c.tar.gz
unexpected-keyboard-d644d2bf0e84beb942142ef8deee143c9e54ce8c.zip
Disable the back-gesture on the keyboard area
as well as other system gestures that would interfere with the keyboard's own swipe gesture.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index d82b58a..949eb0b 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Canvas;
import android.graphics.Paint;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.inputmethodservice.InputMethodService;
import android.os.Build.VERSION;
@@ -14,6 +15,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
+import java.util.Arrays;
public class Keyboard2View extends View
implements View.OnTouchListener, Pointers.IPointerEventHandler
@@ -235,6 +237,20 @@ public class Keyboard2View extends View
}
@Override
+ public void onLayout(boolean changed, int left, int top, int right, int bottom)
+ {
+ if (!changed)
+ return;
+ // Disable the back-gesture on the keyboard area
+ Rect keyboard_area = new Rect(
+ left + (int)_config.horizontalMargin,
+ top + (int)_config.marginTop,
+ right - (int)_config.horizontalMargin,
+ bottom - (int)_config.marginBottom);
+ setSystemGestureExclusionRects(Arrays.asList(keyboard_area));
+ }
+
+ @Override
protected void onDraw(Canvas canvas)
{
updateFlags();