2
0
Fork 1
mirror of https://github.com/FossifyOrg/Gallery.git synced 2025-04-21 02:44:00 +02:00

Avoid consuming all key events

The dialog's key listener was consuming all key events and led to problems like https://github.com/FossifyOrg/Gallery/issues/128
This commit is contained in:
Naveen Singh 2025-04-02 16:12:32 +05:30
parent 5630a4ceb0
commit e6a90db721
No known key found for this signature in database
GPG key ID: AF5D43C216778C0B

View file

@ -1,7 +1,8 @@
package org.fossify.gallery.dialogs
import android.graphics.Color
import android.view.KeyEvent
import android.view.KeyEvent.ACTION_UP
import android.view.KeyEvent.KEYCODE_BACK
import android.view.inputmethod.EditorInfo
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
@ -54,10 +55,12 @@ class PickDirectoryDialog(
.setPositiveButton(org.fossify.commons.R.string.ok, null)
.setNegativeButton(org.fossify.commons.R.string.cancel, null)
.setOnKeyListener { dialogInterface, i, keyEvent ->
if (keyEvent.action == KeyEvent.ACTION_UP && i == KeyEvent.KEYCODE_BACK) {
return@setOnKeyListener if (keyEvent.action == ACTION_UP && i == KEYCODE_BACK) {
backPressed()
true
} else {
false
}
true
}
if (showOtherFolderButton) {