From 6b53f9858e3745d5dd24fe67b42e769b0cbba6b9 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Thu, 12 Sep 2024 09:39:19 +0100 Subject: [PATCH] feat: passcode not focusable to keep the same behaviour between custom keyboard and external keyboard --- .../presentation/security/passcode/NumberKeyboard.kt | 10 +++++++++- .../presentation/security/passcode/PassCodeActivity.kt | 1 + owncloudApp/src/main/res/layout/passcode_edit_text.xml | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/NumberKeyboard.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/NumberKeyboard.kt index 2eccf141b29..2bc3f26a1f4 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/NumberKeyboard.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/NumberKeyboard.kt @@ -2,7 +2,9 @@ * ownCloud Android client application * * @author David Crespo Ríos - * Copyright (C) 2022 ownCloud GmbH. + * @author Aitor Ballesteros Pavón + * + * Copyright (C) 2024 ownCloud GmbH. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -71,6 +73,12 @@ class NumberKeyboard(context: Context, attrs: AttributeSet) : ConstraintLayout(c setupListeners() } + fun setFocusOnKey(number: Int) { + if (number in 0..9) { + numericKeys[number].requestFocus() + } + } + /** * Setup on click listeners. */ diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/PassCodeActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/PassCodeActivity.kt index af283a0baff..4283ad96823 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/PassCodeActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/security/passcode/PassCodeActivity.kt @@ -478,6 +478,7 @@ class PassCodeActivity : AppCompatActivity(), NumberKeyboardListener, EnableBiom in KeyEvent.KEYCODE_0..KeyEvent.KEYCODE_9 -> { val number = keyCode - KeyEvent.KEYCODE_0 passCodeViewModel.onNumberClicked(number) + binding.numberKeyboard.setFocusOnKey(number) true } diff --git a/owncloudApp/src/main/res/layout/passcode_edit_text.xml b/owncloudApp/src/main/res/layout/passcode_edit_text.xml index 5c32371030a..d8b0c04b784 100644 --- a/owncloudApp/src/main/res/layout/passcode_edit_text.xml +++ b/owncloudApp/src/main/res/layout/passcode_edit_text.xml @@ -5,4 +5,5 @@ style="@style/PassCodeStyle" android:cursorVisible="true" android:layout_width="32dp" - android:imeOptions="flagNoExtractUi"/> \ No newline at end of file + android:imeOptions="flagNoExtractUi" + android:focusable="false"/> \ No newline at end of file