• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2020 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License.
16  -->
17<LinearLayout
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:app="http://schemas.android.com/apk/res-auto"
20    android:layout_width="match_parent"
21    android:layout_height="match_parent">
22
23    <LinearLayout
24        android:layout_width="0dp"
25        android:layout_height="match_parent"
26        android:layout_weight="1"
27        android:orientation="vertical">
28
29        <com.android.car.ui.FocusArea
30            android:id="@+id/top_left"
31            android:layout_width="match_parent"
32            android:layout_height="0dp"
33            android:layout_weight="1"
34            android:layout_margin="@dimen/margin"
35            android:gravity="center"
36            android:orientation="vertical"
37            android:background="@color/card_background_color"
38            app:wrapAround="true">
39            <TextView
40                android:layout_width="wrap_content"
41                android:layout_height="wrap_content"
42                android:text="Wrap-around enabled"/>
43            <Button
44                android:layout_width="wrap_content"
45                android:layout_height="@dimen/button_height"
46                android:paddingHorizontal="@dimen/padding"
47                android:text="Button"/>
48            <Button
49                android:layout_width="wrap_content"
50                android:layout_height="@dimen/button_height"
51                android:paddingHorizontal="@dimen/padding"
52                android:focusedByDefault="true"
53                android:text="android:focusedByDefault"/>
54            <Button
55                android:layout_width="wrap_content"
56                android:layout_height="@dimen/button_height"
57                android:paddingHorizontal="@dimen/padding"
58                android:text="Button"/>
59        </com.android.car.ui.FocusArea>
60
61        <com.android.car.ui.FocusArea
62            android:layout_width="match_parent"
63            android:layout_height="0dp"
64            android:layout_weight="1"
65            android:layout_margin="@dimen/margin"
66            android:gravity="center"
67            android:orientation="vertical"
68            android:background="@color/card_background_color"
69            app:defaultFocus="@+id/default_focus">
70            <Button
71                android:layout_width="wrap_content"
72                android:layout_height="@dimen/button_height"
73                android:paddingHorizontal="@dimen/padding"
74                android:text="Button"/>
75            <Button
76                android:layout_width="wrap_content"
77                android:layout_height="@dimen/button_height"
78                android:paddingHorizontal="@dimen/padding"
79                android:focusedByDefault="true"
80                android:text="android:focusedByDefault"/>
81            <Button
82                android:id="@+id/default_focus"
83                android:layout_width="wrap_content"
84                android:layout_height="@dimen/button_height"
85                android:paddingHorizontal="@dimen/padding"
86                android:text="app:defaultFocus"/>
87        </com.android.car.ui.FocusArea>
88
89    </LinearLayout>
90
91    <LinearLayout
92        android:layout_width="0dp"
93        android:layout_height="match_parent"
94        android:layout_weight="1"
95        android:orientation="vertical">
96
97        <com.android.car.ui.FocusArea
98            android:layout_width="match_parent"
99            android:layout_height="0dp"
100            android:layout_weight="1"
101            android:layout_margin="@dimen/margin"
102            android:gravity="center"
103            android:orientation="vertical"
104            android:background="@color/card_background_color"
105            app:defaultFocus="@+id/default_focus2">
106            <Button
107                android:layout_width="wrap_content"
108                android:layout_height="@dimen/button_height"
109                android:paddingHorizontal="@dimen/padding"
110                android:text="Button"/>
111            <Button
112                android:id="@+id/default_focus2"
113                android:layout_width="wrap_content"
114                android:layout_height="@dimen/button_height"
115                android:paddingHorizontal="@dimen/padding"
116                android:text="app:defaultFocus"/>
117            <Button
118                android:layout_width="wrap_content"
119                android:layout_height="@dimen/button_height"
120                android:paddingHorizontal="@dimen/padding"
121                android:text="Button"/>
122        </com.android.car.ui.FocusArea>
123
124        <com.android.car.ui.FocusArea
125            android:layout_width="match_parent"
126            android:layout_height="0dp"
127            android:layout_weight="1"
128            android:layout_margin="@dimen/margin"
129            android:gravity="center"
130            android:orientation="vertical"
131            android:background="@color/card_background_color"
132            app:nudgeLeft="@+id/top_left">
133            <TextView
134                android:layout_width="wrap_content"
135                android:layout_height="wrap_content"
136                android:text="Nudging to left goes to top left"/>
137            <Button
138                android:layout_width="wrap_content"
139                android:layout_height="@dimen/button_height"
140                android:paddingHorizontal="@dimen/padding"
141                android:text="Button"/>
142            <Button
143                android:layout_width="wrap_content"
144                android:layout_height="@dimen/button_height"
145                android:paddingHorizontal="@dimen/padding"
146                android:text="Button"/>
147            <Button
148                android:layout_width="wrap_content"
149                android:layout_height="@dimen/button_height"
150                android:paddingHorizontal="@dimen/padding"
151                android:text="Button"/>
152        </com.android.car.ui.FocusArea>
153
154    </LinearLayout>
155
156    <LinearLayout
157        android:layout_width="0dp"
158        android:layout_height="match_parent"
159        android:layout_weight="1"
160        android:orientation="vertical">
161
162        <com.android.car.ui.FocusArea
163            android:layout_width="match_parent"
164            android:layout_height="0dp"
165            android:layout_weight="1"
166            android:layout_margin="@dimen/margin"
167            android:gravity="center"
168            android:orientation="vertical"
169            android:background="@color/card_background_color"
170            app:nudgeUpShortcut="@+id/nudge_shortcut">
171            <TextView
172                android:layout_width="wrap_content"
173                android:layout_height="wrap_content"
174                android:text="Nudging up goes to the first Button"/>
175            <Button
176                android:id="@+id/nudge_shortcut"
177                android:layout_width="wrap_content"
178                android:layout_height="@dimen/button_height"
179                android:paddingHorizontal="@dimen/padding"
180                android:text="Button"/>
181            <Button
182                android:layout_width="wrap_content"
183                android:layout_height="@dimen/button_height"
184                android:paddingHorizontal="@dimen/padding"
185                android:text="Button"/>
186            <Button
187                android:layout_width="wrap_content"
188                android:layout_height="@dimen/button_height"
189                android:paddingHorizontal="@dimen/padding"
190                android:text="Button"/>
191        </com.android.car.ui.FocusArea>
192
193        <com.android.car.ui.FocusArea
194            android:layout_width="match_parent"
195            android:layout_height="0dp"
196            android:layout_weight="1"
197            android:layout_margin="@dimen/margin"
198            android:gravity="center"
199            android:orientation="vertical"
200            android:background="@color/card_disabled_background_color">
201            <Button
202                android:layout_width="wrap_content"
203                android:layout_height="@dimen/button_height"
204                android:paddingHorizontal="@dimen/padding"
205                android:focusable="false"
206                android:text="non-focusable Button"/>
207            <Button
208                android:layout_width="wrap_content"
209                android:layout_height="@dimen/button_height"
210                android:paddingHorizontal="@dimen/padding"
211                android:enabled="false"
212                android:text="disabled Button"/>
213        </com.android.car.ui.FocusArea>
214
215    </LinearLayout>
216
217</LinearLayout>
218