summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-03-10 09:50:45 -0700
committerGerrit Code Review <gerrit@cyngn.com>2015-03-11 15:40:56 +0000
commitb343731b5d5816bc4be98f289d7198d6210a3f2f (patch)
treefe29e737d3a49729a921ffcc4e080ef3b200f3f2 /src
parenta24e485aec11a109ba6d02941cf3955268941bc6 (diff)
downloadpackages_apps_ThemeChooser-b343731b5d5816bc4be98f289d7198d6210a3f2f.zip
packages_apps_ThemeChooser-b343731b5d5816bc4be98f289d7198d6210a3f2f.tar.gz
packages_apps_ThemeChooser-b343731b5d5816bc4be98f289d7198d6210a3f2f.tar.bz2
Send broadcast when theme chooser opened and theme removed
This introduces two new actions that will be broadcasted to the store, or any app that is granted the com.cyngn.themes.permission.THEMES_APP permission, which requires the same signature as the Theme Chooser. If a theme is uninstalled from the chooser, a broadcast is sent along with a String extra with the key "package" that identifies the package name of the theme being removed. Change-Id: I6b3f4e19ebb1b8d763d7e0038591fccbbe1809f2
Diffstat (limited to 'src')
-rw-r--r--src/com/cyngn/theme/chooser/ChooserActivity.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java
index 6a82c70..81ec1e2 100644
--- a/src/com/cyngn/theme/chooser/ChooserActivity.java
+++ b/src/com/cyngn/theme/chooser/ChooserActivity.java
@@ -87,6 +87,14 @@ public class ChooserActivity extends FragmentActivity
private static final String TYPE_IMAGE = "image/*";
+ private static final String CYNGN_THEMES_PERMISSION =
+ "com.cyngn.themes.permission.THEMES_APP";
+ private static final String ACTION_CHOOSER_OPENED =
+ "com.cyngn.themes.action.CHOOSER_OPENED";
+ private static final String ACTION_THEME_REMOVED =
+ "com.cyngn.themes.action.THEME_REMOVED_FROM_CHOOSER";
+ private static final String EXTRA_PACKAGE = "package";
+
/**
* Request code for picking an external wallpaper
*/
@@ -555,6 +563,7 @@ public class ChooserActivity extends FragmentActivity
public void uninstallTheme(String pkgName) {
PackageManager pm = getPackageManager();
pm.deletePackage(pkgName, new PackageDeleteObserver(), PackageManager.DELETE_ALL_USERS);
+ sendThemeRemovedBroadcast(pkgName);
}
private void slideContentIntoView(int yDelta, int selectorHeight) {
@@ -649,6 +658,7 @@ public class ChooserActivity extends FragmentActivity
if (mTypefaceHelperCache.getTypefaceCount() <= 0) {
new TypefacePreloadTask().execute();
}
+ sendChooserOpenedBroadcast();
mAnimateContentInDelay = ANIMATE_CONTENT_DELAY;
}
@@ -675,6 +685,16 @@ public class ChooserActivity extends FragmentActivity
}
}
+ private void sendChooserOpenedBroadcast() {
+ sendBroadcast(new Intent(ACTION_CHOOSER_OPENED), CYNGN_THEMES_PERMISSION);
+ }
+
+ private void sendThemeRemovedBroadcast(String pkgName) {
+ Intent intent = new Intent(ACTION_THEME_REMOVED);
+ intent.putExtra(EXTRA_PACKAGE, pkgName);
+ sendBroadcast(intent, CYNGN_THEMES_PERMISSION);
+ }
+
private void animateContentIn() {
Drawable d = mCustomBackground.getDrawable();
if (d instanceof TransitionDrawable) {