'Beta' tag for themed icon toggle
Spec:
https://www.figma.com/file/f5kMYkfuvjkLr9VvXTsy2e/Silk-Sounds?node-id=2848%3A411
Screenshot:
https://screenshot.googleplex.com/8KAuyMEqBCKeE2M.png
https://screenshot.googleplex.com/9uB2puzws8tepyr.png
Bug: 192629966
Test: manual
Change-Id: I654f105d5599ddd5fde88de4516364116cbd45f9
diff --git a/res/drawable/beta_tag_background.xml b/res/drawable/beta_tag_background.xml
new file mode 100644
index 0000000..8104531
--- /dev/null
+++ b/res/drawable/beta_tag_background.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2021 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"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <size
+ android:width="@dimen/beta_tag_background_width"
+ android:height="@dimen/beta_tag_background_height" />
+ <corners android:radius="@dimen/beta_tag_background_height" />
+ <solid android:color="?androidprv:attr/colorAccentPrimary" />
+</shape>
\ No newline at end of file
diff --git a/res/layout/themed_icon_section_view.xml b/res/layout/themed_icon_section_view.xml
index 80e617d..117bc2e 100644
--- a/res/layout/themed_icon_section_view.xml
+++ b/res/layout/themed_icon_section_view.xml
@@ -16,6 +16,7 @@
-->
<com.android.customization.picker.themedicon.ThemedIconSectionView
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
@@ -25,13 +26,31 @@
android:paddingHorizontal="@dimen/section_horizontal_padding"
android:paddingVertical="@dimen/section_vertical_padding">
- <TextView
- android:id="@+id/themed_icon_title"
+ <LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="@string/themed_icon_title"
- style="@style/SectionTitleTextStyle" />
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/themed_icon_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/themed_icon_title"
+ style="@style/SectionTitleTextStyle" />
+
+ <Space
+ android:layout_width="12dp"
+ android:layout_height="0dp" />
+
+ <TextView
+ android:id="@+id/beta_tag"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/beta_title"
+ android:textColor="?androidprv:attr/textColorOnAccent"
+ style="@style/BetaTagTextStyle" />
+ </LinearLayout>
<Switch
android:id="@+id/themed_icon_toggle"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 193d6c3..2086480 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -120,4 +120,7 @@
<dimen name="theme_info_app_preview_icon_margin">2dp</dimen>
<dimen name="theme_info_app_preview_icon_elevation">2dp</dimen>
<dimen name="theme_info_text_size">28sp</dimen>
+
+ <dimen name="beta_tag_background_width">46dp</dimen>
+ <dimen name="beta_tag_background_height">24dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1c71e6c..0ea2f7e 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -241,6 +241,9 @@
<!-- Title of a section of the customization where the user can select color override for icon. [CHAR LIMIT=30] -->
<string name="themed_icon_title" msgid="4305612684940220645">Themed icons</string>
+ <!-- Title of the tag to indicate beta version. [CHAR LIMIT=6] -->
+ <string name="beta_title">Beta</string>
+
<!-- The content description of grid picker entry. [CHAR LIMIT=NONE] -->
<string name="gird_picker_entry_content_description" msgid="7538418512525897691">Change app grid</string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7762b41..c0a0aed 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -115,4 +115,12 @@
<item name="android:lineHeight">20dp</item>
</style>
+ <style name="BetaTagTextStyle" parent="SectionTitleTextStyle">
+ <item name="android:textSize">12sp</item>
+ <item name="android:lineHeight">15dp</item>
+ <item name="android:letterSpacing">0.02</item>
+ <item name="android:background">@drawable/beta_tag_background</item>
+ <item name="android:gravity">center</item>
+ </style>
+
</resources>