aboutsummaryrefslogtreecommitdiff
path: root/RotaryPlayground/res
diff options
context:
space:
mode:
authorDanny Epstein <depstein@google.com>2020-07-18 12:17:50 -0700
committerDanny Epstein <depstein@google.com>2020-07-18 12:17:50 -0700
commitfcf79e37ad837cdf2c99bf785d0154e66a302e7f (patch)
treecffcb4541e95c970bb801c0e38fd5d84ec258fc9 /RotaryPlayground/res
parent41af77ce3fcd704f6738f8edf9ffc1de3a7be4d4 (diff)
downloadtests-fcf79e37ad837cdf2c99bf785d0154e66a302e7f.tar.gz
Improve tabs in reference app.
For now, don't switch tabs on focus. Select the button for the active tab and visually indicate the selected button. Bug: 157241844 Test: manual Change-Id: I3f99b9a9a2a8c48d33e7852a75b4ecf3483280ba
Diffstat (limited to 'RotaryPlayground/res')
-rw-r--r--RotaryPlayground/res/drawable/selected_tab.xml25
-rw-r--r--RotaryPlayground/res/drawable/tab.xml20
-rw-r--r--RotaryPlayground/res/layout/rotary_menu.xml18
-rw-r--r--RotaryPlayground/res/values/colors.xml1
-rw-r--r--RotaryPlayground/res/values/styles.xml21
5 files changed, 79 insertions, 6 deletions
diff --git a/RotaryPlayground/res/drawable/selected_tab.xml b/RotaryPlayground/res/drawable/selected_tab.xml
new file mode 100644
index 0000000..9b694f7
--- /dev/null
+++ b/RotaryPlayground/res/drawable/selected_tab.xml
@@ -0,0 +1,25 @@
+<?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.
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <gradient
+ android:angle="0"
+ android:startColor="@color/tab_color"
+ android:centerColor="@android:color/transparent"
+ android:centerX="0.08" />
+</shape>
diff --git a/RotaryPlayground/res/drawable/tab.xml b/RotaryPlayground/res/drawable/tab.xml
new file mode 100644
index 0000000..b943ad5
--- /dev/null
+++ b/RotaryPlayground/res/drawable/tab.xml
@@ -0,0 +1,20 @@
+<?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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/selected_tab" />
+</selector>
diff --git a/RotaryPlayground/res/layout/rotary_menu.xml b/RotaryPlayground/res/layout/rotary_menu.xml
index df3ec19..38a0b8d 100644
--- a/RotaryPlayground/res/layout/rotary_menu.xml
+++ b/RotaryPlayground/res/layout/rotary_menu.xml
@@ -25,35 +25,41 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Cards" />
+ android:text="Cards"
+ style="@style/tab" />
<Button
android:id="@+id/direct_manipulation"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Direct Manipulation" />
+ android:text="Direct Manipulation"
+ style="@style/tab" />
<Button
android:id="@+id/sys_ui_direct_manipulation"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Sys UI Manipulation" />
+ android:text="Sys UI Manipulation"
+ style="@style/tab" />
<Button
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Grid" />
+ android:text="Grid"
+ style="@style/tab" />
<Button
android:id="@+id/notification"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Notification" />
+ android:text="Notification"
+ style="@style/tab" />
<Button
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:text="Scroll" />
+ android:text="Scroll"
+ style="@style/tab" />
</com.android.car.ui.FocusArea>
diff --git a/RotaryPlayground/res/values/colors.xml b/RotaryPlayground/res/values/colors.xml
index 87480a0..ca3e4c6 100644
--- a/RotaryPlayground/res/values/colors.xml
+++ b/RotaryPlayground/res/values/colors.xml
@@ -21,4 +21,5 @@
<color name="button_background_color">#660000</color>
<color name="button_disabled_background_color">#61646b</color>
<color name="scroll_text_background_color">#61646b</color>
+ <color name="tab_color">#808080</color>
</resources> \ No newline at end of file
diff --git a/RotaryPlayground/res/values/styles.xml b/RotaryPlayground/res/values/styles.xml
new file mode 100644
index 0000000..f195f5c
--- /dev/null
+++ b/RotaryPlayground/res/values/styles.xml
@@ -0,0 +1,21 @@
+<?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>
+ <style name="tab" parent="ButtonStyle">
+ <item name="android:background">@drawable/tab</item>
+ </style>
+</resources>