<!-- Color for preference icons on the Wifi Network Details page -->
<color name="wifi_details_icon_color">#8A000000</color>
+ <!-- The fallback color for tinting icons. Only used when colorControlNormal is unavailable -->
+ <color name="fallback_tintColor">#89000000</color>
</resources>
<!-- Whether or not the camera lift trigger is available in the moves menu. -->
<bool name="config_cameraLiftTriggerAvailable">false</bool>
+ <!-- Whether or not we should tint the icon color on setting pages. -->
+ <bool name="config_tintSettingIcon">true</bool>
+
</resources>
public void setCategoriesAndSuggestions(List<DashboardCategory> categories,
List<Tile> suggestions) {
- // TODO: Better place for tinting?
- final TypedArray a = mContext.obtainStyledAttributes(new int[]{
- android.R.attr.colorControlNormal});
- int tintColor = a.getColor(0, mContext.getColor(android.R.color.white));
- a.recycle();
- for (int i = 0; i < categories.size(); i++) {
- for (int j = 0; j < categories.get(i).tiles.size(); j++) {
- final Tile tile = categories.get(i).tiles.get(j);
-
- if (!mContext.getPackageName().equals(
- tile.intent.getComponent().getPackageName())) {
- // If this drawable is coming from outside Settings, tint it to match the
- // color.
- tile.icon.setTint(tintColor);
+ if (mDashboardFeatureProvider.shouldTintIcon()) {
+ // TODO: Better place for tinting?
+ final TypedArray a = mContext.obtainStyledAttributes(new int[]{
+ android.R.attr.colorControlNormal});
+ final int tintColor = a.getColor(0, mContext.getColor(R.color.fallback_tintColor));
+ a.recycle();
+ for (int i = 0; i < categories.size(); i++) {
+ for (int j = 0; j < categories.get(i).tiles.size(); j++) {
+ final Tile tile = categories.get(i).tiles.get(j);
+
+ if (!mContext.getPackageName().equals(
+ tile.intent.getComponent().getPackageName())) {
+ // If this drawable is coming from outside Settings, tint it to match the
+ // color.
+ tile.icon.setTint(tintColor);
+ }
}
}
}
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Bundle;
public void testGetExtraIntentAction_shouldReturnNull() {
assertThat(mImpl.getExtraIntentAction()).isNull();
}
+
+ @Test
+ public void testShouldTintIcon_shouldReturnValueFromResource() {
+ final Resources res = mActivity.getApplicationContext().getResources();
+ when(res.getBoolean(R.bool.config_tintSettingIcon))
+ .thenReturn(false);
+ assertThat(mImpl.shouldTintIcon()).isFalse();
+
+ when(res.getBoolean(R.bool.config_tintSettingIcon))
+ .thenReturn(true);
+ assertThat(mImpl.shouldTintIcon()).isTrue();
+ }
}