aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/res/layout/main.xml
blob: 15b1c90b52328f596bb73b5fb19d1c2ab399ef67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?xml version="1.0" encoding="utf-8"?>
<!-- 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). -->
<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:fillViewport="true"
    android:padding="@dimen/space_lg">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <!-- 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">

            <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"
                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">

            <TextView
                style="@style/SectionHeader"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/pair_a_device"/>

            <TextView
                style="@style/Caption"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pair_help"/>

            <TextView
                style="@style/FieldLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_address"/>

            <TextView
                style="@style/Caption"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/sub_address"/>

            <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:importantForAutofill="no"/>

            <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/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>

        <TextView
            style="@style/SectionHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/saved_devices"/>

        <LinearLayout
            android:id="@+id/devices"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:divider="@color/stroke"
            android:showDividers="middle"
            android:dividerPadding="0dp"/>

        <TextView
            android:id="@+id/devices_empty"
            style="@style/Note"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:paddingTop="@dimen/space_xl"
            android:text="@string/no_devices_yet"/>

    </LinearLayout>

</ScrollView>