diff options
author | Clark Scheff <clark@cyngn.com> | 2014-08-22 15:44:52 -0700 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2014-08-22 17:12:02 -0700 |
commit | e4d43ffe2b1c9de0fdf85edfa5b41e25167fee30 (patch) | |
tree | 168123e8a02faf67855604d6542cfe9e822639d4 | |
parent | d8bcc2744c14279eef4075a4e896a44f236da28f (diff) | |
download | packages_apps_ThemeChooser-e4d43ffe2b1c9de0fdf85edfa5b41e25167fee30.zip packages_apps_ThemeChooser-e4d43ffe2b1c9de0fdf85edfa5b41e25167fee30.tar.gz packages_apps_ThemeChooser-e4d43ffe2b1c9de0fdf85edfa5b41e25167fee30.tar.bz2 |
Tweak animations and add extra delay when collapsing
We need to delay the runnable that sets mIsAnimating to false a
bit more so that the user cannot click on the card before it's
finished animating.
Change-Id: I967a1a8e85a540328211b405d048303d31adca3c
-rw-r--r-- | src/com/cyngn/theme/chooser/ChooserActivity.java | 13 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ThemeFragment.java | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java index 704f506..c0e1152 100644 --- a/src/com/cyngn/theme/chooser/ChooserActivity.java +++ b/src/com/cyngn/theme/chooser/ChooserActivity.java @@ -95,6 +95,10 @@ public class ChooserActivity extends FragmentActivity private static final long ANIMATE_CONTENT_IN_ALPHA_DURATION = 750; private static final long ANIMATE_CONTENT_IN_BLUR_DURATION = 250; private static final long ANIMATE_CONTENT_DELAY = 250; + private static final long ANIMATE_SHOP_THEMES_HIDE_DURATION = 250; + private static final long ANIMATE_SHOP_THEMES_SHOW_DURATION = 500; + private static final long FINISH_ANIMATION_DELAY = ThemeFragment.ANIMATE_DURATION + + ThemeFragment.ANIMATE_START_DELAY + 250; private PagerContainer mContainer; private ThemeViewPager mPager; @@ -219,6 +223,7 @@ public class ChooserActivity extends FragmentActivity private void hideShopThemesLayout() { final ViewPropertyAnimator anim = mShopThemesLayout.animate(); + anim.alpha(0f).setDuration(ANIMATE_SHOP_THEMES_HIDE_DURATION); anim.setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) {} @@ -234,14 +239,14 @@ public class ChooserActivity extends FragmentActivity @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(); + anim.alpha(1f).setStartDelay(ThemeFragment.ANIMATE_DURATION) + .setDuration(ANIMATE_SHOP_THEMES_SHOW_DURATION); } @Override @@ -271,9 +276,8 @@ public class ChooserActivity extends FragmentActivity public void run() { mIsAnimating = false; mContainer.setIsAnimating(false); - if (!mExpanded) showShopThemesLayout(); } - }, ThemeFragment.ANIMATE_START_DELAY + ThemeFragment.ANIMATE_DURATION); + }, FINISH_ANIMATION_DELAY); } private void setCustomBackground(final ImageView iv) { @@ -472,6 +476,7 @@ public class ChooserActivity extends FragmentActivity } }); } + showShopThemesLayout(); setAnimatingStateAndScheduleFinish(); } else { if (f != null && f.isShowingApplyThemeLayout()) { diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java index da96bed..607581e 100644 --- a/src/com/cyngn/theme/chooser/ThemeFragment.java +++ b/src/com/cyngn/theme/chooser/ThemeFragment.java @@ -1949,11 +1949,13 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb } public void showThemeTagLayout() { - mThemeTagLayout.animate().alpha(1f).setStartDelay(ANIMATE_DURATION).start(); + mThemeTagLayout.setVisibility(View.VISIBLE); + mThemeTagLayout.animate().alpha(1f).setStartDelay(ANIMATE_START_DELAY).start(); } public void hideThemeTagLayout() { mThemeTagLayout.setAlpha(0f); + mThemeTagLayout.setVisibility(View.GONE); } public void fadeInCards() { |