Skip to content

Commit c8b8cd3

Browse files
qt: keyboard fixes (#3376)
* fix(ui): fix any keypress on keyboard triggered as back button * fix(ui): adjustResize to keyboard by default
1 parent cda8e65 commit c8b8cd3

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

pythonforandroid/bootstraps/qt/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ public void onDestroy() {
123123

124124
@Override
125125
public boolean onKeyDown(int keyCode, KeyEvent event) {
126-
// If it wasn't the Back key or there's no web page history, bubble up to the default
126+
if (keyCode != KeyEvent.KEYCODE_BACK) {
127+
return super.onKeyDown(keyCode, event);
128+
}
129+
130+
// If there's no web page history, bubble up to the default
127131
// system behavior (probably exit the activity)
128132
if (SystemClock.elapsedRealtime() - lastBackClick > 2000) {
129133
lastBackClick = SystemClock.elapsedRealtime();

pythonforandroid/bootstraps/qt/build/templates/AndroidManifest.tmpl.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
android:label="@string/app_name"
6161
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode{% if args.min_sdk_version >= 8 %}|uiMode{% endif %}{% if args.min_sdk_version >= 13 %}|screenSize|smallestScreenSize{% endif %}{% if args.min_sdk_version >= 17 %}|layoutDirection{% endif %}{% if args.min_sdk_version >= 24 %}|density{% endif %}"
6262
android:screenOrientation="{{ args.manifest_orientation }}"
63+
android:windowSoftInputMode="adjustResize"
6364
android:exported="true"
6465
android:theme="@style/KivySupportCutout"
6566
{% if args.activity_launch_mode %}

0 commit comments

Comments
 (0)