#291 enhance focus flow in dialog's using TAB key in hardware keyboards

This commit is contained in:
Julian Raufelder 2021-04-15 13:02:07 +02:00
parent 8d198dafe4
commit 88f17d610f
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
8 changed files with 25 additions and 16 deletions

View File

@ -46,6 +46,11 @@ class ChangePasswordDialog : BaseProgressErrorDialog<ChangePasswordDialog.Callba
}
dialog.setCanceledOnTouchOutside(false)
et_old_password.requestFocus()
et_old_password.nextFocusForwardId = et_new_password.id
et_new_password.nextFocusForwardId = et_new_retype_password.id
changePasswordButton?.let { button ->
et_new_retype_password.nextFocusForwardId = button.id
}
}
}

View File

@ -41,6 +41,9 @@ class CloudNodeRenameDialog : BaseProgressErrorDialog<CloudNodeRenameDialog.Call
}
dialog.setCanceledOnTouchOutside(false)
et_rename.requestFocus()
renameConfirmButton?.let { button ->
et_rename.nextFocusForwardId = button.id
}
}
}

View File

@ -36,6 +36,9 @@ class CreateFolderDialog : BaseProgressErrorDialog<CreateFolderDialog.Callback>(
}
dialog.setCanceledOnTouchOutside(false)
et_folder_name.requestFocus()
createFolderButton?.let { button ->
et_folder_name.nextFocusForwardId = button.id
}
}
}

View File

@ -41,7 +41,9 @@ class EnterPasswordDialog : BaseProgressErrorDialog<EnterPasswordDialog.Callback
onWaitForResponse(et_password)
dialog.getButton(android.app.Dialog.BUTTON_NEGATIVE)?.isEnabled = true
}
unlockButton?.let { button ->
et_password.nextFocusForwardId = button.id
}
it.setCanceledOnTouchOutside(false)
et_password.requestFocus()
}

View File

@ -32,6 +32,9 @@ class FileNameDialog : BaseProgressErrorDialog<FileNameDialog.Callback>() {
}
dialog.setCanceledOnTouchOutside(false)
file_name.requestFocus()
createFileButton?.let { button ->
file_name.nextFocusForwardId = button.id
}
}
}

View File

@ -23,14 +23,17 @@ class UpdateLicenseDialog : BaseProgressErrorDialog<UpdateLicenseDialog.Callback
override fun onStart() {
super.onStart()
allowClosingDialog(false)
val dialog = dialog as AlertDialog?
if (dialog != null) {
dialog?.let {
checkLicenseButton = dialog.getButton(android.app.Dialog.BUTTON_POSITIVE)
checkLicenseButton?.setOnClickListener {
callback?.checkLicenseClicked(et_license.text.toString())
onWaitForResponse(et_license)
}
dialog.setCanceledOnTouchOutside(false)
checkLicenseButton?.let { button ->
et_license.nextFocusForwardId = button.id
}
}
}
@ -39,7 +42,6 @@ class UpdateLicenseDialog : BaseProgressErrorDialog<UpdateLicenseDialog.Callback
.setTitle(getString(R.string.dialog_enter_license_title)) //
.setPositiveButton(getText(R.string.dialog_enter_license_ok_button)) { _: DialogInterface, _: Int -> } //
.setNegativeButton(getText(R.string.dialog_enter_license_decline_button)) { _: DialogInterface, _: Int -> callback?.onCheckLicenseCanceled() } //
.setCancelable(false) //
.create()
}

View File

@ -37,6 +37,9 @@ class VaultRenameDialog : BaseProgressErrorDialog<VaultRenameDialog.Callback>()
}
dialog.setCanceledOnTouchOutside(false)
et_rename.requestFocus()
renameConfirmButton?.let { button ->
et_rename.nextFocusForwardId = button.id
}
}
}

View File

@ -1,12 +0,0 @@
package org.cryptomator.presentation.ui.fragment
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import org.cryptomator.presentation.R
class LicensesFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.licenses)
}
}