Example usage for android.view.animation Animation reset

List of usage examples for android.view.animation Animation reset

Introduction

In this page you can find the example usage for android.view.animation Animation reset.

Prototype

public void reset() 

Source Link

Document

Reset the initialization state of this animation.

Usage

From source file:Main.java

/**
 * Cancel any previous animation.// w  ww  . j  av  a2  s.c om
 * @param view the view.
 */
public static void cancelAnimation(View view) {
    Animation animation = view.getAnimation();
    if (animation != null) {
        animation.reset();
        animation.cancel();
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        view.animate().cancel();
    }
    view.clearAnimation();
}

From source file:org.smssecure.smssecure.util.ViewUtil.java

public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
    if (view.getVisibility() == View.VISIBLE)
        return;//from w ww . j  a  v  a  2  s  . co m

    view.clearAnimation();
    animation.reset();
    animation.setStartTime(0);
    view.setVisibility(View.VISIBLE);
    view.startAnimation(animation);
}

From source file:org.smssecure.smssecure.util.ViewUtil.java

public static ListenableFuture<Boolean> animateOut(final @NonNull View view, final @NonNull Animation animation,
        final int visibility) {
    final SettableFuture future = new SettableFuture();
    if (view.getVisibility() == visibility) {
        future.set(true);/* w  ww . jav a2  s. c o m*/
    } else {
        view.clearAnimation();
        animation.reset();
        animation.setStartTime(0);
        animation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                view.setVisibility(visibility);
                future.set(true);
            }
        });
        view.startAnimation(animation);
    }
    return future;
}

From source file:com.pentacog.mctracker.ServerListAdapter.java

private void setupServerCell(Server server, ServerViewHolder holder) {

    /*// w w  w  .ja  v  a  2  s . c o  m
     * No Internet = "Network Unreachable"
     * open port but no server = "The operation timed out"
     * No open ports = <address> - Connection refused
     */
    Animation a = holder.statusBar.getAnimation();
    if (a != null) {
        a.reset();
        holder.statusBar.clearAnimation();
    }
    if (server.motd.startsWith(MCServerTrackerActivity.ERROR_CHAR)) {
        holder.statusBar.setBackgroundColor(Color.RED);
        holder.playerCount.setVisibility(View.INVISIBLE);
        holder.ping.setVisibility(View.INVISIBLE);
    } else {
        holder.statusBar.setBackgroundColor(Color.GREEN);
        holder.playerCount.setVisibility(View.VISIBLE);
        holder.ping.setVisibility(View.VISIBLE);
    }
    holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers);
    holder.serverData.setText(server.motd);
    holder.ping.setText("" + server.ping + "ms");

}

From source file:com.kuloud.android.unity.ui.widget.steprefresh.PullToRefreshView.java

private void animateOffsetToPosition(Animation animation, boolean isEndAnimation) {
    mFrom = mCurrentOffsetTop;//from  w  w  w .j  a v  a2  s  . c o m
    mFromDragPercent = mCurrentDragPercent;
    long animationDuration = Math.abs((long) (!isEndAnimation ? MAX_OFFSET_ANIMATION_DURATION
            : MAX_OFFSET_END_ANIMATION_DURATION * mFromDragPercent));

    animation.reset();
    animation.setDuration(animationDuration);
    animation.setInterpolator(mDecelerateInterpolator);
    animation.setAnimationListener(mToStartListener);
    mRefreshView.clearAnimation();
    mRefreshView.startAnimation(animation);
}