diff options
author | Clark Scheff <clark@cyngn.com> | 2014-10-29 10:51:20 -0700 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2014-10-30 02:56:19 +0000 |
commit | 8a5e3c7020987a1afc6892865b3ce810c131e3aa (patch) | |
tree | f857b7ceb853ef0a78a338403b5649ed0ecb057c /src/com | |
parent | 4dfcc0884b780d7d1891545c10a629ac969d3c02 (diff) | |
download | packages_apps_ThemeChooser-8a5e3c7020987a1afc6892865b3ce810c131e3aa.tar.gz packages_apps_ThemeChooser-8a5e3c7020987a1afc6892865b3ce810c131e3aa.tar.bz2 packages_apps_ThemeChooser-8a5e3c7020987a1afc6892865b3ce810c131e3aa.zip |
Reset applied base theme to default when applied theme uninstalled
Since we keep track of the currently applied base theme in our
preferences, we need to update it to the default system theme if
the currently applied base theme is uninstalled.
This fixes THEMES-391
Change-Id: Ic07cc9f933fcb4e7a5aa8ebef7f102dc815673ed
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/cyngn/theme/chooser/AppReceiver.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/cyngn/theme/chooser/AppReceiver.java b/src/com/cyngn/theme/chooser/AppReceiver.java index 257aa65..920dc4d 100644 --- a/src/com/cyngn/theme/chooser/AppReceiver.java +++ b/src/com/cyngn/theme/chooser/AppReceiver.java @@ -9,8 +9,10 @@ import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ThemeUtils; import android.content.res.ThemeManager; import android.net.Uri; +import android.text.TextUtils; import com.cyngn.theme.util.NotificationHelper; import com.cyngn.theme.util.PreferenceUtils; @@ -38,11 +40,15 @@ public class AppReceiver extends BroadcastReceiver { } catch (NameNotFoundException e) { } } else if (Intent.ACTION_PACKAGE_FULLY_REMOVED.equals(action)) { - try { - if (isTheme(context, pkgName)) { - PreferenceUtils.removeUpdatedTheme(context, pkgName); - } - } catch (NameNotFoundException e) { + // remove updated status for this theme (if one exists) + PreferenceUtils.removeUpdatedTheme(context, pkgName); + + // If the theme being removed was the currently applied theme we need + // to update the applied base theme in preferences to the default theme. + String appliedBaseTheme = PreferenceUtils.getAppliedBaseTheme(context); + if (!TextUtils.isEmpty(appliedBaseTheme) && appliedBaseTheme.equals(pkgName)) { + PreferenceUtils.setAppliedBaseTheme(context, + ThemeUtils.getDefaultThemePackageName(context)); } NotificationHelper.cancelNotifications(context); } else if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) { |