diff options
author | Clark Scheff <clark@cyngn.com> | 2014-08-25 13:02:33 -0700 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2014-08-25 13:03:21 -0700 |
commit | bc73659ae30efa5a60c5643a7448eba6ae966ae3 (patch) | |
tree | 1920a61fee1ce07aa7b93cc49c38081949e4baf1 | |
parent | 1c8f369803ff0f93c29e8f1e682a33e9b861da26 (diff) | |
download | packages_apps_ThemeChooser-bc73659ae30efa5a60c5643a7448eba6ae966ae3.zip packages_apps_ThemeChooser-bc73659ae30efa5a60c5643a7448eba6ae966ae3.tar.gz packages_apps_ThemeChooser-bc73659ae30efa5a60c5643a7448eba6ae966ae3.tar.bz2 |
Check config for applied theme and use default if it is null
Change-Id: I8430cae447d841d9f0ff5f5ebfeb560eb3293dcb
-rw-r--r-- | src/com/cyngn/theme/util/PreferenceUtils.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/cyngn/theme/util/PreferenceUtils.java b/src/com/cyngn/theme/util/PreferenceUtils.java index edbf017..f3c7d02 100644 --- a/src/com/cyngn/theme/util/PreferenceUtils.java +++ b/src/com/cyngn/theme/util/PreferenceUtils.java @@ -6,6 +6,9 @@ package com.cyngn.theme.util; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ThemeUtils; +import android.content.res.Resources; +import android.content.res.ThemeConfig; +import android.text.TextUtils; import java.util.HashSet; import java.util.Set; @@ -23,7 +26,11 @@ public class PreferenceUtils { SharedPreferences prefs = getSharedPreferences(context); if (prefs == null) return null; + final Resources res = context.getResources(); + final ThemeConfig config = res.getConfiguration().themeConfig; + String appliedTheme = config != null ? config.getOverlayPkgName() : null; return prefs.getString(PREF_APPLIED_BASE_THEME, + (!TextUtils.isEmpty(appliedTheme)) ? appliedTheme : ThemeUtils.getDefaultThemePackageName(context)); } |