diff options
author | Clark Scheff <clark@cyngn.com> | 2014-08-20 18:31:58 -0700 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2014-08-21 11:06:36 -0700 |
commit | 87319d96b6843d07e746799fa17bbf639b723b1a (patch) | |
tree | 90ea7e774d48cc402a97cfe25e75913338f9ee96 | |
parent | 1f495a6d2022eed978b5b507bfd543361021423f (diff) | |
download | packages_apps_ThemeChooser-87319d96b6843d07e746799fa17bbf639b723b1a.zip packages_apps_ThemeChooser-87319d96b6843d07e746799fa17bbf639b723b1a.tar.gz packages_apps_ThemeChooser-87319d96b6843d07e746799fa17bbf639b723b1a.tar.bz2 |
Animate cards in when activity starts.
Change-Id: Idd7e0d98e1f0965dbada15fcba9ad09fb94b1b86
-rw-r--r-- | res/layout/activity_main.xml | 6 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ChooserActivity.java | 16 |
2 files changed, 18 insertions, 4 deletions
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml index 5caa8da..18454cf 100644 --- a/res/layout/activity_main.xml +++ b/res/layout/activity_main.xml @@ -2,8 +2,7 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/bg_grid"> + android:layout_height="match_parent"> <ImageView android:id="@+id/custom_bg" android:layout_width="match_parent" @@ -18,7 +17,8 @@ android:id="@+id/pager_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical"> + android:layout_gravity="center_vertical" + android:alpha="0"> <android.support.v4.view.ThemeViewPager android:id="@+id/viewpager" android:layout_width="@dimen/theme_fragment_width" diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java index a692f6d..e6d1fd7 100644 --- a/src/com/cyngn/theme/chooser/ChooserActivity.java +++ b/src/com/cyngn/theme/chooser/ChooserActivity.java @@ -86,6 +86,8 @@ public class ChooserActivity extends FragmentActivity private static final String THEME_STORE_PACKAGE = "com.cyngn.theme.store"; private static final String THEME_STORE_ACTIVITY = "com.cyngn.theme.store.StoreActivity"; + private static final long ANIMATE_CONTENT_IN_DURATION = 500; + private PagerContainer mContainer; private ThemeViewPager mPager; @@ -103,6 +105,7 @@ public class ChooserActivity extends FragmentActivity private String mSelectedTheme; private String mAppliedBaseTheme; private boolean mThemeChanging = false; + private boolean mAnimateContentIn = false; ImageView mCustomBackground; @@ -180,6 +183,7 @@ public class ChooserActivity extends FragmentActivity mTypefaceHelperCache = TypefaceHelperCache.getInstance(); mHandler = new Handler(); mCustomBackground = (ImageView) findViewById(R.id.custom_bg); + mAnimateContentIn = true; } public void hideSaveApplyButton() { @@ -460,6 +464,15 @@ public class ChooserActivity extends FragmentActivity } } + private void animateContentIn() { + mContainer.setScaleX(1.5f); + mContainer.setScaleY(1.5f); + mContainer.setAlpha(0f); + mContainer.animate().alpha(1f).scaleX(1f).scaleY(1f) + .setDuration(ANIMATE_CONTENT_IN_DURATION).start(); + mAnimateContentIn = false; + } + private View.OnClickListener mPagerClickListener = new View.OnClickListener() { @Override public void onClick(View v) { @@ -553,8 +566,9 @@ public class ChooserActivity extends FragmentActivity mAdapter.swapCursor(data); mAdapter.notifyDataSetChanged(); if (selectedThemeIndex >= 0) { - mPager.setCurrentItem(selectedThemeIndex, true); + mPager.setCurrentItem(selectedThemeIndex, false); } + if (mAnimateContentIn) animateContentIn(); break; case LOADER_ID_APPLIED: getSupportLoaderManager().restartLoader(LOADER_ID_INSTALLED_THEMES, null, this); |