RecoveryCodeInputFragment: Switch to MaterialAutoCompleteTextView

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2024-06-24 11:24:54 +05:30
parent cdcb862d9d
commit d15fe36638
2 changed files with 26 additions and 14 deletions

View file

@ -21,7 +21,6 @@ import android.view.View.VISIBLE
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager.LayoutParams.FLAG_SECURE import android.view.WindowManager.LayoutParams.FLAG_SECURE
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.Button import android.widget.Button
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
@ -35,6 +34,7 @@ import cash.z.ecc.android.bip39.Mnemonics.ChecksumException
import cash.z.ecc.android.bip39.Mnemonics.InvalidWordException import cash.z.ecc.android.bip39.Mnemonics.InvalidWordException
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputLayout import com.google.android.material.textfield.TextInputLayout
import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.isDebugBuild import com.stevesoltys.seedvault.isDebugBuild
@ -118,7 +118,7 @@ class RecoveryCodeInputFragment : Fragment() {
for (i in 0 until WORD_NUM) { for (i in 0 until WORD_NUM) {
val wordLayout = getWordLayout(i) val wordLayout = getWordLayout(i)
val editText = wordLayout.editText as AutoCompleteTextView val editText = wordLayout.editText as MaterialAutoCompleteTextView
editText.onFocusChangeListener = OnFocusChangeListener { _, focus -> editText.onFocusChangeListener = OnFocusChangeListener { _, focus ->
if (!focus) wordLayout.isErrorEnabled = false if (!focus) wordLayout.isErrorEnabled = false
} }

View file

@ -23,8 +23,9 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside"> app:layout_constraintVertical_chainStyle="spread_inside">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput1" android:id="@+id/wordInput1"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -45,8 +46,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout1"> app:layout_constraintTop_toBottomOf="@+id/wordLayout1">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput3" android:id="@+id/wordInput3"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -67,8 +69,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout3"> app:layout_constraintTop_toBottomOf="@+id/wordLayout3">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput5" android:id="@+id/wordInput5"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -89,8 +92,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout5"> app:layout_constraintTop_toBottomOf="@+id/wordLayout5">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput7" android:id="@+id/wordInput7"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -111,8 +115,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout7"> app:layout_constraintTop_toBottomOf="@+id/wordLayout7">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput9" android:id="@+id/wordInput9"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -133,8 +138,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout9"> app:layout_constraintTop_toBottomOf="@+id/wordLayout9">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput11" android:id="@+id/wordInput11"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -156,8 +162,9 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside"> app:layout_constraintVertical_chainStyle="spread_inside">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput2" android:id="@+id/wordInput2"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -178,8 +185,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1" app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout2"> app:layout_constraintTop_toBottomOf="@+id/wordLayout2">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput4" android:id="@+id/wordInput4"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -200,8 +208,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1" app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout4"> app:layout_constraintTop_toBottomOf="@+id/wordLayout4">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput6" android:id="@+id/wordInput6"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -222,8 +231,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1" app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout6"> app:layout_constraintTop_toBottomOf="@+id/wordLayout6">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput8" android:id="@+id/wordInput8"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -244,8 +254,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1" app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout8"> app:layout_constraintTop_toBottomOf="@+id/wordLayout8">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput10" android:id="@+id/wordInput10"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"
@ -266,8 +277,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1" app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout10"> app:layout_constraintTop_toBottomOf="@+id/wordLayout10">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView <com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput12" android:id="@+id/wordInput12"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:completionThreshold="1" android:completionThreshold="1"