View: implement onKeyDown() callback

This commit is contained in:
Julian Winkler
2025-02-18 19:05:53 +01:00
parent 2374d44b0f
commit 161904c8a8
4 changed files with 44 additions and 2 deletions

View File

@@ -2108,7 +2108,16 @@ public class View implements Drawable.Callback {
public boolean requestRectangleOnScreen(Rect rectangle) {return false;}
public boolean dispatchKeyEvent(KeyEvent event) {return false;}
public boolean onKeyDown(int keyCode, KeyEvent event) {
return false;
}
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN)
return onKeyDown(event.getKeyCode(), event);
else
return false;
}
public WindowInsets getRootWindowInsets() {return null;}