Change SIM colors to follow GAR standards in dark mode in SIM rename

dialog.

Add a color map to map SIM colors in light mode to dark mode. Check
current system dark mode and set the SIM icon color to proper color when
get the view.

Bug: 144693819
Test: Manually set SIM colors to all 6 possibilities and switch from
light mode to dark mode.

Change-Id: I5b947d1d9c949bc6b8cc669d71cd3f5d66ddecb1
This commit is contained in:
Grace Jia
2020-05-15 13:32:11 -07:00
parent 576f6c9c75
commit 4fdc471d14
3 changed files with 264 additions and 105 deletions

View File

@@ -33,38 +33,6 @@
column="9"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/notification_importance_button_selected&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/button_border_selected.xml"
line="23"
column="9"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/notification_importance_button_selected&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/button_border_selected.xml"
line="23"
column="9"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -1521,22 +1489,6 @@
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;palette_list_color_pink&quot;>#e52592&lt;/color> &lt;!-- Material Pink 600 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="161"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -1549,7 +1501,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="164"
line="163"
column="5"/>
</issue>
@@ -1565,7 +1517,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="165"
line="164"
column="5"/>
</issue>
@@ -1581,7 +1533,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="166"
line="165"
column="5"/>
</issue>
@@ -1597,7 +1549,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="167"
line="166"
column="5"/>
</issue>
@@ -1613,7 +1565,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="168"
line="167"
column="5"/>
</issue>
@@ -1629,7 +1581,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="169"
line="168"
column="5"/>
</issue>
@@ -1645,7 +1597,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="170"
line="169"
column="5"/>
</issue>
@@ -1657,11 +1609,187 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;palette_list_dark_mode_color_pink&quot;>#ff8bcb&lt;/color> &lt;!-- Material Pink 300 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" &lt;color name=&quot;SIM_color_teal&quot;>#ff00796b&lt;/color> &lt;!-- Material Teal 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="171"
line="172"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_color_blue&quot;>#ff3367d6&lt;/color> &lt;!-- Material Blue 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="173"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_color_indigo&quot;>#ff303f9f&lt;/color> &lt;!-- Material Indigo 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="174"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_color_purple&quot;>#ff7b1fa2&lt;/color> &lt;!-- Material Purple 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="175"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_color_pink&quot;>#ffc2185b&lt;/color> &lt;!-- Material Pink 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="176"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_color_red&quot;>#ffd32f2f&lt;/color> &lt;!-- Material Red 700 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="177"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_teal&quot;>#ff80cbc4&lt;/color> &lt;!-- Material Teal 200 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="180"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_blue&quot;>#ff90caf9&lt;/color> &lt;!-- Material Blue 200 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="181"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_indigo&quot;>#ffc5cae9&lt;/color> &lt;!-- Material Indigo 100 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="182"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_purple&quot;>#ffe1bee7&lt;/color> &lt;!-- Material Purple 100 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="183"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_pink&quot;>#fff48fb1&lt;/color> &lt;!-- Material Pink 200 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="184"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;SIM_dark_mode_color_red&quot;>#ffef9a9a&lt;/color> &lt;!-- Material Red 200 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="185"
column="5"/>
</issue>
@@ -2321,22 +2449,6 @@
column="13"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/notification_alert_color&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/ic_notification_alert.xml"
line="22"
column="17"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -2865,6 +2977,22 @@
column="9"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&quot;&quot;&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.&quot;&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rXC/strings.xml"
line="2763"
column="170"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -2877,7 +3005,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rAU/strings.xml"
line="2689"
line="2765"
column="64"/>
</issue>
@@ -2893,7 +3021,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rCA/strings.xml"
line="2689"
line="2765"
column="64"/>
</issue>
@@ -2909,7 +3037,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rGB/strings.xml"
line="2689"
line="2765"
column="64"/>
</issue>
@@ -2925,26 +3053,10 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rIN/strings.xml"
line="2689"
line="2765"
column="64"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&quot;&quot;&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.&quot;&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rXC/strings.xml"
line="2689"
column="170"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -2957,7 +3069,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
line="6228"
line="6408"
column="36"/>
</issue>
@@ -2973,7 +3085,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="163"
line="202"
column="41"/>
</issue>
@@ -2989,7 +3101,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="378"
line="417"
column="44"/>
</issue>
@@ -3005,7 +3117,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="384"
line="423"
column="44"/>
</issue>
@@ -3021,7 +3133,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="385"
line="424"
column="44"/>
</issue>
@@ -3037,7 +3149,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="421"
line="460"
column="34"/>
</issue>
@@ -3149,7 +3261,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
line="254"
line="258"
column="42"/>
</issue>
@@ -3309,7 +3421,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/user_info_header.xml"
line="93"
line="128"
column="11"/>
</issue>

