summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/activity_main.xml1
-rw-r--r--res/layout/shop_themes.xml33
-rw-r--r--res/values/colors.xml15
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/com/cyngn/theme/chooser/ChooserActivity.java61
5 files changed, 113 insertions, 0 deletions
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index 3f4bebf..99806ce 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -25,5 +25,6 @@
<include layout="@layout/component_selector"/>
<include layout="@layout/save_apply_button_2"/>
+ <include layout="@layout/shop_themes"/>
</FrameLayout>
diff --git a/res/layout/shop_themes.xml b/res/layout/shop_themes.xml
new file mode 100644
index 0000000..b86fe53
--- /dev/null
+++ b/res/layout/shop_themes.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/shop_themes_layout"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|left">
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@color/shop_themes_divider_color"/>
+
+ <TextView
+ android:id="@+id/shop_themes"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:textSize="14sp"
+ android:textColor="@color/shop_themes_text_color"
+ android:textAllCaps="true"
+ android:gravity="center"
+ android:hapticFeedbackEnabled="true"
+ android:text="@string/shop_themes"
+ android:clickable="true"
+ android:focusable="true"/>
+
+ <!-- This view will be set to gone if the device does not have a navigation bar -->
+ <Space
+ android:id="@+id/navbar_padding"
+ android:layout_width="match_parent"
+ android:layout_height="@*android:dimen/system_bar_height"/>
+</LinearLayout> \ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index cb1e8d4..038f0fb 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -15,6 +15,18 @@
* limitations under the License.
-->
<resources>
+ <color name="detailedview_pager_background">#ffffff</color>
+ <color name="title_author_background">#ffffff</color>
+ <color name="offwhite">#e9e8e8</color>
+ <color name="author_grey">#808184</color>
+
+ <color name="apply_button_text_color_enabled">#ffffff</color>
+ <color name="apply_button_text_color_disabled">#bbbbbb</color>
+
+ <color name="apply_button_progress_color">#6bd1e9</color>
+ <color name="apply_button_default_color">#00b1e5</color>
+ <color name="apply_button_pressed_color">#008ef2</color>
+
<color name="font_preview_color">#ffffff</color>
<color name="font_preview_shadow_color">#dd000000</color>
@@ -35,4 +47,7 @@
<color name="wallpaper_label">#ffffff</color>
<color name="audible_name_color">#999999</color>
+ <color name="shop_themes_text_color">#01579b</color>
+ <color name="shop_themes_divider_color">#b8b8b8</color>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d3d0600..e9a8b1c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -51,4 +51,7 @@
<string name="menu_author_info">Author</string>
<string name="menu_delete">Delete</string>
+ <string name="shop_themes">Shop themes</string>
+ <string name="themes_showcase_link">https://play.google.com/store/apps/details?id=com.cyngn.theme.store</string>
+
</resources>
diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java
index 1c375de..03d6aa5 100644
--- a/src/com/cyngn/theme/chooser/ChooserActivity.java
+++ b/src/com/cyngn/theme/chooser/ChooserActivity.java
@@ -15,6 +15,8 @@
*/
package com.cyngn.theme.chooser;
+import android.animation.Animator;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -39,6 +41,7 @@ import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
+import android.view.ViewPropertyAnimator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
@@ -55,6 +58,8 @@ import static android.provider.ThemesContract.ThemesColumns.MODIFIES_RINGTONES;
public class ChooserActivity extends FragmentActivity
implements LoaderManager.LoaderCallbacks<Cursor>, ThemeManager.ThemeChangeListener {
+ private static final String TAG = ChooserActivity.class.getSimpleName();
+
public static final String DEFAULT = ThemeConfig.HOLO_DEFAULT;
public static final int REQUEST_UNINSTALL = 1; // Request code
public static final String EXTRA_PKGNAME = "pkgName";
@@ -66,6 +71,9 @@ 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.theme.store";
+ private static final String THEME_STORE_ACTIVITY = "com.cyngn.theme.store.StoreActivity";
+
private PagerContainer mContainer;
private ThemeViewPager mPager;
@@ -78,6 +86,7 @@ public class ChooserActivity extends FragmentActivity
private TypefaceHelperCache mTypefaceHelperCache;
private boolean mIsAnimating;
private Handler mHandler;
+ private View mShopThemesLayout;
private String mSelectedTheme;
@@ -124,9 +133,12 @@ public class ChooserActivity extends FragmentActivity
mService = (ThemeManager) getSystemService(Context.THEME_SERVICE);
getSupportLoaderManager().restartLoader(LOADER_ID_APPLIED, null, this);
+ mShopThemesLayout = findViewById(R.id.shop_themes_layout);
+
mSaveApplyLayout = findViewById(R.id.save_apply_layout);
if (!Utils.hasNavigationBar(this)) {
mSaveApplyLayout.findViewById(R.id.navbar_padding).setVisibility(View.GONE);
+ mShopThemesLayout.findViewById(R.id.navbar_padding).setVisibility(View.GONE);
}
mSaveApplyLayout.findViewById(R.id.save_apply_button).setOnClickListener(
new View.OnClickListener() {
@@ -146,6 +158,9 @@ public class ChooserActivity extends FragmentActivity
setAnimatingStateAndScheduleFinish();
}
});
+
+ mShopThemesLayout.findViewById(R.id.shop_themes).setOnClickListener(mOnShopThemesClicked);
+
mTypefaceHelperCache = TypefaceHelperCache.getInstance();
mHandler = new Handler();
}
@@ -169,6 +184,33 @@ public class ChooserActivity extends FragmentActivity
});
}
+ private void hideShopThemesLayout() {
+ final ViewPropertyAnimator anim = mShopThemesLayout.animate();
+ anim.setListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {}
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mShopThemesLayout.setVisibility(View.GONE);
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {}
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {}
+ });
+ anim.alpha(0f).start();
+ }
+
+ private void showShopThemesLayout() {
+ mShopThemesLayout.setVisibility(View.VISIBLE);
+ final ViewPropertyAnimator anim = mShopThemesLayout.animate();
+ anim.setListener(null);
+ anim.alpha(1f).start();
+ }
+
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@@ -190,6 +232,7 @@ public class ChooserActivity extends FragmentActivity
public void run() {
mIsAnimating = false;
mContainer.setIsAnimating(false);
+ if (!mExpanded) showShopThemesLayout();
}
}, ThemeFragment.ANIMATE_START_DELAY + ThemeFragment.ANIMATE_DURATION);
}
@@ -340,6 +383,7 @@ public class ChooserActivity extends FragmentActivity
ThemeFragment f = getCurrentFragment();
f.expand();
setAnimatingStateAndScheduleFinish();
+ hideShopThemesLayout();
}
}
};
@@ -378,6 +422,23 @@ public class ChooserActivity extends FragmentActivity
}
}
+ private View.OnClickListener mOnShopThemesClicked = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent();
+ intent.setClassName(THEME_STORE_PACKAGE, THEME_STORE_ACTIVITY);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ // Unable to launch the theme store so link the user to it
+ intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse(getString(R.string.themes_showcase_link)));
+ startActivity(intent);
+ }
+ }
+ };
+
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
switch (loader.getId()) {