summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2016-01-15 18:10:14 (GMT)
committerClark Scheff <clark@cyngn.com>2016-01-17 16:26:25 (GMT)
commit5756a992657acab8b3b990f1c3fd911f50f9f0e5 (patch)
treebb9273cea283601ed846e5383afdb991e3a8cf11 /src
parent59bff5c10357bfe55244966d9c43bcce11ed646b (diff)
downloadandroid_packages_providers_ThemesProvider-5756a992657acab8b3b990f1c3fd911f50f9f0e5.zip
android_packages_providers_ThemesProvider-5756a992657acab8b3b990f1c3fd911f50f9f0e5.tar.gz
android_packages_providers_ThemesProvider-5756a992657acab8b3b990f1c3fd911f50f9f0e5.tar.bz2
Fix blank WiFi and signal icon previews
The icons used in SystemUI for the wifi and cell signal now use color attributes for defining the fill and background colors. These previews were showing up as blank because no theme/style was applied to the resources and the system was unable to resolve the fill and background colors due to missing attributes. This patch loads in the style needed to get the proper colors for the icon previews Change-Id: Id5da421333c2def3a75e42824a298ee90759a18d TICKET: CYNGNOS-1609
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/util/SystemUiPreviewGenerator.java30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/org/cyanogenmod/themes/provider/util/SystemUiPreviewGenerator.java b/src/org/cyanogenmod/themes/provider/util/SystemUiPreviewGenerator.java
index d53ad2f..9b5df5e 100644
--- a/src/org/cyanogenmod/themes/provider/util/SystemUiPreviewGenerator.java
+++ b/src/org/cyanogenmod/themes/provider/util/SystemUiPreviewGenerator.java
@@ -48,6 +48,9 @@ public class SystemUiPreviewGenerator {
private static final String IC_SYSBAR_RECENT = "ic_sysbar_recent";
private static final String STATUS_BAR_ICON_SIZE = "status_bar_icon_size";
+ // Style used for tinting of wifi and signal icons
+ private static final String DUAL_TONE_LIGHT_THEME = "DualToneLightTheme";
+
private Context mContext;
public SystemUiPreviewGenerator(Context context) {
@@ -61,29 +64,42 @@ public class SystemUiPreviewGenerator {
* @throws NameNotFoundException
*/
public SystemUiItems generateSystemUiItems(String pkgName) throws NameNotFoundException {
- PackageManager pm = mContext.getPackageManager();
- Resources res = pm.getThemedResourcesForApplication(SYSTEMUI_PACKAGE, pkgName);
+ final PackageManager pm = mContext.getPackageManager();
+ final Context themeContext = mContext.createApplicationContext(
+ pm.getApplicationInfo(SYSTEMUI_PACKAGE, 0), pkgName, 0);
+ final Resources res = themeContext.getResources();
+ // Set the theme for use when tinting the signal icons
+ themeContext.setTheme(res.getIdentifier(DUAL_TONE_LIGHT_THEME, "style", SYSTEMUI_PACKAGE));
+
int iconSize = res.getDimensionPixelSize(res.getIdentifier(STATUS_BAR_ICON_SIZE, "dimen",
SYSTEMUI_PACKAGE));
-
SystemUiItems items = new SystemUiItems();
- Drawable d = res.getDrawable(res.getIdentifier(BLUETOOTH_DRAWABLE, "drawable",
+
+ // Generate bluetooth icon
+ Drawable d = themeContext.getDrawable(res.getIdentifier(BLUETOOTH_DRAWABLE, "drawable",
SYSTEMUI_PACKAGE));
items.bluetoothIcon = renderDrawableToBitmap(d, iconSize);
- d = res.getDrawable(res.getIdentifier(WIFI_DRAWABLE, "drawable", SYSTEMUI_PACKAGE));
+ // Generate wifi icon
+ d = themeContext.getDrawable(res.getIdentifier(WIFI_DRAWABLE, "drawable",
+ SYSTEMUI_PACKAGE));
items.wifiIcon = renderDrawableToBitmap(d, iconSize);
- d = res.getDrawable(res.getIdentifier(SIGNAL_DRAWABLE, "drawable", SYSTEMUI_PACKAGE));
+ // Generate cell signal icon
+ d = themeContext.getDrawable(res.getIdentifier(SIGNAL_DRAWABLE, "drawable",
+ SYSTEMUI_PACKAGE));
items.signalIcon = renderDrawableToBitmap(d, iconSize);
- items.clockColor = res.getColor(res.getIdentifier(STATUS_BAR_CLOCK_COLOR, "color",
+ // Retrieve the color used for the clock
+ items.clockColor = themeContext.getColor(res.getIdentifier(STATUS_BAR_CLOCK_COLOR, "color",
SYSTEMUI_PACKAGE));
+
// wifi margin no longer used in systemui
items.wifiMarginEnd = 0;
generateBatteryPreviews(res, items);
generateBackgroundPreviews(res, items);
+ // Generate navigation bar icons
items.navbarBack = BitmapFactory.decodeResource(res, res.getIdentifier(IC_SYSBAR_BACK,
"drawable", SYSTEMUI_PACKAGE));
items.navbarHome = BitmapFactory.decodeResource(res, res.getIdentifier(IC_SYSBAR_HOME,