List of usage examples for android.view.animation Animation start
public void start()
From source file:com.hybris.mobile.app.commerce.utils.UIUtils.java
/** * Animate the layout to expand//from w ww .j a va 2 s .c o m */ public static void expandLayout(Context context, View view) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.expand); view.setAnimation(animation); view.animate(); animation.start(); }
From source file:com.hybris.mobile.app.commerce.utils.UIUtils.java
/** * Animate the layout to collapse/*from ww w . j a v a 2 s .c o m*/ */ public static void collapseLayout(Context context, View view) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.collapse); view.setAnimation(animation); view.animate(); animation.start(); }
From source file:Main.java
/** * Applies a fade in animation and set the visibility in * {@link View#VISIBLE}./*from www . ja va 2 s . c o m*/ * @param view view to animate. */ public static void fadeInView(final View view) { if (view.getVisibility() != View.VISIBLE) { cancelAnimation(view); view.setVisibility(View.VISIBLE); Animation animation = android.view.animation.AnimationUtils.loadAnimation(view.getContext(), android.R.anim.fade_in); animation.setFillEnabled(true); animation.setFillBefore(true); animation.setFillAfter(true); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.clearAnimation(); } @Override public void onAnimationRepeat(Animation animation) { } }); view.setAnimation(animation); animation.start(); } }
From source file:Main.java
/** * Applies a fade out animation and set the visibility in * {@link View#GONE}.//from w w w. j a v a 2 s .co m * @param view view to animate. */ public static void fadeOutView(final View view) { if (view.getVisibility() == View.VISIBLE) { cancelAnimation(view); Animation animation = android.view.animation.AnimationUtils.loadAnimation(view.getContext(), android.R.anim.fade_out); animation.setFillEnabled(true); animation.setFillBefore(true); animation.setFillAfter(true); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.GONE); view.clearAnimation(); } @Override public void onAnimationRepeat(Animation animation) { } }); view.setAnimation(animation); animation.start(); } }
From source file:net.soulwolf.widget.parallaxrefresh.BaseParallaxHolder.java
@Override public void onRollback() { if (ViewCompat.getTranslationY(mContentView) > 0) { Animation animation = ObjectAnimator.ofTranslationY(mContentView, 0); animation.setDuration(ROLLBACK_DURATION); animation.setInterpolator(ROLLBACK_INTERPOLATOR); animation.start(); }//from w w w.j av a 2s . co m }
From source file:org.huxizhijian.hhcomicviewer.ui.entry.GalleryActivity.java
@Override public void openMenu() { //?/* w w w .java2s . c o m*/ Animation animation = AnimationUtils.loadAnimation(this, R.anim.menu_show_action); mMenu.clearAnimation(); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mMenu.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mMenu.setAnimation(animation); animation.start(); mIsMenuOpen = true; }
From source file:org.huxizhijian.hhcomicviewer.ui.entry.GalleryActivity.java
@Override public void closeMenu() { ///*ww w . ja va2 s . com*/ Animation animation = AnimationUtils.loadAnimation(GalleryActivity.this, R.anim.menu_hide_action); mMenu.clearAnimation(); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mMenu.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); mMenu.setAnimation(animation); animation.start(); mIsMenuOpen = false; }
From source file:org.huxizhijian.hhcomicviewer.ui.entry.GalleryActivity.java
@Override public void onBackPressed() { //override//from ww w.j a v a2s . com if (mIsMenuOpen) { Animation animation = AnimationUtils.loadAnimation(GalleryActivity.this, R.anim.menu_hide_action); mMenu.clearAnimation(); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mMenu.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); mMenu.setAnimation(animation); animation.start(); mIsMenuOpen = false; } else { mComic.setReadChapter(mChapterPosition); mComic.setReadPage(mViewPager.getCurrentItem()); Intent intent = new Intent(); intent.putExtra("comic", mComic); setResult(0, intent); finish(); } }
From source file:org.fs.publication.views.ReadActivity.java
@Override public void showNavigation() { clearAnimations();/*from w w w. j a va2s.c o m*/ // toolbar Animation showToolbarAnim = AnimationUtils.loadAnimation(getContext(), R.anim.top_in); showToolbarAnim.setDuration(300L); showToolbarAnim.setInterpolator(new FancyInterpolator()); showToolbarAnim.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationStart(Animation animation) { if (isAvailable()) { toolbar.setVisibility(View.VISIBLE); } } }); toolbar.setAnimation(showToolbarAnim); // navigation Animation showMenuAnim = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_in); showMenuAnim.setDuration(300L); showMenuAnim.setInterpolator(new FancyInterpolator()); showMenuAnim.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationStart(Animation animation) { if (isAvailable()) { layout.setVisibility(View.VISIBLE); } } }); layout.setAnimation(showMenuAnim); // start showToolbarAnim.start(); showMenuAnim.start(); }
From source file:org.fs.publication.views.ReadActivity.java
@Override public void hideNavigation() { clearAnimations();/*from ww w . j a v a 2s . c o m*/ // toolbar Animation hideToolbarAnim = AnimationUtils.loadAnimation(getContext(), R.anim.top_out); hideToolbarAnim.setDuration(300L); hideToolbarAnim.setInterpolator(new FancyInterpolator()); hideToolbarAnim.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationEnd(Animation animation) { if (isAvailable()) { toolbar.setVisibility(View.INVISIBLE); } } }); toolbar.setAnimation(hideToolbarAnim); // navigation Animation hideMenuAnim = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_out); hideMenuAnim.setDuration(300L); hideMenuAnim.setInterpolator(new FancyInterpolator()); hideMenuAnim.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationEnd(Animation animation) { if (isAvailable()) { layout.setVisibility(View.INVISIBLE); } } }); layout.setAnimation(hideMenuAnim); // start hideToolbarAnim.start(); hideMenuAnim.start(); }