summaryrefslogtreecommitdiffstats
path: root/src/com/cyngn
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/cyngn')
-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();