|
4 | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | 6 | android:layout_width="match_parent" |
7 | | - android:layout_height="match_parent" |
| 7 | + android:layout_height="wrap_content" |
8 | 8 | android:paddingHorizontal="@dimen/padding_heavy" |
9 | 9 | android:paddingTop="@dimen/padding_heavy" |
10 | 10 | android:paddingBottom="@dimen/padding_large"> |
|
36 | 36 | app:layout_constraintEnd_toEndOf="parent" |
37 | 37 | app:layout_constraintTop_toTopOf="parent" /> |
38 | 38 |
|
39 | | - <!-- Loading state --> |
40 | | - <ProgressBar |
41 | | - android:id="@+id/switch_version_progress" |
42 | | - android:layout_width="wrap_content" |
43 | | - android:layout_height="wrap_content" |
44 | | - android:layout_marginTop="@dimen/padding_large" |
45 | | - app:layout_constraintTop_toBottomOf="@id/switch_version_title" |
46 | | - app:layout_constraintStart_toStartOf="parent" |
47 | | - app:layout_constraintEnd_toEndOf="parent" /> |
48 | | - |
49 | | - <!-- Error / empty state --> |
50 | | - <LinearLayout |
51 | | - android:id="@+id/switch_version_error_layout" |
52 | | - android:layout_width="0dp" |
53 | | - android:layout_height="wrap_content" |
54 | | - android:orientation="vertical" |
55 | | - android:gravity="center" |
56 | | - android:visibility="gone" |
| 39 | + <!-- Content area: progress / error / list are mutually exclusive siblings |
| 40 | + inside a single FIXED-height container. A fixed dp height (matching |
| 41 | + this codebase's existing dialog_expendable_list_view.xml pattern) is |
| 42 | + used deliberately instead of match_parent/0dp match-constraint — |
| 43 | + AlertDialog windows size themselves to wrap_content, which gives a |
| 44 | + match_parent/0dp list nothing definite to measure against and it |
| 45 | + collapses to zero height. A concrete height here sidesteps that |
| 46 | + entirely and matches how VersionSelectorDialog already solves the |
| 47 | + exact same problem elsewhere in this app. --> |
| 48 | + <FrameLayout |
| 49 | + android:id="@+id/switch_version_content" |
| 50 | + android:layout_width="match_parent" |
| 51 | + android:layout_height="@dimen/_280sdp" |
57 | 52 | android:layout_marginTop="@dimen/padding_large" |
58 | | - app:layout_constraintTop_toBottomOf="@id/switch_version_title" |
59 | | - app:layout_constraintStart_toStartOf="parent" |
60 | | - app:layout_constraintEnd_toEndOf="parent"> |
| 53 | + app:layout_constraintTop_toBottomOf="@id/switch_version_title"> |
61 | 54 |
|
62 | | - <TextView |
63 | | - android:id="@+id/switch_version_error_textview" |
| 55 | + <ProgressBar |
| 56 | + android:id="@+id/switch_version_progress" |
64 | 57 | android:layout_width="wrap_content" |
65 | 58 | android:layout_height="wrap_content" |
66 | | - android:textColor="@color/secondary_text" |
67 | | - android:textAlignment="center" |
68 | | - android:text="@string/switch_mod_version_no_versions" /> |
| 59 | + android:layout_gravity="center" /> |
69 | 60 |
|
70 | | - <Button |
71 | | - android:id="@+id/switch_version_retry_button" |
72 | | - android:layout_width="wrap_content" |
| 61 | + <LinearLayout |
| 62 | + android:id="@+id/switch_version_error_layout" |
| 63 | + android:layout_width="match_parent" |
73 | 64 | android:layout_height="wrap_content" |
74 | | - android:layout_marginTop="@dimen/padding_moderate" |
75 | | - android:text="@string/switch_mod_version_retry" /> |
| 65 | + android:layout_gravity="center" |
| 66 | + android:orientation="vertical" |
| 67 | + android:gravity="center" |
| 68 | + android:visibility="gone"> |
76 | 69 |
|
77 | | - </LinearLayout> |
| 70 | + <TextView |
| 71 | + android:id="@+id/switch_version_error_textview" |
| 72 | + android:layout_width="wrap_content" |
| 73 | + android:layout_height="wrap_content" |
| 74 | + android:textColor="@color/secondary_text" |
| 75 | + android:textAlignment="center" |
| 76 | + android:text="@string/switch_mod_version_no_versions" /> |
78 | 77 |
|
79 | | - <!-- Version list --> |
80 | | - <androidx.recyclerview.widget.RecyclerView |
81 | | - android:id="@+id/switch_version_list" |
82 | | - android:layout_width="0dp" |
83 | | - android:layout_height="0dp" |
84 | | - android:layout_marginTop="@dimen/padding_large" |
85 | | - android:clipToPadding="false" |
86 | | - app:layout_constraintTop_toBottomOf="@id/switch_version_title" |
87 | | - app:layout_constraintBottom_toTopOf="@id/switch_version_toggle_incompatible" |
88 | | - app:layout_constraintStart_toStartOf="parent" |
89 | | - app:layout_constraintEnd_toEndOf="parent" /> |
| 78 | + <Button |
| 79 | + android:id="@+id/switch_version_retry_button" |
| 80 | + android:layout_width="wrap_content" |
| 81 | + android:layout_height="wrap_content" |
| 82 | + android:layout_marginTop="@dimen/padding_moderate" |
| 83 | + android:text="@string/switch_mod_version_retry" /> |
| 84 | + |
| 85 | + </LinearLayout> |
| 86 | + |
| 87 | + <androidx.recyclerview.widget.RecyclerView |
| 88 | + android:id="@+id/switch_version_list" |
| 89 | + android:layout_width="match_parent" |
| 90 | + android:layout_height="match_parent" |
| 91 | + android:clipToPadding="false" |
| 92 | + android:visibility="gone" /> |
| 93 | + |
| 94 | + </FrameLayout> |
90 | 95 |
|
91 | 96 | <!-- Show/hide incompatible toggle --> |
92 | 97 | <TextView |
|
100 | 105 | android:textSize="@dimen/_12ssp" |
101 | 106 | android:text="@string/switch_mod_version_show_incompatible" |
102 | 107 | app:layout_constraintStart_toStartOf="parent" |
103 | | - app:layout_constraintBottom_toTopOf="@id/switch_version_warning" /> |
| 108 | + app:layout_constraintTop_toBottomOf="@id/switch_version_content" /> |
104 | 109 |
|
105 | 110 | <!-- Warning footer --> |
106 | 111 | <TextView |
|
111 | 116 | android:text="@string/switch_mod_version_warning" |
112 | 117 | android:textColor="@color/mod_version_incompatible" |
113 | 118 | android:textSize="@dimen/_10ssp" |
114 | | - app:layout_constraintBottom_toTopOf="@id/switch_version_cancel" /> |
| 119 | + app:layout_constraintTop_toBottomOf="@id/switch_version_toggle_incompatible" /> |
115 | 120 |
|
116 | 121 | <!-- Cancel button --> |
117 | 122 | <Button |
|
120 | 125 | android:layout_height="wrap_content" |
121 | 126 | android:layout_marginTop="@dimen/padding_moderate" |
122 | 127 | android:text="@android:string/cancel" |
| 128 | + app:layout_constraintTop_toBottomOf="@id/switch_version_warning" |
123 | 129 | app:layout_constraintBottom_toBottomOf="parent" |
124 | 130 | app:layout_constraintStart_toStartOf="parent" |
125 | 131 | app:layout_constraintEnd_toEndOf="parent" /> |
|
0 commit comments