summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-03-03 11:27:51 -0800
committerClark Scheff <clark@cyngn.com>2015-03-03 21:36:25 +0000
commitcebe7499dae7fc3e94f4b837d78ede6f350f592d (patch)
tree8ea6f1e23440d1ba8e4af2ea1500fc38af67916d /src
parentd56651ee27f618762440fa0efe5b16c137814854 (diff)
downloadandroid_packages_providers_ThemesProvider-cebe7499dae7fc3e94f4b837d78ede6f350f592d.zip
android_packages_providers_ThemesProvider-cebe7499dae7fc3e94f4b837d78ede6f350f592d.tar.gz
android_packages_providers_ThemesProvider-cebe7499dae7fc3e94f4b837d78ede6f350f592d.tar.bz2
Themes: Add RequestType to ThemeChangeRequest [2/3]
Change-Id: Id33b96b9bbf720522cecd65541098eb75dc6b315
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java3
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemesProvider.java17
2 files changed, 15 insertions, 5 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index 254e658..69f5ab2 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -26,6 +26,7 @@ import android.content.pm.ThemeUtils;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.ThemeChangeRequest;
+import android.content.res.ThemeChangeRequest.RequestType;
import android.content.res.ThemeConfig;
import android.content.res.ThemeManager;
import android.database.Cursor;
@@ -244,6 +245,7 @@ public class ThemePackageHelper {
}
mixnmatch.close();
+ builder.setRequestType(RequestType.THEME_REMOVED);
ThemeManager manager = (ThemeManager) context.getSystemService(Context.THEME_SERVICE);
manager.requestThemeChange(builder.build(), false);
@@ -359,6 +361,7 @@ public class ThemePackageHelper {
}
}
+ builder.setRequestType(RequestType.THEME_UPDATED);
ThemeManager manager = (ThemeManager) context.getSystemService(Context.THEME_SERVICE);
manager.requestThemeChange(builder.build(), false);
}
diff --git a/src/org/cyanogenmod/themes/provider/ThemesProvider.java b/src/org/cyanogenmod/themes/provider/ThemesProvider.java
index ae0a5af..92af9da 100644
--- a/src/org/cyanogenmod/themes/provider/ThemesProvider.java
+++ b/src/org/cyanogenmod/themes/provider/ThemesProvider.java
@@ -27,6 +27,8 @@ import android.content.UriMatcher;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ThemeUtils;
+import android.content.res.ThemeChangeRequest;
+import android.content.res.ThemeChangeRequest.RequestType;
import android.content.res.ThemeManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@@ -535,7 +537,7 @@ public class ThemesProvider extends ContentProvider {
// Check currently applied components (fonts, wallpapers etc) and verify the theme is
// still installed. If it is not installed, set the component back to the default theme
- List<String> moveToDefault = new LinkedList<String>();
+ ThemeChangeRequest.Builder builder = new ThemeChangeRequest.Builder();
Cursor mixnmatch = mDb.query(MixnMatchTable.TABLE_NAME, null, null, null, null, null,
null);
while (mixnmatch.moveToNext()) {
@@ -547,13 +549,18 @@ public class ThemesProvider extends ContentProvider {
String pkg = mixnmatch.getString(mixnmatch
.getColumnIndex(MixnMatchColumns.COL_VALUE));
if (deleteList.contains(pkg)) {
- moveToDefault.add(component);
+ builder.setComponent(component, SYSTEM_DEFAULT);
}
}
mixnmatch.close();
- ThemeManager mService = (ThemeManager) getContext().getSystemService(
- Context.THEME_SERVICE);
- mService.requestThemeChange(SYSTEM_DEFAULT, moveToDefault);
+
+ builder.setRequestType(RequestType.THEME_REMOVED);
+ ThemeChangeRequest request = builder.build();
+ if (request.getNumChangesRequested() > 0) {
+ ThemeManager mService = (ThemeManager) getContext().getSystemService(
+ Context.THEME_SERVICE);
+ mService.requestThemeChange(request, false);
+ }
// Update the database after we revert to default
deleteThemes(deleteList);