Show colorAccent icon color for connected Wi-Fi entry

- Screenshot:
  https://screenshot.googleplex.com/9Mud8BPjvSEyo2Q

Bug: 177481238
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiEntryPreferenceTest

Change-Id: I637a38e7acfa8a330e88860743be63417e5a8187
This commit is contained in:
Weng Su
2021-04-07 11:02:37 +08:00
parent 53bdb4b8c0
commit 011d02b2a5

View File

@@ -186,6 +186,10 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt
// TODO(b/70983952): Fill this method in
}
protected int getIconColorAttr() {
return (mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED)
? android.R.attr.colorAccent : android.R.attr.colorControlNormal;
}
private void updateIcon(boolean showX, int level) {
if (level == -1) {
@@ -195,8 +199,7 @@ public class WifiEntryPreference extends Preference implements WifiEntry.WifiEnt
final Drawable drawable = mIconInjector.getIcon(showX, level);
if (drawable != null) {
drawable.setTintList(Utils.getColorAttr(getContext(),
android.R.attr.colorControlNormal));
drawable.setTint(Utils.getColorAttrDefaultColor(getContext(), getIconColorAttr()));
setIcon(drawable);
} else {
setIcon(null);