Example usage for android.view.animation TranslateAnimation setFillAfter

List of usage examples for android.view.animation TranslateAnimation setFillAfter

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation setFillAfter.

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

From source file:Main.java

public static TranslateAnimation getTranslateAnimationToParent(float pivotFromX, float pivotToX,
        float pivotFromY, float pivotToY, int intDuration, boolean boolFillAfter) {
    TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, pivotFromX,
            Animation.RELATIVE_TO_PARENT, pivotToX, Animation.RELATIVE_TO_PARENT, pivotFromY,
            Animation.RELATIVE_TO_PARENT, pivotToY);
    mAnmation.setDuration(intDuration);/*from  w w w  .  j  a v a2 s.  c om*/
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void setTranslateAnimationToParent(View view, float pivotFromX, float pivotToX, float pivotFromY,
        float pivotToY, int intDuration, boolean boolFillAfter) {
    TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, pivotFromX,
            Animation.RELATIVE_TO_PARENT, pivotToX, Animation.RELATIVE_TO_PARENT, pivotFromY,
            Animation.RELATIVE_TO_PARENT, pivotToY);
    mAnmation.setDuration(intDuration);//  ww  w  .  ja va 2  s. co  m
    mAnmation.setFillAfter(boolFillAfter);
    // mAnmation.setRepeatMode(Animation.RESTART);
    // mAnmation.setRepeatCount(intRepeatCount);
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

From source file:Main.java

private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);

    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
            Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
            Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);//w ww.j  a  v  a 2  s .c om
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
}

From source file:Main.java

/**
 *    move the background view(translate animation).
 * /*from w ww  .j  a  v  a2  s.c  o  m*/
 * @param view
 *          the view will be moved
 * @param durationMillis
 *          translate animation duration
 * @param fromX
 *          from X coordinate
 * @param toX
 *          to X coordinate
 * @param fromY
 *          from Y coordinate
 * @param toY
 *          to Y coordinate
 */
public static void translateFromBelow(final Context context, final View view, final long durationMillis,
        boolean fillAfter, float fromX, float toX, final float fromY, final float toY) {
    TranslateAnimation translateAnimation = new TranslateAnimation(fromX, toX, fromY, toY + 5);
    //      TranslateAnimation translateAnimation = new TranslateAnimation(fromX, toX, fromY, toY-21);
    translateAnimation.setDuration(durationMillis);
    translateAnimation.setFillAfter(fillAfter);//this animation performed will persist when it is finished
    view.startAnimation(translateAnimation);
    translateAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            //            TranslateAnimation shakeAnimation = new TranslateAnimation(0, 0, toY-21, toY+5);
            //            shakeAnimation.setInterpolator(new BounceInterpolator());
            //            shakeAnimation.setDuration(durationMillis); //500
            //            shakeAnimation.setFillAfter(true);
            //            view.startAnimation(shakeAnimation);
        }
    });
}

From source file:net.sarangnamu.common.ui.widget.drawerlayout.ContentSlidingDrawerListener.java

@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
    // @see http://stackoverflow.com/questions/20057084/how-to-move-main-content-with-drawer-layout-left-side
    float moveFactor = (getListView().getWidth() * slideOffset);
    TranslateAnimation anim = new TranslateAnimation(lastTranslate, moveFactor, 0.0f, 0.0f);
    anim.setDuration(0);//from   w  w w  .j a v a 2 s  .c  om
    anim.setFillAfter(true);
    getContentFrame().startAnimation(anim);

    lastTranslate = moveFactor;
}

From source file:com.umeng.comm.ui.fragments.CommentTabFragment.java

private void initTab() {
    changeSelectedTab(0);//  ww  w  .j av a  2  s  . com

    mTabDistance = (mScreenWidth - CommonUtils.dip2px(getActivity(), 80 * 2)) / 4;
    TranslateAnimation animation = new TranslateAnimation(0, mTabDistance, 0, 0);
    animation.setDuration(0);//?
    animation.setFillAfter(true);
    mTabCursor.startAnimation(animation);
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showOpenSettingsMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f, 0.0f, 0.0f);
    animation.setDuration(1000);/*from w w w . j  a va2s  .co m*/
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from left to right to open Settings");
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showCloseSettingsMenu() {
    TranslateAnimation animation = new TranslateAnimation(400.0f, 0.0f, 0.0f, 0.0f);
    animation.setDuration(1000);/*from ww w .  j a va 2  s .  c  om*/
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from right to left to close Settings");
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showOpenManualMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 0.0f, 400.0f, 0.0f);
    animation.setDuration(1000);/*from ww w .j  av a 2  s  .  c om*/
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from bottom to top to open Manuals");
}

From source file:com.umeng.comm.ui.fragments.CommentTabFragment.java

private void moveTabCurosr(int position) {
    float endPosition;
    float startPosition;

    if (mCurrentTab == position) {
        return;/*from www  .j av  a 2 s  . c om*/
    }

    if (mCurrentTab == 0) {
        startPosition = mTabDistance;
    } else {
        startPosition = CommonUtils.dip2px(getActivity(), 80) + mTabDistance * 3;
    }

    if (position == 0) {
        endPosition = mTabDistance;
    } else {
        endPosition = CommonUtils.dip2px(getActivity(), 80) + mTabDistance * 3;
    }

    mCurrentTab = position;
    TranslateAnimation animation = new TranslateAnimation(startPosition, endPosition, 0, 0);
    animation.setDuration(180);//?
    animation.setFillAfter(true);
    mTabCursor.startAnimation(animation);
}