mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-26 09:13:21 +01:00
Disable the back-gesture on the keyboard area
as well as other system gestures that would interfere with the keyboard's own swipe gesture.
This commit is contained in:
parent
fc68f2e07d
commit
d644d2bf0e
@ -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
|
||||
@ -234,6 +236,20 @@ public class Keyboard2View extends View
|
||||
_keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user