diff options
author | Brint E. Kriebel <bekit@cyngn.com> | 2014-07-27 23:44:50 -0700 |
---|---|---|
committer | Brint E. Kriebel <bekit@cyngn.com> | 2014-07-27 23:44:50 -0700 |
commit | 3a8b0d1319772ec9c33029af33968961150101d0 (patch) | |
tree | 4a8182fc8dd98cc7287f63121b52273eecc0af83 | |
parent | 2fffcd05009281ecfd7227f2655ca161038a5988 (diff) | |
parent | 4c484f81f2f35323cc46d39c750fa908ded5bd36 (diff) | |
download | android_packages_providers_ThemesProvider-3a8b0d1319772ec9c33029af33968961150101d0.tar.gz android_packages_providers_ThemesProvider-3a8b0d1319772ec9c33029af33968961150101d0.tar.bz2 android_packages_providers_ThemesProvider-3a8b0d1319772ec9c33029af33968961150101d0.zip |
Merge branch 'cm-11.0' into stable/cm-11.0
-rw-r--r-- | res/values-eu/strings.xml | 21 | ||||
-rw-r--r-- | res/values-ko/strings.xml | 21 | ||||
-rw-r--r-- | res/values-ku/strings.xml | 21 | ||||
-rw-r--r-- | src/org/cyanogenmod/themes/provider/ThemePackageHelper.java | 32 | ||||
-rw-r--r-- | src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java | 6 | ||||
-rw-r--r-- | src/org/cyanogenmod/themes/provider/ThemesProvider.java | 2 |
6 files changed, 86 insertions, 17 deletions
diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml new file mode 100644 index 0000000..6c4c557 --- /dev/null +++ b/res/values-eu/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string name="app_name">Gaien hornitzailea</string> + <string name="unknown_app_name">Ezezaguna</string> +</resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml new file mode 100644 index 0000000..c8367aa --- /dev/null +++ b/res/values-ko/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string name="app_name">테마 공급자</string> + <string name="unknown_app_name">알 수 없음</string> +</resources> diff --git a/res/values-ku/strings.xml b/res/values-ku/strings.xml new file mode 100644 index 0000000..405d50d --- /dev/null +++ b/res/values-ku/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string name="app_name">دابینکردنی تیمی</string> + <string name="unknown_app_name">نەناسراو</string> +</resources> diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java index f71ab31..feb4647 100644 --- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java @@ -24,6 +24,8 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ThemeInfo; import android.content.pm.ThemeUtils; import android.content.res.AssetManager; +import android.content.res.Configuration; +import android.content.res.ThemeConfig; import android.content.res.ThemeManager; import android.database.Cursor; import android.provider.ThemesContract; @@ -39,7 +41,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import static android.content.res.CustomTheme.HOLO_DEFAULT; +import static android.content.res.ThemeConfig.HOLO_DEFAULT; /** * Helper class to populate the provider with info from the theme. @@ -350,20 +352,24 @@ public class ThemePackageHelper { } private static void reapplyInstalledComponentsForTheme(Context context, String pkgName) { + Configuration config = context.getResources().getConfiguration(); + if (config == null || config.themeConfig == null) return; + 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); - } + // Other packages such as wallpaper can be changed outside of themes + // and are not tracked well by the provider. We only care to apply resources that may crash + // the system if they are not reapplied. + ThemeConfig themeConfig = config.themeConfig; + if (pkgName.equals(themeConfig.getFontPkgName())) { + reApply.add(ThemesColumns.MODIFIES_FONTS); + } + if (pkgName.equals(themeConfig.getIconPackPkgName())) { + reApply.add(ThemesColumns.MODIFIES_ICONS); } + if (pkgName.equals(themeConfig.getOverlayPkgName())) { + reApply.add(ThemesColumns.MODIFIES_OVERLAYS); + } + ThemeManager manager = (ThemeManager) context.getSystemService(Context.THEME_SERVICE); manager.requestThemeChange(pkgName, reApply); } diff --git a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java index 6a0f54a..458deae 100644 --- a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java +++ b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java @@ -18,7 +18,7 @@ package org.cyanogenmod.themes.provider; import android.content.ContentValues; import android.content.Context; import android.content.pm.ThemeUtils; -import android.content.res.CustomTheme; +import android.content.res.ThemeConfig; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; @@ -32,7 +32,7 @@ public class ThemesOpenHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 5; private static final String DATABASE_NAME = "themes.db"; - private static final String DEFAULT_PKG_NAME = CustomTheme.HOLO_DEFAULT; + private static final String DEFAULT_PKG_NAME = ThemeConfig.HOLO_DEFAULT; private Context mContext; @@ -221,7 +221,7 @@ public class ThemesOpenHelper extends SQLiteOpenHelper { private static boolean isHoloDefault(Context context) { // == is okay since we are checking if what is returned is the same constant string value - return CustomTheme.HOLO_DEFAULT == ThemeUtils.getDefaultThemePackageName(context); + return ThemeConfig.HOLO_DEFAULT == ThemeUtils.getDefaultThemePackageName(context); } } diff --git a/src/org/cyanogenmod/themes/provider/ThemesProvider.java b/src/org/cyanogenmod/themes/provider/ThemesProvider.java index ba50d72..24c79bf 100644 --- a/src/org/cyanogenmod/themes/provider/ThemesProvider.java +++ b/src/org/cyanogenmod/themes/provider/ThemesProvider.java @@ -48,7 +48,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import static android.content.res.CustomTheme.HOLO_DEFAULT; +import static android.content.res.ThemeConfig.HOLO_DEFAULT; public class ThemesProvider extends ContentProvider { private static final String TAG = ThemesProvider.class.getSimpleName(); |