summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2014-06-22 12:30:21 -0700
committerClark Scheff <clark@cyngn.com>2014-06-22 12:30:21 -0700
commit0ce8beb098efa4e0184f374497b5bf12e505f8b1 (patch)
tree774428f1408226b172f1adbe6e35123e2e5fb148 /src
parentc69e2172796a547f32d49d2b84bacf444a30256b (diff)
downloadandroid_packages_providers_ThemesProvider-0ce8beb098efa4e0184f374497b5bf12e505f8b1.zip
android_packages_providers_ThemesProvider-0ce8beb098efa4e0184f374497b5bf12e505f8b1.tar.gz
android_packages_providers_ThemesProvider-0ce8beb098efa4e0184f374497b5bf12e505f8b1.tar.bz2
Reapply theme components when theme updated.
Change-Id: Ia841ae6ef466e0b60016fab47abfe4c1089cc902
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index 1df0442..d602315 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -156,6 +156,9 @@ public class ThemePackageHelper {
} else if (pi.isLegacyIconPackApk) {
updateLegacyIconPackInternal(context, pi, capabilities);
}
+
+ // We should reapply any components that are currently applied for this theme.
+ reapplyInstalledComponentsForTheme(context, pkgName);
}
}
@@ -348,4 +351,23 @@ public class ThemePackageHelper {
}
return count >= 2;
}
+
+ private static void reapplyInstalledComponentsForTheme(Context context, String pkgName) {
+ List<String> reApply = new LinkedList<String>(); // components to re-apply
+ Cursor mixnmatch = context.getContentResolver().query(MixnMatchColumns.CONTENT_URI,
+ null, null, null, null);
+ while (mixnmatch.moveToNext()) {
+ String mixnmatchKey = mixnmatch.getString(mixnmatch
+ .getColumnIndex(MixnMatchColumns.COL_KEY));
+ String component = ThemesContract.MixnMatchColumns
+ .mixNMatchKeyToComponent(mixnmatchKey);
+ String pkg = mixnmatch.getString(
+ mixnmatch.getColumnIndex(MixnMatchColumns.COL_VALUE));
+ if (pkgName.equals(pkg)) {
+ reApply.add(component);
+ }
+ }
+ ThemeManager manager = (ThemeManager) context.getSystemService(Context.THEME_SERVICE);
+ manager.requestThemeChange(pkgName, reApply);
+ }
}