Improve recovery code output fragment's wordlist layout
* Enable scrollbar * Enable text size autoscalling * Fix wordList constraints * Set wordList height to match_parent so that scrollbar our word list will always start from top * Set wordList width to match_parent so that scrollbar is displayed on the sides * Reduce landscape spanCount to 3 so that we'll be less likely to clip the some longer word Change-Id: I7a2481fe25163f81f6d3c3626784cc4681f7c4ef
This commit is contained in:
parent
28f9447317
commit
587042dad4
3 changed files with 11 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ class RecoveryCodeOutputFragment : Fragment() {
|
||||||
private fun setGridParameters(list: RecyclerView) {
|
private fun setGridParameters(list: RecyclerView) {
|
||||||
val layoutManager = list.layoutManager as GridLayoutManager
|
val layoutManager = list.layoutManager as GridLayoutManager
|
||||||
if (resources.configuration.orientation == ORIENTATION_LANDSCAPE) {
|
if (resources.configuration.orientation == ORIENTATION_LANDSCAPE) {
|
||||||
layoutManager.spanCount = 4
|
layoutManager.spanCount = 3
|
||||||
} else {
|
} else {
|
||||||
layoutManager.spanCount = 2
|
layoutManager.spanCount = 2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,12 @@
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/wordList"
|
android:id="@+id/wordList"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:scrollbars="vertical"
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:layout_constrainedHeight="true"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/confirmCodeButton"
|
app:layout_constraintBottom_toTopOf="@+id/confirmCodeButton"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:padding="24dp"
|
android:padding="24dp"
|
||||||
tools:showIn="@layout/fragment_recovery_code_output">
|
tools:showIn="@layout/fragment_recovery_code_output">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/num"
|
android:id="@+id/num"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical|end"
|
android:gravity="center_vertical|end"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/word"
|
app:layout_constraintEnd_toStartOf="@+id/word"
|
||||||
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/word"
|
android:id="@+id/word"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:autoSizeTextType="uniform"
|
android:autoSizeTextType="uniform"
|
||||||
android:textSize="24sp"
|
android:gravity="center_vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/num"
|
app:layout_constraintStart_toEndOf="@+id/num"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue