summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2014-08-28 14:51:08 -0700
committerClark Scheff <clark@cyngn.com>2014-08-28 14:51:08 -0700
commit647ca6aeda73168a3c0000c38866456186a2be07 (patch)
tree4f96e6c1349aa78eb1e530c8e688bebc88f008fd /src
parent142d0b69745f16a20bda3f3f141cefc3a79326d1 (diff)
downloadpackages_apps_ThemeChooser-647ca6aeda73168a3c0000c38866456186a2be07.zip
packages_apps_ThemeChooser-647ca6aeda73168a3c0000c38866456186a2be07.tar.gz
packages_apps_ThemeChooser-647ca6aeda73168a3c0000c38866456186a2be07.tar.bz2
Check default components for customized when default theme is applied
Because the system default may not be holo and it may not contain all the supported components, we need to check what the default components should be and if they differ then we will set the customized tag. Change-Id: I47af1a4bbb87b9ce68273410a1b7b3f522903e32
Diffstat (limited to 'src')
-rw-r--r--src/com/cyngn/theme/chooser/MyThemeFragment.java37
-rw-r--r--src/com/cyngn/theme/chooser/ThemeFragment.java1
2 files changed, 31 insertions, 7 deletions
diff --git a/src/com/cyngn/theme/chooser/MyThemeFragment.java b/src/com/cyngn/theme/chooser/MyThemeFragment.java
index 93e5103..1748ef2 100644
--- a/src/com/cyngn/theme/chooser/MyThemeFragment.java
+++ b/src/com/cyngn/theme/chooser/MyThemeFragment.java
@@ -38,6 +38,7 @@ import com.cyngn.theme.util.TypefaceHelperCache;
import com.cyngn.theme.util.Utils;
import java.io.IOException;
+import java.util.Map;
public class MyThemeFragment extends ThemeFragment {
private static final String TAG = MyThemeFragment.class.getSimpleName();
@@ -85,12 +86,7 @@ public class MyThemeFragment extends ThemeFragment {
if (PreferenceUtils.hasThemeBeenUpdated(getActivity(), mBaseThemePkgName)) {
mThemeTagLayout.setUpdatedTagEnabled(true);
}
- for (String pkgName : mCurrentTheme.values()) {
- if (!pkgName.equals(mBaseThemePkgName)) {
- mThemeTagLayout.setCustomizedTagEnabled(true);
- break;
- }
- }
+ setCustomizedTagIfCustomized();
return v;
}
@@ -157,6 +153,35 @@ public class MyThemeFragment extends ThemeFragment {
mThemeResetting = true;
}
+ private void setCustomizedTagIfCustomized() {
+ boolean isDefault =
+ mBaseThemePkgName.equals(ThemeUtils.getDefaultThemePackageName(getActivity()));
+ if (isDefault) {
+ // The default theme could be a mix of the system default theme and holo so lets check
+ // that. i.e. Hexo with holo for the components not found in Hexo
+ Map<String, String> defaultComponents = ThemeUtils.getDefaultComponents(getActivity());
+ for (String component : mCurrentTheme.keySet()) {
+ String componentPkgName = mCurrentTheme.get(component);
+ if (defaultComponents.containsKey(component)) {
+ if (!componentPkgName.equals(defaultComponents.get(component))) {
+ mThemeTagLayout.setCustomizedTagEnabled(true);
+ break;
+ }
+ } else {
+ mThemeTagLayout.setCustomizedTagEnabled(true);
+ break;
+ }
+ }
+ } else {
+ for (String pkgName : mCurrentTheme.values()) {
+ if (!pkgName.equals(mBaseThemePkgName)) {
+ mThemeTagLayout.setCustomizedTagEnabled(true);
+ break;
+ }
+ }
+ }
+ }
+
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Uri uri;
diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java
index 3aafaee..cf28b1d 100644
--- a/src/com/cyngn/theme/chooser/ThemeFragment.java
+++ b/src/com/cyngn/theme/chooser/ThemeFragment.java
@@ -11,7 +11,6 @@ import android.animation.ValueAnimator;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ThemeUtils;
import android.content.res.AssetManager;