summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAndy Mast <andy@cyngn.com>2014-11-13 13:53:09 -0800
committerGerrit Code Review <gerrit@cyngn.com>2014-11-17 18:43:36 +0000
commita87d00b5b7ba3a8eaa48ba15e63d3ae5dd241889 (patch)
tree909c5a44b8615195a32bdff912b6949abd4b6232 /src/com
parent94daceb616475986efd168ad8082a0ee7886e5c9 (diff)
downloadpackages_apps_ThemeChooser-a87d00b5b7ba3a8eaa48ba15e63d3ae5dd241889.tar.gz
packages_apps_ThemeChooser-a87d00b5b7ba3a8eaa48ba15e63d3ae5dd241889.tar.bz2
packages_apps_ThemeChooser-a87d00b5b7ba3a8eaa48ba15e63d3ae5dd241889.zip
Fix task behavior for ThemeStore/Chooser [1/3]
1. Launcher OverviewSettingsPanel -> Themes: Launch Chooser, do not show in recents 1.1. From chooser, if user clicks "Shop Themes", Store should open in a new task and launching chooser again from store shoul 2. Settings -> Themes: Launch Chooser, do not show in recents 3. Launcher Appdrawer -> Themes: Launch Theme Store, show in recents 4. In the case of #1 and #2, if the user proceeds to launch the store via "Shop Themes" then the store should open in a new task and be included in recents. 5. Do not show "Shop themes" when chooser is launched from the store. This avoids a navigation cycle. SEE ALSO: Settings & Trebuchet Change-Id: I597cf81f89494ccce46e1b2496ae16a4d93ac707
Diffstat (limited to 'src/com')
-rw-r--r--src/com/cyngn/theme/chooser/ChooserActivity.java13
-rw-r--r--src/com/cyngn/theme/util/Utils.java25
2 files changed, 35 insertions, 3 deletions
diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java
index cb89f31..7cc11c0 100644
--- a/src/com/cyngn/theme/chooser/ChooserActivity.java
+++ b/src/com/cyngn/theme/chooser/ChooserActivity.java
@@ -67,6 +67,7 @@ import static android.provider.ThemesContract.ThemesColumns.MODIFIES_RINGTONES;
public class ChooserActivity extends FragmentActivity
implements LoaderManager.LoaderCallbacks<Cursor> {
+ public static final String THEME_STORE_PACKAGE = "com.cyngn.themestore";
private static final String TAG = ChooserActivity.class.getSimpleName();
public static final String DEFAULT = ThemeConfig.HOLO_DEFAULT;
@@ -77,7 +78,7 @@ public class ChooserActivity extends FragmentActivity
private static final int LOADER_ID_INSTALLED_THEMES = 1000;
private static final int LOADER_ID_APPLIED = 1001;
- private static final String THEME_STORE_PACKAGE = "com.cyngn.themestore";
+
private static final String THEME_STORE_ACTIVITY = THEME_STORE_PACKAGE + ".ui.StoreActivity";
private static final String ACTION_APPLY_THEME = "android.intent.action.APPLY_THEME";
private static final String PERMISSION_WRITE_THEME = "android.permission.WRITE_THEMES";
@@ -121,6 +122,7 @@ public class ChooserActivity extends FragmentActivity
private boolean mAnimateContentIn = false;
private long mAnimateContentInDelay;
private boolean mApplyOnThemeLoaded;
+ private boolean mAlwaysHideShopThemes;
ImageView mCustomBackground;
@@ -189,6 +191,11 @@ public class ChooserActivity extends FragmentActivity
mCustomBackground = (ImageView) findViewById(R.id.custom_bg);
mAnimateContentIn = true;
mAnimateContentInDelay = 0;
+
+ if (Utils.isRecentTaskThemeStore(this)) {
+ mAlwaysHideShopThemes = true;
+ mShopThemesLayout.setVisibility(View.GONE);
+ }
}
public void hideSaveApplyButton() {
@@ -302,9 +309,9 @@ public class ChooserActivity extends FragmentActivity
}
}
}, FINISH_ANIMATION_DELAY);
- if (mExpanded) {
+ if (mExpanded && !mAlwaysHideShopThemes) {
hideShopThemesLayout();
- } else {
+ } else if (!mAlwaysHideShopThemes) {
showShopThemesLayout();
}
}
diff --git a/src/com/cyngn/theme/util/Utils.java b/src/com/cyngn/theme/util/Utils.java
index 94fb5df..d7b3e89 100644
--- a/src/com/cyngn/theme/util/Utils.java
+++ b/src/com/cyngn/theme/util/Utils.java
@@ -24,6 +24,8 @@ import android.util.TypedValue;
import android.view.ViewConfiguration;
import android.view.WindowManager;
+import com.cyngn.theme.chooser.ChooserActivity;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -399,6 +401,29 @@ public class Utils {
return false;
}
+ public static boolean isRecentTaskThemeStore(Context context) {
+ final ActivityManager am =
+ (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+
+ final List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(
+ 2, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
+ if (recentTasks.size() > 0) {
+ ActivityManager.RecentTaskInfo recentInfo = recentTasks.get(0);
+
+ Intent intent = new Intent(recentInfo.baseIntent);
+ if (recentInfo.origActivity != null) {
+ intent.setComponent(recentInfo.origActivity);
+ }
+
+ if (intent.getComponent()
+ .getPackageName().equals(ChooserActivity.THEME_STORE_PACKAGE)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
private static boolean isCurrentHomeActivity(Context context,
ComponentName component) {
final PackageManager pm = context.getPackageManager();