Skip to content

Commit

Permalink
RecoveryCodeInputFragment: Switch to MaterialAutoCompleteTextView
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson committed Jun 24, 2024
1 parent f81dbb1 commit a160ff7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import android.view.View.VISIBLE
import android.view.ViewGroup
import android.view.WindowManager.LayoutParams.FLAG_SECURE
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
Expand All @@ -35,6 +34,7 @@ import cash.z.ecc.android.bip39.Mnemonics.ChecksumException
import cash.z.ecc.android.bip39.Mnemonics.InvalidWordException
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputLayout
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.isDebugBuild
Expand Down Expand Up @@ -118,7 +118,7 @@ class RecoveryCodeInputFragment : Fragment() {

for (i in 0 until WORD_NUM) {
val wordLayout = getWordLayout(i)
val editText = wordLayout.editText as AutoCompleteTextView
val editText = wordLayout.editText as MaterialAutoCompleteTextView
editText.onFocusChangeListener = OnFocusChangeListener { _, focus ->
if (!focus) wordLayout.isErrorEnabled = false
}
Expand Down
36 changes: 24 additions & 12 deletions app/src/main/res/layout/recovery_code_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput1"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -45,8 +46,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout1">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput3"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -67,8 +69,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout3">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput5"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -89,8 +92,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout5">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput7"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -111,8 +115,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout7">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput9"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -133,8 +138,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout9">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput11"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -156,8 +162,9 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput2"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -178,8 +185,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout2">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput4"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -200,8 +208,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout4">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput6"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -222,8 +231,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout6">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput8"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -244,8 +254,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout8">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput10"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand All @@ -266,8 +277,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout10">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput12"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
Expand Down

0 comments on commit a160ff7

Please sign in to comment.