Java Code Examples for android.view.animation.Animation#reset()

The following examples show how to use android.view.animation.Animation#reset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewUtil.java    From Tok-Android with GNU General Public License v3.0 5 votes vote down vote up
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
    if (view.getVisibility() == View.VISIBLE) {
        return;
    }

    view.clearAnimation();
    animation.reset();
    animation.setStartTime(0);
    view.setVisibility(View.VISIBLE);
    view.startAnimation(animation);
}
 
Example 2
Source File: ViewUtil.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
  if (view.getVisibility() == View.VISIBLE) return;

  view.clearAnimation();
  animation.reset();
  animation.setStartTime(0);
  view.setVisibility(View.VISIBLE);
  view.startAnimation(animation);
}
 
Example 3
Source File: ViewUtil.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
  if (view.getVisibility() == View.VISIBLE) return;

  view.clearAnimation();
  animation.reset();
  animation.setStartTime(0);
  view.setVisibility(View.VISIBLE);
  view.startAnimation(animation);
}
 
Example 4
Source File: PullToRefreshView.java    From Taurus with Apache License 2.0 5 votes vote down vote up
private void animateOffsetToPosition(Animation animation) {
    mFrom = mCurrentOffsetTop;
    mFromDragPercent = mCurrentDragPercent;
    long animationDuration = (long) Math.abs(MAX_OFFSET_ANIMATION_DURATION * mFromDragPercent);

    animation.reset();
    animation.setDuration(animationDuration);
    animation.setInterpolator(mDecelerateInterpolator);
    animation.setAnimationListener(mToStartListener);
    mRefreshImageView.clearAnimation();
    mRefreshImageView.startAnimation(animation);
}
 
Example 5
Source File: ViewUtil.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
  if (view.getVisibility() == View.VISIBLE) return;

  view.clearAnimation();
  animation.reset();
  animation.setStartTime(0);
  view.setVisibility(View.VISIBLE);
  view.startAnimation(animation);
}
 
Example 6
Source File: ChandelierLayout.java    From Chandelier with MIT License 5 votes vote down vote up
/**
 * Show the actions of the {@link ChandelierLayout}
 */
public void showActions() {
  isShowingAction = true;
  final Animation showAnimation = new Animation() {
    @Override protected void applyTransformation(float interpolatedTime, Transformation t) {
      moveActionLayout(-interpolatedTime * originalOffsetTop);
    }
  };
  showAnimation.reset();
  showAnimation.setDuration(200);
  startAnimation(showAnimation);
}
 
Example 7
Source File: ChandelierLayout.java    From Chandelier with MIT License 5 votes vote down vote up
/**
 * Hide the actions of the {@link ChandelierLayout}
 */
public void hideActions() {
  isShowingAction = false;
  final float top = ViewCompat.getTranslationY(ornamentLayout);
  final Animation hideAnimation = new Animation() {
    @Override protected void applyTransformation(float interpolatedTime, Transformation t) {
      moveActionLayout((1 - interpolatedTime) * top);
    }
  };
  hideAnimation.reset();
  hideAnimation.setDuration(200);
  startAnimation(hideAnimation);
}
 
Example 8
Source File: SplashActivity.java    From android-spotify-demo with MIT License 4 votes vote down vote up
private void StartAnimations(){
    Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
    anim.reset();
    LinearLayout l = (LinearLayout)findViewById(R.id.lin_lay);
    l.clearAnimation();
    l.startAnimation(anim);

    anim = AnimationUtils.loadAnimation(this, R.anim.translate);
    anim.reset();
    ImageView iv = (ImageView)findViewById(R.id.splash);
    iv.clearAnimation();
    iv.startAnimation(anim);

    Thread splashTread = new Thread() {
        @Override
        public void run() {
            try {
                int waited = 0;
                // Splash screen pause time
                while (waited < 2500) {
                    sleep(100);
                    waited += 100;
                }

                Intent intent = new Intent(SplashActivity.this,
                        SpotifyLoginActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

                startActivity(intent);
                overridePendingTransition(R.anim.pull_up_from_bottom, R.anim.hold);

                SplashActivity.this.finish();
            } catch (InterruptedException e) {
                // do nothing
            } finally {
                SplashActivity.this.finish();
            }

        }
    };
    splashTread.start();
}