diff options
Diffstat (limited to 'app/src/main/res/layout/main.xml')
| -rw-r--r-- | app/src/main/res/layout/main.xml | 264 |
1 files changed, 140 insertions, 124 deletions
diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml index 0b1273b..15b1c90 100644 --- a/app/src/main/res/layout/main.xml +++ b/app/src/main/res/layout/main.xml @@ -1,161 +1,177 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Root padding is the base; Ui.padForInsets() adds the system bar and +<!-- One scroll for the whole page. The saved-device rows are built into + the LinearLayout below rather than a ListView, because a ListView + inside a ScrollView cannot measure itself and splitting the screen + into two independently scrolling halves left one of them unusable at + some sizes. The list is a handful of rows; it does not need + recycling. + + Root padding is the base; Ui.padForInsets() adds the system bar and IME insets to it at runtime (the window is edge-to-edge). --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" + android:fillViewport="true" android:padding="@dimen/space_lg"> - <!-- Header: app glyph + name, Settings on the right. --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center_vertical" - android:layout_marginBottom="@dimen/space_lg"> + android:orientation="vertical"> - <ImageView - android:layout_width="40dp" - android:layout_height="40dp" - android:src="@drawable/ic_launcher_foreground" - android:scaleType="fitCenter" - android:contentDescription="@null"/> - - <TextView - android:layout_width="0dp" + <!-- Header: app glyph + name, Settings on the right. --> + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginStart="@dimen/space_sm" - android:text="@string/app_name" - android:textColor="@color/on_surface" - android:textSize="22sp" - android:textStyle="bold"/> - - <ImageButton - android:id="@+id/settings" - android:layout_width="48dp" - android:layout_height="48dp" - android:src="@drawable/ic_settings" - android:scaleType="centerInside" - android:background="?android:attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/settings"/> - - </LinearLayout> - - <!-- Pairing form. Each field is one value the target already prints, - copied verbatim: the Wireless debugging screen shows the device - address as a single "ip:port" string, and the pairing dialog adds - its own port plus the code. --> - <LinearLayout - style="@style/Card" - android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="@dimen/space_lg"> - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/pair_a_device"/> + <ImageView + android:layout_width="40dp" + android:layout_height="40dp" + android:src="@drawable/ic_launcher_foreground" + android:scaleType="fitCenter" + android:contentDescription="@null"/> - <TextView - style="@style/Caption" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/pair_help"/> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginStart="@dimen/space_sm" + android:text="@string/app_name" + android:textColor="@color/on_surface" + android:textSize="22sp" + android:textStyle="bold"/> + + <ImageButton + android:id="@+id/settings" + android:layout_width="48dp" + android:layout_height="48dp" + android:src="@drawable/ic_settings" + android:scaleType="centerInside" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/settings"/> - <TextView - style="@style/FieldLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_address"/> + </LinearLayout> - <TextView - style="@style/Caption" + <!-- Pairing form. Each field is one value the target already + prints, copied verbatim: the Wireless debugging screen shows + the device address as a single "ip:port" string, and the + pairing dialog adds its own port plus the code. --> + <LinearLayout + style="@style/Card" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/sub_address"/> + android:layout_height="wrap_content"> - <EditText - android:id="@+id/device_address" - style="@style/Field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/space_xs" - android:hint="@string/address_hint" - android:inputType="textUri" - android:autofillHints="postalAddress"/> + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/pair_a_device"/> - <TextView - style="@style/FieldLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_pairing"/> + <TextView + style="@style/Caption" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/pair_help"/> - <TextView - style="@style/Caption" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/sub_pairing"/> + <TextView + style="@style/FieldLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/label_address"/> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:layout_marginTop="@dimen/space_xs"> + <TextView + style="@style/Caption" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/sub_address"/> <EditText - android:id="@+id/pair_port" + android:id="@+id/device_address" style="@style/Field" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginEnd="@dimen/space_sm" - android:hint="@string/pair_port_hint" - android:inputType="number" - android:autofillHints="off"/> + android:layout_marginTop="@dimen/space_xs" + android:hint="@string/address_hint" + android:inputType="textUri" + android:importantForAutofill="no"/> + + <TextView + style="@style/FieldLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/label_pairing"/> - <EditText - android:id="@+id/pair_code" - style="@style/Field" - android:layout_width="0dp" + <TextView + style="@style/Caption" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:hint="@string/pair_code_hint" - android:inputType="numberPassword" - android:maxLength="6" - android:autofillHints="off"/> + android:text="@string/sub_pairing"/> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginTop="@dimen/space_xs"> + + <EditText + android:id="@+id/pair_port" + style="@style/Field" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginEnd="@dimen/space_sm" + android:hint="@string/pair_port_hint" + android:inputType="number" + android:importantForAutofill="no"/> + + <EditText + android:id="@+id/pair_code" + style="@style/Field" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:hint="@string/pair_code_hint" + android:inputType="numberPassword" + android:maxLength="6" + android:importantForAutofill="no"/> + + </LinearLayout> + + <TextView + style="@style/Caption" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/space_md" + android:text="@string/network_trust"/> + + <Button + android:id="@+id/pair" + style="@style/Button.Primary" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/space_lg" + android:text="@string/pair_and_save"/> </LinearLayout> - <Button - android:id="@+id/pair" - style="@style/Button.Primary" + <TextView + style="@style/SectionHeader" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/space_lg" - android:text="@string/pair_and_save"/> - - </LinearLayout> + android:text="@string/saved_devices"/> - <TextView - style="@style/SectionHeader" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/saved_devices"/> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"> - - <ListView + <LinearLayout android:id="@+id/devices" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" android:divider="@color/stroke" - android:dividerHeight="1dp"/> + android:showDividers="middle" + android:dividerPadding="0dp"/> <TextView android:id="@+id/devices_empty" @@ -166,6 +182,6 @@ android:paddingTop="@dimen/space_xl" android:text="@string/no_devices_yet"/> - </FrameLayout> + </LinearLayout> -</LinearLayout> +</ScrollView> |