Skip to content

Commit 2c193ba

Browse files
author
lanmao
committed
Fix Qt bootstrap non-back key handling
1 parent 70f9224 commit 2c193ba

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ 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
127-
// system behavior (probably exit the activity)
126+
if (keyCode != KeyEvent.KEYCODE_BACK) {
127+
return super.onKeyDown(keyCode, event);
128+
}
129+
128130
if (SystemClock.elapsedRealtime() - lastBackClick > 2000) {
129131
lastBackClick = SystemClock.elapsedRealtime();
130132
Toast.makeText(this, "Click again to close the app", Toast.LENGTH_LONG).show();

0 commit comments

Comments
 (0)