View File

@@ -168,4 +168,19 @@
<color name="palette_list_dark_mode_color_blue">#8AB4F8</color> <!-- Material Blue 300 -->
<color name="palette_list_dark_mode_color_purple">#c58af9</color> <!-- Material Purple 300 -->
<!-- SIM colors -->
<color name="SIM_color_teal">#ff00796b</color> <!-- Material Teal 700 -->
<color name="SIM_color_blue">#ff3367d6</color> <!-- Material Blue 700 -->
<color name="SIM_color_indigo">#ff303f9f</color> <!-- Material Indigo 700 -->
<color name="SIM_color_purple">#ff7b1fa2</color> <!-- Material Purple 700 -->
<color name="SIM_color_pink">#ffc2185b</color> <!-- Material Pink 700 -->
<color name="SIM_color_red">#ffd32f2f</color> <!-- Material Red 700 -->
<!-- Dark mode SIM colors -->
<color name="SIM_dark_mode_color_teal">#ff80cbc4</color> <!-- Material Teal 200 -->
<color name="SIM_dark_mode_color_blue">#ff90caf9</color> <!-- Material Blue 200 -->
<color name="SIM_dark_mode_color_indigo">#ffc5cae9</color> <!-- Material Indigo 100 -->
<color name="SIM_dark_mode_color_purple">#ffe1bee7</color> <!-- Material Purple 100 -->
<color name="SIM_dark_mode_color_pink">#fff48fb1</color> <!-- Material Pink 200 -->
<color name="SIM_dark_mode_color_red">#ffef9a9a</color> <!-- Material Red 200 -->
</resources>

View File

@@ -19,6 +19,7 @@ package com.android.settings.network.telephony;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Paint;
import android.graphics.drawable.ShapeDrawable;
@@ -48,7 +49,10 @@ import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settingslib.DeviceInfoUtils;
import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Map;
/**
* A dialog allowing the display name of a mobile network subscription to be changed
@@ -65,6 +69,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
private EditText mNameView;
private Spinner mColorSpinner;
private Color[] mColors;
private Map<Integer, Integer> mLightDarkMap;
public static RenameMobileNetworkDialogFragment newInstance(int subscriptionId) {
final Bundle args = new Bundle(1);
@@ -100,6 +105,21 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
mTelephonyManager = getTelephonyManager(context);
mSubscriptionManager = getSubscriptionManager(context);
mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
Resources res = context.getResources();
mLightDarkMap = ImmutableMap.<Integer, Integer>builder()
.put(res.getInteger(R.color.SIM_color_teal),
res.getInteger(R.color.SIM_dark_mode_color_teal))
.put(res.getInteger(R.color.SIM_color_blue),
res.getInteger(R.color.SIM_dark_mode_color_blue))
.put(res.getInteger(R.color.SIM_color_indigo),
res.getInteger(R.color.SIM_dark_mode_color_indigo))
.put(res.getInteger(R.color.SIM_color_purple),
res.getInteger(R.color.SIM_dark_mode_color_purple))
.put(res.getInteger(R.color.SIM_color_pink),
res.getInteger(R.color.SIM_dark_mode_color_pink))
.put(res.getInteger(R.color.SIM_color_red),
res.getInteger(R.color.SIM_dark_mode_color_red))
.build();
}
@NonNull
@@ -196,8 +216,13 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
if (convertView == null) {
convertView = inflater.inflate(mItemResId, null);
}
boolean isDarkMode = false;
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES) {
isDarkMode = true;
}
((ImageView) convertView.findViewById(R.id.color_icon))
.setImageDrawable(getItem(position).getDrawable());
.setImageDrawable(getItem(position).getDrawable(isDarkMode));
((TextView) convertView.findViewById(R.id.color_label))
.setText(getItem(position).getLabel());
@@ -223,7 +248,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
return colors;
}
private static class Color {
private class Color {
private String mLabel;
private int mColor;
@@ -248,8 +273,15 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
return mColor;
}
private ShapeDrawable getDrawable() {
private ShapeDrawable getDrawable(boolean isDarkMode) {
if (isDarkMode) {
mDrawable.getPaint().setColor(getDarkColor(mColor));
}
return mDrawable;
}
}
private int getDarkColor(int lightColor) {
return mLightDarkMap.getOrDefault(lightColor, lightColor);
}
}