aboutsummaryrefslogtreecommitdiff
path: root/RotaryPlayground/res
diff options
context:
space:
mode:
authorAgatha Man <agathaman@google.com>2020-05-19 16:31:14 -0700
committerAgatha Man <agathaman@google.com>2020-06-01 19:38:36 +0000
commit55340419ca385e12794eacea70eedcb38ffc5450 (patch)
tree9a59b9fc4a5dc9d4940988b1dd306cc97dc9f6f6 /RotaryPlayground/res
parenteb8e69fe8990667bda922f0445359b99e5e39263 (diff)
downloadtests-55340419ca385e12794eacea70eedcb38ffc5450.tar.gz
Add a Scroll demo to RotaryPlayground
Bug: 154971276 Test: make and install Change-Id: Iaa884c4920b910115440ed8181b7fbd6c5ddafba
Diffstat (limited to 'RotaryPlayground/res')
-rw-r--r--RotaryPlayground/res/layout/rotary_cards.xml24
-rw-r--r--RotaryPlayground/res/layout/rotary_menu.xml6
-rw-r--r--RotaryPlayground/res/layout/rotary_scroll.xml27
-rw-r--r--RotaryPlayground/res/layout/rotary_scroll_button.xml35
-rw-r--r--RotaryPlayground/res/layout/rotary_scroll_text.xml32
-rw-r--r--RotaryPlayground/res/values/arrays.xml69
-rw-r--r--RotaryPlayground/res/values/colors.xml1
-rw-r--r--RotaryPlayground/res/values/dimens.xml3
-rw-r--r--RotaryPlayground/res/values/strings.xml3
9 files changed, 188 insertions, 12 deletions
diff --git a/RotaryPlayground/res/layout/rotary_cards.xml b/RotaryPlayground/res/layout/rotary_cards.xml
index 7fc8297..e3d9e87 100644
--- a/RotaryPlayground/res/layout/rotary_cards.xml
+++ b/RotaryPlayground/res/layout/rotary_cards.xml
@@ -60,7 +60,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
@@ -72,20 +72,20 @@
android:background="@color/button_disabled_background_color"
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:enabled="false"
android:tag="test_button"
android:text="Disabled" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
</com.android.car.ui.FocusArea>
@@ -110,28 +110,28 @@
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:enabled="false"
android:tag="test_button"
android:text="Disabled" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:enabled="false"
android:tag="test_button"
android:text="Disabled" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:enabled="false"
android:tag="test_button"
android:text="Disabled" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:enabled="false"
android:tag="test_button"
android:text="Disabled" />
@@ -157,26 +157,26 @@
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
<!-- TODO(b/154180719): Make this button the default focus in this FocusArea -->
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button (Default)" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
- android:onClick="onRotaryCardsButtonClick"
+ android:onClick="onRotaryButtonClick"
android:tag="test_button"
android:text="Button" />
</com.android.car.ui.FocusArea>
diff --git a/RotaryPlayground/res/layout/rotary_menu.xml b/RotaryPlayground/res/layout/rotary_menu.xml
index 8aa2f56..176d58c 100644
--- a/RotaryPlayground/res/layout/rotary_menu.xml
+++ b/RotaryPlayground/res/layout/rotary_menu.xml
@@ -44,4 +44,10 @@
android:layout_height="0dp"
android:layout_weight="1"
android:text="Menu Item 4" />
+ <Button
+ android:id="@+id/scroll"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:text="Scroll" />
</com.android.car.ui.FocusArea>
diff --git a/RotaryPlayground/res/layout/rotary_scroll.xml b/RotaryPlayground/res/layout/rotary_scroll.xml
new file mode 100644
index 0000000..78c90c0
--- /dev/null
+++ b/RotaryPlayground/res/layout/rotary_scroll.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.car.ui.FocusArea
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.android.car.ui.recyclerview.CarUiRecyclerView
+ android:id="@+id/rotary_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+</com.android.car.ui.FocusArea>
diff --git a/RotaryPlayground/res/layout/rotary_scroll_button.xml b/RotaryPlayground/res/layout/rotary_scroll_button.xml
new file mode 100644
index 0000000..a223aa9
--- /dev/null
+++ b/RotaryPlayground/res/layout/rotary_scroll_button.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+ <Button
+ android:layout_height="wrap_content"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:onClick="onRotaryButtonClick"
+ android:text="Button" />
+ <Button
+ android:layout_height="wrap_content"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:onClick="onRotaryButtonClick"
+ android:text="Button" />
+</LinearLayout> \ No newline at end of file
diff --git a/RotaryPlayground/res/layout/rotary_scroll_text.xml b/RotaryPlayground/res/layout/rotary_scroll_text.xml
new file mode 100644
index 0000000..d9d82f6
--- /dev/null
+++ b/RotaryPlayground/res/layout/rotary_scroll_text.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/scroll_text_view"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:background="@color/scroll_text_background_color"
+ android:layout_marginTop="@dimen/margin"
+ android:layout_marginBottom="@dimen/margin"
+ android:padding="@dimen/padding"
+ android:text="@string/lorem" />
+</LinearLayout> \ No newline at end of file
diff --git a/RotaryPlayground/res/values/arrays.xml b/RotaryPlayground/res/values/arrays.xml
new file mode 100644
index 0000000..18b0015
--- /dev/null
+++ b/RotaryPlayground/res/values/arrays.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <!-- List of greetings to display on button clicks -->
+ <string-array name="greetings" translatable="false">
+ <item>Hello!</item>
+ <item>Bonjour!</item>
+ <item>Hola!</item>
+ <item>Zdravstvuyte!</item>
+ <item>Ni Hao!</item>
+ <item>Salve!</item>
+ <item>Konnichiwa!</item>
+ <item>Guten Tag!</item>
+ <item>Ola!</item>
+ <item>Anyoung haseyo!</item>
+ <item>Asalaam alaikum!</item>
+ <item>Goddag!</item>
+ <item>Shikamoo!</item>
+ <item>Goedendag!</item>
+ <item>Yassas!</item>
+ <item>Dzien dobry!</item>
+ <item>Selamat siang!</item>
+ <item>Namaste, Namaskar!</item>
+ <item>Merhaba!</item>
+ <item>Shalom!</item>
+ </string-array>
+
+ <!-- Array used for creating items in the scroll demo. The scroll demos creates 2 types of
+ items: (1) A view with two buttons (fixed height) and (2) a textview with varying
+ height. Items here with '0' indicates the buttons item and items with value > 0 indicates
+ the text item where the integer value is the height of the textview. -->
+ <integer-array name="scroll_item_heights">
+ <item>0</item>
+ <item>60</item>
+ <item>0</item>
+ <item>60</item>
+ <item>60</item>
+ <item>0</item>
+ <item>120</item>
+ <item>0</item>
+ <item>120</item>
+ <item>120</item>
+ <item>0</item>
+ <item>180</item>
+ <item>0</item>
+ <item>180</item>
+ <item>180</item>
+ <item>0</item>
+ <item>240</item>
+ <item>0</item>
+ <item>240</item>
+ <item>240</item>
+ <item>0</item>
+ </integer-array>
+</resources> \ No newline at end of file
diff --git a/RotaryPlayground/res/values/colors.xml b/RotaryPlayground/res/values/colors.xml
index 05e030c..b49ea51 100644
--- a/RotaryPlayground/res/values/colors.xml
+++ b/RotaryPlayground/res/values/colors.xml
@@ -19,4 +19,5 @@
<color name="card_disabled_background_color">#61646b</color>
<color name="grid_item_background_color">#006666</color>
<color name="button_disabled_background_color">#61646b</color>
+ <color name="scroll_text_background_color">#61646b</color>
</resources> \ No newline at end of file
diff --git a/RotaryPlayground/res/values/dimens.xml b/RotaryPlayground/res/values/dimens.xml
index b919705..77e907f 100644
--- a/RotaryPlayground/res/values/dimens.xml
+++ b/RotaryPlayground/res/values/dimens.xml
@@ -15,6 +15,9 @@
~ limitations under the License
-->
<resources>
+ <!-- common values -->
+ <dimen name="padding">16dp</dimen>
+ <dimen name="margin">16dp</dimen>
<!-- Rotary Menu values -->
<dimen name="menu_width">200dp</dimen>
<!-- Card example values -->
diff --git a/RotaryPlayground/res/values/strings.xml b/RotaryPlayground/res/values/strings.xml
index fd38e6b..35c960a 100644
--- a/RotaryPlayground/res/values/strings.xml
+++ b/RotaryPlayground/res/values/strings.xml
@@ -30,4 +30,7 @@
<string name="card_that_wraps_around_text" translatable="false">
The focus should move clockwise when rotating clockwise and similarly for counterclockwise. Focus also wraps around the elements (H -> A clockwise and A -> H counterclockwise).
</string>
+ <string name="lorem" translatable="false">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et velit finibus, tempor ipsum vel, pellentesque lorem. Suspendisse congue urna pulvinar, congue dolor in, eleifend orci. Nam egestas sodales sapien. Integer sit amet ligula in ex commodo semper. Phasellus ac facilisis ligula. Ut mollis risus eu nunc consequat, eu molestie dolor maximus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Donec commodo lectus non est lacinia accumsan. Nulla tristique cursus iaculis. Sed in hendrerit nulla, vel faucibus mi. Aenean placerat turpis eros, non sagittis enim viverra id. Vestibulum vel rutrum est, eu consequat felis. Maecenas ac suscipit ante. Fusce dapibus ut libero blandit vehicula. Vivamus vel ipsum condimentum, maximus tellus nec, rutrum lorem.
+ </string>
</resources>