Example usage for android.view View clearAnimation

List of usage examples for android.view View clearAnimation

Introduction

In this page you can find the example usage for android.view View clearAnimation.

Prototype

public void clearAnimation() 

Source Link

Document

Cancels any animations for this view.

Usage

From source file:com.ushahidi.android.ui.activity.BaseActivity.java

protected android.view.View fadeOut(final android.view.View view, final boolean animate) {
    if (view != null) {
        if (animate) {
            view.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
        } else {/*  w w  w .jav  a  2  s  . c  o  m*/
            view.clearAnimation();
        }
    }
    return view;

}

From source file:com.ushahidi.android.ui.activity.BaseActivity.java

protected android.view.View fadeIn(final android.view.View view, final boolean animate) {
    if (view != null) {
        if (animate) {
            view.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
        } else {//www  . j a  va  2 s .co  m

            view.clearAnimation();
        }
    }

    return view;

}

From source file:fr.shywim.antoinedaniel.ui.fragment.SoundPagerFragment.java

private void openFab(View fab) {
    if (mFabIsOpen)
        return;/*from   w w  w. j  a v  a2  s .  c o  m*/
    mFabIsOpen = true;

    ImageView icSettings = (ImageView) fab.findViewById(R.id.fab_settings_icon);
    ImageView icClose = (ImageView) fab.findViewById(R.id.fab_settings_icon_close);
    View root = (View) fab.getParent();
    View fabMiniLoop = root.findViewById(R.id.fab_mini_loop);
    View fabMiniLoopHint = root.findViewById(R.id.fab_mini_loop_hint);
    View fabMiniDownloaded = root.findViewById(R.id.fab_mini_downloaded);
    View fabMiniDownloadedHint = root.findViewById(R.id.fab_mini_downloaded_hint);

    icSettings.animate().rotation(360).alpha(0).setDuration(250);
    icClose.animate().rotation(360).alpha(1).setDuration(250);
    fabMiniLoop.clearAnimation();
    ((View) fabMiniLoop.getParent()).setVisibility(View.VISIBLE);
    fabMiniLoop.animate().scaleX(1).scaleY(1).setListener(null).setDuration(150);
    fabMiniLoopHint.animate().alpha(1).setDuration(150);
    fabMiniDownloaded.clearAnimation();
    ((View) fabMiniDownloaded.getParent()).setVisibility(View.VISIBLE);
    fabMiniDownloaded.animate().scaleX(1).scaleY(1).setListener(null).setStartDelay(100).setDuration(150);
    fabMiniDownloadedHint.animate().alpha(1).setStartDelay(100).setDuration(150);

    if (PrefUtils.getShowOnlyDownloaded(mActivity)) {
        setFabMiniChecked(fabMiniDownloaded);
    } else {
        setFabMiniUnchecked(fabMiniDownloaded);
    }

    if (SoundUtils.isLoopingSet()) {
        setFabMiniChecked(fabMiniLoop);
    } else {
        setFabMiniUnchecked(fabMiniLoop);
    }
}

From source file:com.linkbubble.ui.BubbleFlowView.java

private void bringTabViewToFront(View tabView) {
    tabView.clearAnimation();
    tabView.bringToFront();
    mContent.requestLayout();
    mContent.invalidate();
}

From source file:fr.shywim.antoinedaniel.ui.MainActivity.java

/**
 * Fade in main content view if view has been faded out.
 *///from  www .ja  va  2s .  co m
private void fadeIn() {
    View mainLayout = findViewById(R.id.content);
    if (mainLayout != null) {
        if (mainLayout.getAlpha() != 1.0f) {
            mainLayout.clearAnimation();
            mainLayout.animate().alpha(1).setDuration(getResources().getInteger(R.integer.anim_duration_fast));
        }
    }
}

From source file:com.appolica.interactiveinfowindow.InfoWindowManager.java

private void removeWindow(@NonNull final InfoWindow window, @NonNull final View container) {

    container.setVisibility(View.INVISIBLE);
    container.setScaleY(1f);/*from  w  w  w. j ava 2  s.c o  m*/
    container.setScaleX(1f);
    container.clearAnimation();

    removeWindowFragment(window.getWindowFragment());
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??/*from www  .  jav  a 2s  .c o  m*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_FADE_IN); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(0.0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 0f, 1f);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??/*w  ww .  j  a va2  s  .  c  om*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeOut,target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    if (target.getVisibility() == View.VISIBLE) {
        target.setTag(R.id.anim_type, ANIM_FADE_OUT); // ??
        target.setScaleX(1.0f);
        target.setScaleY(1.0f);
        target.setAlpha(1.0f);
        final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 1f, 0f);
        objectAnimator.addListener(mAnimatorListener);
        if (BuildCheck.isAndroid4_3())
            objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
        objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
        objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
        objectAnimator.start(); // 
    }
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??//from w w  w  .j  a v  a2  s. c o m
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_IN); // ???
    target.setScaleX(0.0f);
    target.setScaleY(0.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 0.01f, 1f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 0.01f, 1f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??// w  ww . j  a v a 2  s.c  om
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_OUT); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}