Skip to content

Commit 8a56162

Browse files
eldainosormarkakash
authored andcommitted
ThemePicker: Show item name under the category name
When selecting an option, the name will show up for the respective font, icon, accent colour or shape. Change-Id: I834dbf30301dba47b1a7e850940af32e92c14b2d
1 parent af69ff4 commit 8a56162

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

res/layout/theme_component_preview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
android:drawablePadding="@dimen/theme_preview_header_drawable_padding"
5050
android:textAppearance="@style/CardTitleTextAppearance"
5151
android:importantForAccessibility="no"
52+
android:gravity="center_horizontal"
5253
app:layout_constraintBottom_toTopOf="@id/theme_preview_card_body_container"
5354
app:layout_constraintEnd_toEndOf="parent"
5455
app:layout_constraintHorizontal_bias="0.5"

src/com/android/customization/model/theme/custom/ThemeComponentOption.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ public void bindPreview(ViewGroup container) {
151151
}
152152
TextView title = container.findViewById(R.id.font_card_title);
153153
title.setTypeface(mHeadlineFont);
154+
TextView header = container.findViewById(R.id.theme_preview_card_header);
155+
header.setText(String.format("%s\n(%s)",
156+
container.getContext().getString(R.string.preview_name_font), mLabel));
154157
TextView bodyText = container.findViewById(R.id.font_card_body);
155158
bodyText.setTypeface(mBodyFont);
156159
container.findViewById(R.id.font_card_divider).setBackgroundColor(
@@ -233,6 +236,9 @@ public void bindPreview(ViewGroup container) {
233236

234237
bindPreviewHeader(container, R.string.preview_name_icon, R.drawable.ic_wifi_24px);
235238

239+
TextView header = container.findViewById(R.id.theme_preview_card_header);
240+
header.setText(String.format("%s\n(%s)",
241+
container.getContext().getString(R.string.preview_name_icon), mLabel));
236242
ViewGroup cardBody = container.findViewById(R.id.theme_preview_card_body_container);
237243
if (cardBody.getChildCount() == 0) {
238244
LayoutInflater.from(container.getContext()).inflate(
@@ -366,6 +372,9 @@ public void bindPreview(ViewGroup container) {
366372

367373
bindPreviewHeader(container, R.string.preview_name_color, R.drawable.ic_colorize_24px);
368374

375+
TextView header = container.findViewById(R.id.theme_preview_card_header);
376+
header.setText(String.format("%s\n(%s)",
377+
container.getContext().getString(R.string.preview_name_color), mLabel));
369378
ViewGroup cardBody = container.findViewById(R.id.theme_preview_card_body_container);
370379
if (cardBody.getChildCount() == 0) {
371380
LayoutInflater.from(container.getContext()).inflate(
@@ -509,6 +518,9 @@ public void bindPreview(ViewGroup container) {
509518

510519
bindPreviewHeader(container, R.string.preview_name_shape, R.drawable.ic_shapes_24px);
511520

521+
TextView header = container.findViewById(R.id.theme_preview_card_header);
522+
header.setText(String.format("%s\n(%s)",
523+
container.getContext().getString(R.string.preview_name_shape), mLabel));
512524
ViewGroup cardBody = container.findViewById(R.id.theme_preview_card_body_container);
513525
if (cardBody.getChildCount() == 0) {
514526
LayoutInflater.from(container.getContext()).inflate(

0 commit comments

Comments
 (0)