Merge "Use system resources for loading default icon pack" into ub-launcher3-qt-dev
diff --git a/res/drawable/option_border.xml b/res/drawable/option_border.xml
index 00c8613..6ce76c7 100644
--- a/res/drawable/option_border.xml
+++ b/res/drawable/option_border.xml
@@ -21,10 +21,5 @@
<corners android:radius="4dp" />
</shape>
</item>
- <item>
- <shape android:shape="rectangle">
- <stroke android:color="@color/option_border_color" android:width="@dimen/option_border_width" />
- <corners android:radius="4dp" />
- </shape>
- </item>
+ <item android:drawable="@drawable/option_border_edge" />
</ripple>
diff --git a/res/drawable/option_border_edge.xml b/res/drawable/option_border_edge.xml
new file mode 100644
index 0000000..943920e
--- /dev/null
+++ b/res/drawable/option_border_edge.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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_activated="true">
+ <shape android:shape="rectangle">
+ <stroke
+ android:color="@color/option_border_color"
+ android:width="@dimen/option_selected_border_width" />
+ <corners android:radius="4dp" />
+ </shape>
+ </item>
+ <item android:state_activated="false">
+ <shape android:shape="rectangle">
+ <stroke
+ android:color="@color/option_border_color"
+ android:width="@dimen/option_border_width" />
+ <corners android:radius="4dp" />
+ </shape>
+ </item>
+</selector>
diff --git a/res/layout-land/activity_custom_theme.xml b/res/layout-land/activity_custom_theme.xml
new file mode 100644
index 0000000..59296df
--- /dev/null
+++ b/res/layout-land/activity_custom_theme.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.android.customization.picker.theme.CustomThemeActivity">
+
+ <FrameLayout
+ android:id="@+id/fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:orientation="horizontal">
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:layout_gravity="bottom"/>
+
+ <FrameLayout
+ android:id="@+id/custom_theme_nav"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/custom_theme_nav_height"
+ android:layout_weight="1"
+ android:paddingHorizontal="12dp">
+ <Button
+ android:id="@+id/previous_button"
+ style="@style/ActionSecondaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="start|center_vertical"
+ android:text="@string/custom_theme_previous"/>
+ <Button
+ android:id="@+id/next_button"
+ style="@style/ActionPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end|center_vertical"
+ android:text="@string/custom_theme_next"/>
+ </FrameLayout>
+ </LinearLayout>
+
+</FrameLayout>
diff --git a/res/layout-land/fragment_custom_theme_component.xml b/res/layout-land/fragment_custom_theme_component.xml
index 1ac9f3e..cc834e3 100644
--- a/res/layout-land/fragment_custom_theme_component.xml
+++ b/res/layout-land/fragment_custom_theme_component.xml
@@ -32,23 +32,27 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
- android:background="@color/secondary_color">
+ android:background="?android:colorPrimary">
<include
- android:id="@+id/component_preview_card"
+ android:id="@+id/component_preview_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/preview_page_horizontal_margin"
android:layout_marginTop="@dimen/preview_page_top_margin"
android:layout_marginBottom="@dimen/component_preview_page_bottom_margin"
- layout="@layout/theme_preview_card"/>
+ layout="@layout/theme_component_preview"/>
</FrameLayout>
-
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="@color/divider_color"/>
<LinearLayout
android:id="@+id/options_section"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
- android:paddingVertical="10dp"
+ android:paddingTop="10dp"
+ android:paddingBottom="@dimen/custom_theme_nav_height"
android:orientation="vertical">
<TextView
diff --git a/res/layout-land/fragment_theme_picker.xml b/res/layout-land/fragment_theme_picker.xml
index 5caf7b3..267ef0d 100644
--- a/res/layout-land/fragment_theme_picker.xml
+++ b/res/layout-land/fragment_theme_picker.xml
@@ -58,6 +58,8 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
+ android:layout_toStartOf="@+id/apply_button"
+ android:ellipsize="end"
android:paddingLeft="4dp"
android:minHeight="@dimen/min_taptarget_height"
android:text="@string/keep_my_wallpaper"/>
diff --git a/res/layout/fragment_custom_theme_component.xml b/res/layout/fragment_custom_theme_component.xml
index c407724..e9dd927 100644
--- a/res/layout/fragment_custom_theme_component.xml
+++ b/res/layout/fragment_custom_theme_component.xml
@@ -27,22 +27,26 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:background="@color/secondary_color">
+ android:background="?android:colorPrimary">
<include
- android:id="@+id/component_preview_card"
+ android:id="@+id/component_preview_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/preview_page_horizontal_margin"
android:layout_marginTop="@dimen/preview_page_top_margin"
android:layout_marginBottom="@dimen/component_preview_page_bottom_margin"
- layout="@layout/theme_preview_card"/>
+ layout="@layout/theme_component_preview"/>
</FrameLayout>
-
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@color/divider_color"/>
<LinearLayout
android:id="@+id/options_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp"
+ android:clipToPadding="false"
android:orientation="vertical">
<TextView
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index dddd060..2cfac1d 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -52,6 +52,8 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
+ android:layout_toStartOf="@+id/apply_button"
+ android:ellipsize="end"
android:paddingLeft="4dp"
android:minHeight="@dimen/min_taptarget_height"
android:text="@string/keep_my_wallpaper"/>
diff --git a/res/layout/theme_component_preview.xml b/res/layout/theme_component_preview.xml
new file mode 100644
index 0000000..a087c0d
--- /dev/null
+++ b/res/layout/theme_component_preview.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<FrameLayout
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/theme_preview_card_background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:focusable="true" tools:showIn="@layout/theme_preview_card">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingHorizontal="@dimen/preview_card_padding"
+ android:paddingTop="@dimen/preview_card_padding"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent">
+
+ <ViewStub
+ android:id="@+id/theme_preview_top_bar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout="@layout/theme_preview_topbar"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
+ <TextView
+ android:id="@+id/theme_preview_card_header"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginVertical="@dimen/card_header_top_margin"
+ android:drawablePadding="12dp"
+ android:textAppearance="@style/CardTitleTextAppearance"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_top_bar"
+ app:layout_goneMarginTop="@dimen/card_header_top_margin"/>
+
+ <Space
+ android:id="@+id/theme_preview_content_spacer"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_max="48dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_card_header"/>
+
+ <FrameLayout
+ android:id="@+id/theme_preview_card_body_container"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginHorizontal="8dp"
+ android:layout_marginTop="@dimen/preview_theme_content_margin"
+ app:layout_constraintBottom_toTopOf="@+id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_max="@dimen/preview_theme_content_max_height"
+ app:layout_constraintHeight_min="@dimen/preview_theme_content_min_height"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_content_spacer">
+
+ </FrameLayout>
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_end="40dp"
+ />
+
+ <TextView
+ android:id="@+id/edit_label"
+ style="@style/EditLabelStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:drawableStart="@drawable/ic_tune"
+ android:drawablePadding="8dp"
+ android:gravity="center"
+ android:text="@string/edit_custom_theme_lbl"
+ android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_card_body_container"
+ app:layout_constraintVertical_bias="0.5"/>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/theme_preview_card.xml b/res/layout/theme_preview_card.xml
index 451ee7c..f80e846 100644
--- a/res/layout/theme_preview_card.xml
+++ b/res/layout/theme_preview_card.xml
@@ -23,95 +23,5 @@
android:layout_height="match_parent"
app:contentPadding="0dp">
- <FrameLayout
- android:id="@+id/theme_preview_card_background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="true">
-
- <androidx.constraintlayout.widget.ConstraintLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingHorizontal="@dimen/preview_card_padding"
- android:paddingTop="@dimen/preview_card_padding"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toStartOf="parent">
-
- <ViewStub
- android:id="@+id/theme_preview_top_bar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout="@layout/theme_preview_topbar"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"/>
-
- <TextView
- android:id="@+id/theme_preview_card_header"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginVertical="@dimen/card_header_top_margin"
- android:drawablePadding="12dp"
- android:textAppearance="@style/CardTitleTextAppearance"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/theme_preview_top_bar"
- app:layout_goneMarginTop="@dimen/card_header_top_margin"/>
-
- <Space
- android:id="@+id/theme_preview_content_spacer"
- android:layout_width="0dp"
- android:layout_height="0dp"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHeight_max="48dp"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/theme_preview_card_header"/>
-
- <FrameLayout
- android:id="@+id/theme_preview_card_body_container"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_marginHorizontal="8dp"
- android:layout_marginTop="@dimen/preview_theme_content_margin"
- app:layout_constraintBottom_toTopOf="@+id/guideline"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHeight_max="@dimen/preview_theme_content_max_height"
- app:layout_constraintHeight_min="@dimen/preview_theme_content_min_height"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/theme_preview_content_spacer">
-
- </FrameLayout>
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideline"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_end="40dp"
- />
-
- <TextView
- android:id="@+id/edit_label"
- style="@style/EditLabelStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:drawableStart="@drawable/ic_tune"
- android:drawablePadding="8dp"
- android:gravity="center"
- android:text="@string/edit_custom_theme_lbl"
- android:visibility="invisible"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/theme_preview_card_body_container"
- app:layout_constraintVertical_bias="0.5"/>
-
- </androidx.constraintlayout.widget.ConstraintLayout>
- </FrameLayout>
+ <include layout="@layout/theme_component_preview"/>
</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index c5e81b2..1ddfc10 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -36,4 +36,6 @@
<color name="toolbar_icon_color">@color/text_color_light</color>
<color name="toolbar_color">#000000</color>
+
+ <color name="divider_color">@color/white_14_alpha</color>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d45a4d7..ad4c1d2 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -16,6 +16,8 @@
limitations under the License.
-->
<resources>
+ <color name="black_14_alpha">#24000000</color>
+ <color name="white_14_alpha">#24FFFFFF</color>
<color name="google_grey700">#5f6368</color>
<color name="status_bar_color">#ffffffff</color>
@@ -53,4 +55,6 @@
<color name="toolbar_icon_color">@color/text_color_dark</color>
<color name="toolbar_color">@color/material_white_100</color>
+
+ <color name="divider_color">@color/black_14_alpha</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6ccf9bf..16f8964 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -88,6 +88,7 @@
<dimen name="component_shape_thumb_size">72dp</dimen>
<dimen name="option_border_width">2dp</dimen>
+ <dimen name="option_selected_border_width">3dp</dimen>
<!-- For a corner radius of this size or larger, we'll preview a rounded qsb widget. -->
<dimen name="roundCornerThreshold">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cae42ce..319aa0a 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -60,6 +60,12 @@
<!-- Content description indicating that the selected option is currently applied to the device. [CHAR_LIMIT=NONE] -->
<string name="option_applied_description"><xliff:g name="style_name">%1$s</xliff:g>, currently applied</string>
+ <!-- Content description indicating that the selected option is currently applied and previewed. [CHAR_LIMIT=NONE] -->
+ <string name="option_applied_previewed_description"><xliff:g name="style_name">%1$s</xliff:g>, currently applied and previewed</string>
+
+ <!-- Content description indicating that the selected option is currently being previewed. [CHAR_LIMIT=NONE] -->
+ <string name="option_previewed_description"><xliff:g name="style_name">%1$s</xliff:g>, currently previewed</string>
+
<!-- Sample text used to show a preview of a selected font [CHAR LIMIT=3] -->
<string name="theme_font_example">ABC</string>
@@ -138,7 +144,7 @@
<!-- Title of a set of icons that the user can chose for their custom style (eg, "Icons 2") -->
<string name="icon_component_label">Icons <xliff:g name="component_number" example="1">%1$d</xliff:g></string>
- <string name="font_component_option_thumbnail" translatable="false">A</string>
+ <string name="font_component_option_thumbnail" translatable="false">Aa</string>
<!-- Dialog box asking the user to confirm if they want to delete the current custom style
[CHAR_LIMIT=NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5009155..345a3ee 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -21,7 +21,7 @@
<item name="android:statusBarColor">?android:colorPrimary</item>
<item name="android:navigationBarColor">?android:colorPrimaryDark</item>
- <item name="android:navigationBarDividerColor">@color/system_navigation_bar_divider</item>
+ <item name="android:navigationBarDividerColor">@android:color/transparent</item>
<item name="selectableItemBackground">?android:attr/selectableItemBackground</item>
<item name="dialogPreferredPadding">24dp</item>
diff --git a/robolectric_tests/src/com/android/customization/model/theme/ThemeManagerTest.java b/robolectric_tests/src/com/android/customization/model/theme/ThemeManagerTest.java
index 24bf4ab..0a17b5b 100644
--- a/robolectric_tests/src/com/android/customization/model/theme/ThemeManagerTest.java
+++ b/robolectric_tests/src/com/android/customization/model/theme/ThemeManagerTest.java
@@ -95,7 +95,7 @@
OVERLAY_CATEGORY_ICON_SETTINGS, true, 0);
mMockOmHelper.addOverlay("test.package.name_sysui", SYSUI_PACKAGE,
OVERLAY_CATEGORY_ICON_SYSUI, true, 0);
- mMockOmHelper.addOverlay("test.package.name_themepicker", ,
+ mMockOmHelper.addOverlay("test.package.name_themepicker", mActivity.getPackageName(),
OVERLAY_CATEGORY_ICON_SYSUI, true, 0);
ThemeBundle defaultTheme = new ThemeBundle.Builder().asDefault().build(mActivity);
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index d148746..fa45931 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -24,7 +24,6 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
-import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
@@ -121,7 +120,7 @@
@Override
public void bindPreview(ViewGroup container) {
TextView header = container.findViewById(R.id.theme_preview_card_header);
- header.setText(mLabel);
+ header.setText(R.string.preview_name_font);
header.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_font, 0, 0);
ViewGroup cardBody = container.findViewById(R.id.theme_preview_card_body_container);
diff --git a/src/com/android/customization/picker/theme/CustomThemeComponentFragment.java b/src/com/android/customization/picker/theme/CustomThemeComponentFragment.java
index 0cc8e08..a50051b 100644
--- a/src/com/android/customization/picker/theme/CustomThemeComponentFragment.java
+++ b/src/com/android/customization/picker/theme/CustomThemeComponentFragment.java
@@ -17,7 +17,6 @@
import android.app.AlertDialog;
import android.content.Context;
-import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -29,7 +28,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
-import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.android.customization.model.theme.custom.CustomThemeManager;
@@ -80,7 +78,7 @@
private RecyclerView mOptionsContainer;
private OptionSelectorController<ThemeComponentOption> mOptionsController;
- private CardView mPreviewCard;
+ private ViewGroup mPreviewContainer;
private TextView mTitle;
private ThemeComponentOption mSelectedOption;
@@ -121,7 +119,7 @@
mToolbar.setNavigationContentDescription(R.string.cancel);
mToolbar.setNavigationOnClickListener(v -> mHost.cancel());
mOptionsContainer = view.findViewById(R.id.options_container);
- mPreviewCard = view.findViewById(R.id.component_preview_card);
+ mPreviewContainer = view.findViewById(R.id.component_preview_content);
mTitle = view.findViewById(R.id.component_options_title);
mTitle.setText(mTitleResId);
setUpOptions();
@@ -155,7 +153,7 @@
}
private void bindPreview() {
- mSelectedOption.bindPreview(mPreviewCard);
+ mSelectedOption.bindPreview(mPreviewContainer);
}
private void setUpOptions() {
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 5e4a30a..9725995 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -122,6 +122,28 @@
RecyclerView.ViewHolder holder = mContainer.findViewHolderForAdapterPosition(index);
if (holder != null && holder.itemView != null) {
holder.itemView.setActivated(isActivated);
+
+ if (holder instanceof TileViewHolder) {
+ TileViewHolder tileHolder = (TileViewHolder) holder;
+ if (isActivated) {
+ if (option == mAppliedOption) {
+ CharSequence cd = mContainer.getContext().getString(
+ R.string.option_applied_previewed_description, option.getTitle());
+ tileHolder.labelView.setContentDescription(cd);
+ } else {
+ CharSequence cd = mContainer.getContext().getString(
+ R.string.option_previewed_description, option.getTitle());
+ tileHolder.labelView.setContentDescription(cd);
+ }
+ } else if (option == mAppliedOption) {
+ CharSequence cd = mContainer.getContext().getString(
+ R.string.option_applied_description, option.getTitle());
+ tileHolder.labelView.setContentDescription(cd);
+ } else {
+ // Remove content description
+ tileHolder.labelView.setContentDescription(null);
+ }
+ }
}
}
@@ -179,10 +201,10 @@
checkedFrame.setLayerInsetLeft(idx, checkSize/3);
holder.itemView.setForeground(checkedFrame);
+ // Initialize the currently applied option
CharSequence cd = mContainer.getContext().getString(
- R.string.option_applied_description, option.getTitle());
+ R.string.option_applied_previewed_description, option.getTitle());
holder.labelView.setContentDescription(cd);
-
} else if (mShowCheckmark) {
holder.itemView.setForeground(null);
}