make enter phone number screen work on small screens

Daniel Gultsch created

Change summary

src/quicksy/res/layout/activity_enter_number.xml | 152 ++++++++---------
1 file changed, 74 insertions(+), 78 deletions(-)

Detailed changes

src/quicksy/res/layout/activity_enter_number.xml 🔗

@@ -2,13 +2,13 @@
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <LinearLayout
+    <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:fitsSystemWindows="true"
-        android:orientation="vertical">
+        android:fitsSystemWindows="true">
 
         <com.google.android.material.appbar.AppBarLayout
+            android:id="@+id/app_bar_layout"
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
@@ -19,100 +19,96 @@
                 android:minHeight="?attr/actionBarSize" />
         </com.google.android.material.appbar.AppBarLayout>
 
-        <androidx.coordinatorlayout.widget.CoordinatorLayout
-            android:id="@+id/coordinator"
+
+        <ScrollView
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="wrap_content"
+            android:layout_above="@+id/next"
+            android:layout_below="@id/app_bar_layout">
 
-            <ScrollView
+            <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:fillViewport="true">
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
 
-                <RelativeLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                <TextView
+                    android:id="@+id/instructions"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="16dp"
+                    android:gravity="center_horizontal"
+                    android:text="@string/enter_country_code_and_phone_number"
+                    android:textAppearance="?textAppearanceBodyMedium" />
 
-                    <TextView
-                        android:id="@+id/instructions"
-                        android:layout_width="wrap_content"
+                <LinearLayout
+                    android:id="@+id/phone_number_box"
+                    android:layout_width="256dp"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:orientation="vertical">
+
+                    <EditText
+                        android:id="@+id/country"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_margin="16dp"
-                        android:gravity="center_horizontal"
-                        android:text="@string/enter_country_code_and_phone_number"
-                        android:textAppearance="?textAppearanceBodyMedium" />
+                        android:cursorVisible="false"
+                        android:drawableEnd="@drawable/ic_arrow_drop_down_18dp"
+                        android:focusable="false"
+                        android:gravity="bottom|center_horizontal"
+                        android:imeOptions="flagNoExtractUi"
+                        android:inputType="textNoSuggestions"
+                        android:longClickable="false"
+                        app:drawableTint="?android:attr/textColorPrimary" />
 
                     <LinearLayout
-                        android:id="@+id/phone_number_box"
-                        android:layout_width="256dp"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_above="@+id/next"
-                        android:layout_below="@+id/instructions"
-                        android:layout_centerHorizontal="true"
-                        android:orientation="vertical">
+                        android:orientation="horizontal">
 
                         <EditText
-                            android:id="@+id/country"
-                            android:layout_width="match_parent"
+                            android:id="@+id/country_code"
+                            android:layout_width="0dp"
                             android:layout_height="wrap_content"
-                            android:cursorVisible="false"
-                            android:drawableEnd="@drawable/ic_arrow_drop_down_18dp"
-                            android:focusable="false"
+                            android:layout_weight="1"
                             android:gravity="bottom|center_horizontal"
                             android:imeOptions="flagNoExtractUi"
-                            android:inputType="textNoSuggestions"
+                            android:inputType="number"
                             android:longClickable="false"
-                            app:drawableTint="?android:attr/textColorPrimary" />
-
-                        <LinearLayout
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:orientation="horizontal">
-
-                            <EditText
-                                android:id="@+id/country_code"
-                                android:layout_width="0dp"
-                                android:layout_height="wrap_content"
-                                android:layout_weight="1"
-                                android:gravity="bottom|center_horizontal"
-                                android:imeOptions="flagNoExtractUi"
-                                android:inputType="number"
-                                android:longClickable="false"
-                                android:maxLength="3"
-                                android:maxLines="1" />
+                            android:maxLength="3"
+                            android:maxLines="1" />
 
-                            <EditText
-                                android:id="@+id/number"
-                                android:layout_width="0dp"
-                                android:layout_height="wrap_content"
-                                android:layout_weight="3"
-                                android:gravity="bottom|start"
-                                android:hint="@string/phone_number"
-                                android:imeOptions="flagNoExtractUi"
-                                android:inputType="number"
-                                android:longClickable="false"
-                                android:maxLines="1" />
-                        </LinearLayout>
-
-                        <ProgressBar
-                            android:id="@+id/progressBar"
-                            style="?android:attr/progressBarStyle"
-                            android:layout_width="wrap_content"
+                        <EditText
+                            android:id="@+id/number"
+                            android:layout_width="0dp"
                             android:layout_height="wrap_content"
-                            android:layout_gravity="center" />
+                            android:layout_weight="3"
+                            android:gravity="bottom|start"
+                            android:hint="@string/phone_number"
+                            android:imeOptions="flagNoExtractUi"
+                            android:inputType="number"
+                            android:longClickable="false"
+                            android:maxLines="1" />
                     </LinearLayout>
 
-                    <Button
-                        android:id="@+id/next"
-                        style="@style/Widget.Material3.Button.ElevatedButton"
+                    <ProgressBar
+                        android:layout_margin="16dp"
+                        android:id="@+id/progressBar"
+                        style="?android:attr/progressBarStyle"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_alignParentEnd="true"
-                        android:layout_alignParentBottom="true"
-                        android:layout_margin="16dp"
-                        android:text="@string/next" />
-                </RelativeLayout>
-            </ScrollView>
-        </androidx.coordinatorlayout.widget.CoordinatorLayout>
-    </LinearLayout>
+                        android:layout_gravity="center" />
+                </LinearLayout>
+            </LinearLayout>
+        </ScrollView>
+
+        <Button
+            android:id="@+id/next"
+            style="@style/Widget.Material3.Button.ElevatedButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentBottom="true"
+            android:layout_margin="16dp"
+            android:text="@string/next" />
+    </RelativeLayout>
 </layout>