summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-09-10 17:22:05 -0700
committerd34d <clark@cyngn.com>2015-09-10 17:22:05 -0700
commitc598d73c8af75ac004f18e74fbc37e8867c97bbd (patch)
treee83b2f3cafd3fa85de422aa3e17101aaa516f9e0
parentd809ce9c7177390e6335b7503cce3e69683b5865 (diff)
downloadpackages_apps_ThemeChooser-c598d73c8af75ac004f18e74fbc37e8867c97bbd.zip
packages_apps_ThemeChooser-c598d73c8af75ac004f18e74fbc37e8867c97bbd.tar.gz
packages_apps_ThemeChooser-c598d73c8af75ac004f18e74fbc37e8867c97bbd.tar.bz2
AppThemer: System theme always has overlay for app
Whenever using app themer to switch an app to the system theme, the user is presented with a message stating that this theme does not explicitly overlay the current app. System theme is really an absence of a theme so we should not show this message when applying the system theme to an app. Change-Id: I4087744c325dcd07abffe9a893ecc8fa4c9f1e07
-rw-r--r--src/com/cyngn/theme/util/Utils.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/cyngn/theme/util/Utils.java b/src/com/cyngn/theme/util/Utils.java
index 3ae73b2..d5f8bab 100644
--- a/src/com/cyngn/theme/util/Utils.java
+++ b/src/com/cyngn/theme/util/Utils.java
@@ -523,15 +523,19 @@ public class Utils {
public static boolean themeHasOverlayForApp(Context context, String appPkgNane,
String themePkgName) {
boolean hasExplicitOverlay = false;
- try {
- Context themeContext = context.createPackageContext(themePkgName, 0);
- if (themeContext != null) {
- AssetManager assets = themeContext.getAssets();
- String[] files = assets.list(OVERLAY_BASE_PATH + appPkgNane);
- if (files != null && files.length > 0) hasExplicitOverlay = true;
+ if (ThemeConfig.SYSTEM_DEFAULT.equals(themePkgName)) {
+ hasExplicitOverlay = true;
+ } else {
+ try {
+ Context themeContext = context.createPackageContext(themePkgName, 0);
+ if (themeContext != null) {
+ AssetManager assets = themeContext.getAssets();
+ String[] files = assets.list(OVERLAY_BASE_PATH + appPkgNane);
+ if (files != null && files.length > 0) hasExplicitOverlay = true;
+ }
+ } catch (Exception e) {
+ // don't care, we'll return false and let the caller handle things
}
- } catch (Exception e) {
- // don't care, we'll return false and let the caller handle things
}
return hasExplicitOverlay;
}