Loading res/layout/preview_card_color_content.xml +7 −6 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ android:tint="@color/theme_preview_icon_color" android:maxHeight="2dp" android:progress="1" android:clickable="true" android:max="3"/> </LinearLayout> <LinearLayout Loading @@ -103,7 +104,7 @@ android:layout_height="wrap_content" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <RadioButton android:id="@+id/preview_radio_selected" android:layout_width="wrap_content" Loading @@ -112,14 +113,14 @@ android:layout_marginRight="22dp" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <Switch android:id="@+id/preview_toggle_selected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" Loading @@ -133,7 +134,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <RadioButton android:id="@+id/preview_radio_unselected" android:layout_width="wrap_content" Loading @@ -141,12 +142,12 @@ android:layout_marginLeft="30dp" android:layout_marginRight="22dp" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <Switch android:id="@+id/preview_toggle_unselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> </LinearLayout> </LinearLayout> res/values-night/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,10 @@ <color name="icon_thumbnail_color">@color/white_70_alpha</color> <color name="control_grey">#b3b3b3</color> <color name="switch_track_tint">#171717</color> <color name="switch_thumb_tint">#bdbdbd</color> <color name="tile_enabled_icon_color">#2d2d2d</color> <color name="tile_disabled_icon_color">@color/light_grey</color> <color name="tile_disabled_background_color">#353535</color> Loading res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ <color name="text_color_dark">#2d2d2d</color> <color name="text_color_light">@color/material_white_text</color> <color name="control_grey">#757575</color> <color name="switch_track_tint">#acacac</color> <color name="switch_thumb_tint">#f1f1f1</color> <color name="tile_enabled_icon_color">@color/material_white_100</color> <color name="tile_disabled_icon_color">#2d2d2d</color> <color name="tile_disabled_background_color">@color/light_grey</color> Loading src/com/android/customization/model/theme/custom/ThemeComponentOption.java +21 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.res.ColorStateList; 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; Loading Loading @@ -227,7 +228,8 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC */ private static int[] COLOR_BUTTON_IDS = { R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected, R.id.preview_toggle_selected, R.id.preview_check_unselected, R.id.preview_radio_unselected, R.id.preview_toggle_unselected }; @ColorInt private int mColorAccentLight; Loading Loading @@ -285,15 +287,19 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC LayoutInflater.from(container.getContext()).inflate( R.layout.preview_card_color_content, cardBody, true); } @ColorInt int accentColor = resolveColor(container.getResources()); Resources res = container.getResources(); @ColorInt int accentColor = resolveColor(res); @ColorInt int controlGreyColor = res.getColor(R.color.control_grey); ColorStateList tintList = new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{android.R.attr.state_checked} new int[]{android.R.attr.state_checked}, new int[]{-android.R.attr.state_enabled} }, new int[] { accentColor, accentColor accentColor, controlGreyColor } ); Loading @@ -302,9 +308,17 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC button.setButtonTintList(tintList); } Switch toggle = container.findViewById(R.id.preview_toggle_selected); toggle.setThumbTintList(tintList); toggle.setTrackTintList(tintList); Switch enabledSwitch = container.findViewById(R.id.preview_toggle_selected); enabledSwitch.setThumbTintList(tintList); enabledSwitch.setTrackTintList(tintList); Switch disabledSwitch = container.findViewById(R.id.preview_toggle_unselected); disabledSwitch.setThumbTintList( ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint))); disabledSwitch.setTrackTintList( ColorStateList.valueOf(res.getColor(R.color.switch_track_tint))); // Change overlay method so our color doesn't get too light/dark disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY); ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor); SeekBar seekbar = container.findViewById(R.id.preview_seekbar); Loading src/com/android/customization/picker/theme/ThemeFragment.java +19 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; Loading Loading @@ -340,6 +341,8 @@ public class ThemeFragment extends ToolbarFragment { }; private int[] mColorButtonIds = { R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected, R.id.preview_check_unselected, R.id.preview_radio_unselected, R.id.preview_toggle_unselected }; private int[] mColorTileIds = { R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg Loading Loading @@ -388,14 +391,17 @@ public class ThemeFragment extends ToolbarFragment { previewInfo.resolveAccentColor(res), editClickListener) { @Override protected void bindBody(boolean forceRebind) { int controlGreyColor = res.getColor(R.color.control_grey); ColorStateList tintList = new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{android.R.attr.state_checked} new int[]{android.R.attr.state_checked}, new int[]{-android.R.attr.state_enabled}, }, new int[] { accentColor, accentColor accentColor, controlGreyColor } ); Loading @@ -404,9 +410,17 @@ public class ThemeFragment extends ToolbarFragment { button.setButtonTintList(tintList); } Switch switch1 = card.findViewById(R.id.preview_toggle_selected); switch1.setThumbTintList(tintList); switch1.setTrackTintList(tintList); Switch enabledSwitch = card.findViewById(R.id.preview_toggle_selected); enabledSwitch.setThumbTintList(tintList); enabledSwitch.setTrackTintList(tintList); Switch disabledSwitch = card.findViewById(R.id.preview_toggle_unselected); disabledSwitch.setThumbTintList( ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint))); disabledSwitch.setTrackTintList( ColorStateList.valueOf(res.getColor(R.color.switch_track_tint))); // Change overlay method so our color doesn't get too light/dark disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY); ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor); SeekBar seekbar = card.findViewById(R.id.preview_seekbar); Loading Loading
res/layout/preview_card_color_content.xml +7 −6 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ android:tint="@color/theme_preview_icon_color" android:maxHeight="2dp" android:progress="1" android:clickable="true" android:max="3"/> </LinearLayout> <LinearLayout Loading @@ -103,7 +104,7 @@ android:layout_height="wrap_content" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <RadioButton android:id="@+id/preview_radio_selected" android:layout_width="wrap_content" Loading @@ -112,14 +113,14 @@ android:layout_marginRight="22dp" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <Switch android:id="@+id/preview_toggle_selected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" Loading @@ -133,7 +134,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <RadioButton android:id="@+id/preview_radio_unselected" android:layout_width="wrap_content" Loading @@ -141,12 +142,12 @@ android:layout_marginLeft="30dp" android:layout_marginRight="22dp" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> <Switch android:id="@+id/preview_toggle_unselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="false"/> android:enabled="false"/> </LinearLayout> </LinearLayout>
res/values-night/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,10 @@ <color name="icon_thumbnail_color">@color/white_70_alpha</color> <color name="control_grey">#b3b3b3</color> <color name="switch_track_tint">#171717</color> <color name="switch_thumb_tint">#bdbdbd</color> <color name="tile_enabled_icon_color">#2d2d2d</color> <color name="tile_disabled_icon_color">@color/light_grey</color> <color name="tile_disabled_background_color">#353535</color> Loading
res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ <color name="text_color_dark">#2d2d2d</color> <color name="text_color_light">@color/material_white_text</color> <color name="control_grey">#757575</color> <color name="switch_track_tint">#acacac</color> <color name="switch_thumb_tint">#f1f1f1</color> <color name="tile_enabled_icon_color">@color/material_white_100</color> <color name="tile_disabled_icon_color">#2d2d2d</color> <color name="tile_disabled_background_color">@color/light_grey</color> Loading
src/com/android/customization/model/theme/custom/ThemeComponentOption.java +21 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.res.ColorStateList; 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; Loading Loading @@ -227,7 +228,8 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC */ private static int[] COLOR_BUTTON_IDS = { R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected, R.id.preview_toggle_selected, R.id.preview_check_unselected, R.id.preview_radio_unselected, R.id.preview_toggle_unselected }; @ColorInt private int mColorAccentLight; Loading Loading @@ -285,15 +287,19 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC LayoutInflater.from(container.getContext()).inflate( R.layout.preview_card_color_content, cardBody, true); } @ColorInt int accentColor = resolveColor(container.getResources()); Resources res = container.getResources(); @ColorInt int accentColor = resolveColor(res); @ColorInt int controlGreyColor = res.getColor(R.color.control_grey); ColorStateList tintList = new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{android.R.attr.state_checked} new int[]{android.R.attr.state_checked}, new int[]{-android.R.attr.state_enabled} }, new int[] { accentColor, accentColor accentColor, controlGreyColor } ); Loading @@ -302,9 +308,17 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC button.setButtonTintList(tintList); } Switch toggle = container.findViewById(R.id.preview_toggle_selected); toggle.setThumbTintList(tintList); toggle.setTrackTintList(tintList); Switch enabledSwitch = container.findViewById(R.id.preview_toggle_selected); enabledSwitch.setThumbTintList(tintList); enabledSwitch.setTrackTintList(tintList); Switch disabledSwitch = container.findViewById(R.id.preview_toggle_unselected); disabledSwitch.setThumbTintList( ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint))); disabledSwitch.setTrackTintList( ColorStateList.valueOf(res.getColor(R.color.switch_track_tint))); // Change overlay method so our color doesn't get too light/dark disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY); ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor); SeekBar seekbar = container.findViewById(R.id.preview_seekbar); Loading
src/com/android/customization/picker/theme/ThemeFragment.java +19 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; Loading Loading @@ -340,6 +341,8 @@ public class ThemeFragment extends ToolbarFragment { }; private int[] mColorButtonIds = { R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected, R.id.preview_check_unselected, R.id.preview_radio_unselected, R.id.preview_toggle_unselected }; private int[] mColorTileIds = { R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg Loading Loading @@ -388,14 +391,17 @@ public class ThemeFragment extends ToolbarFragment { previewInfo.resolveAccentColor(res), editClickListener) { @Override protected void bindBody(boolean forceRebind) { int controlGreyColor = res.getColor(R.color.control_grey); ColorStateList tintList = new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{android.R.attr.state_checked} new int[]{android.R.attr.state_checked}, new int[]{-android.R.attr.state_enabled}, }, new int[] { accentColor, accentColor accentColor, controlGreyColor } ); Loading @@ -404,9 +410,17 @@ public class ThemeFragment extends ToolbarFragment { button.setButtonTintList(tintList); } Switch switch1 = card.findViewById(R.id.preview_toggle_selected); switch1.setThumbTintList(tintList); switch1.setTrackTintList(tintList); Switch enabledSwitch = card.findViewById(R.id.preview_toggle_selected); enabledSwitch.setThumbTintList(tintList); enabledSwitch.setTrackTintList(tintList); Switch disabledSwitch = card.findViewById(R.id.preview_toggle_unselected); disabledSwitch.setThumbTintList( ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint))); disabledSwitch.setTrackTintList( ColorStateList.valueOf(res.getColor(R.color.switch_track_tint))); // Change overlay method so our color doesn't get too light/dark disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY); ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor); SeekBar seekbar = card.findViewById(R.id.preview_seekbar); Loading