Example usage for android.view.animation TranslateAnimation setDuration

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

Introduction

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

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

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);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);/*from   w w w. jav a 2 s .c  o  m*/
    finger.startAnimation(animation);
    description.setText("Swipe from bottom to top to open Manuals");
}

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

private void showCloseManualMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 400.0f);
    animation.setDuration(1000);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);/*from  w w w .  j ava2 s. c o  m*/
    finger.startAnimation(animation);
    description.setText(
            "Swipe from top to bottom to close Manuals\r\n\r\nif you can't the heat use Google camera :)");
    nextButton.setText("Close");
    dontshowagain.setVisibility(View.VISIBLE);
}

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

private void initTab() {
    changeSelectedTab(0);/* www .  j a v a2  s .  c om*/

    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: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 2s .  c  o m
    }

    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);
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateScroller() {
    Log.v(TAG, "animateScroller()");

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);//from w  w w. j  a  v a2  s  .  c  o  m
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        private int repeatCounter = 0;

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (++repeatCounter % 2 == 0 && nextStatus != Status.INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.devbrackets.android.exomedia.ui.animation.TopViewHideShowAnimation.java

public TopViewHideShowAnimation(View view, boolean toVisible, long duration) {
    super(false);
    this.toVisible = toVisible;
    this.animationView = view;

    //Creates the Alpha animation for the transition
    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
    alphaAnimation.setDuration(duration);

    //Creates the Translate animation for the transition
    int startY = toVisible ? -view.getHeight() : 0;
    int endY = toVisible ? 0 : -view.getHeight();
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY);
    translateAnimation/*from  w w w.ja  va  2s.  c o m*/
            .setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);

    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}

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

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

    if (mCurrentTab == position) {
        return;/*  w  w  w  . j a  va  2 s  .  co m*/
    }

    if (mCurrentTab == 0) {
        startPosition = 0;
    } else {
        startPosition = mTabDistance;
    }

    if (position == 0) {
        endPosition = 0;
    } else {
        endPosition = mTabDistance;
    }

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

From source file:com.devbrackets.android.exomedia.ui.animation.BottomViewHideShowAnimation.java

public BottomViewHideShowAnimation(View view, boolean toVisible, long duration) {
    super(false);
    this.toVisible = toVisible;
    this.animationView = view;

    //Creates the Alpha animation for the transition
    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
    alphaAnimation.setDuration(duration);

    //Creates the Translate animation for the transition
    int startY = toVisible ? getHideShowDelta(view) : 0;
    int endY = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY);
    translateAnimation/*from  w ww. ja  v a  2  s  . co m*/
            .setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);

    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateScroller() {
    Timber.v("animateScroller()");
    checkNotNull(progressBar);//from  ww w .  ja v a 2s  . c  o m

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (nextProgress.getStatus() != INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:me.xiaopan.android.examples.activity.custom.SlideTabHostActivity.java

@Override
public void onInitListener(Bundle savedInstanceState) {
    for (final Tab tab : tabList) {
        tab.getTitle().setOnClickListener(new OnClickListener() {
            @Override// w  w w . jav a2s.  c o  m
            public void onClick(View v) {
                viewPager.setCurrentItem(Integer.valueOf(String.valueOf(tab.getIndex())));
            }
        });
    }

    viewPager.setOnPageChangeListener(new OnPageChangeListener() {
        @Override
        public void onPageSelected(int arg0) {
            //?tab?tab
            Tab lastTab = tabList.get(lastTabIndex);
            Tab currentTab = tabList.get(arg0);

            //??tab?tab
            lastTab.getTitle().setSelected(false);
            currentTab.getTitle().setSelected(true);

            //?
            TranslateAnimation translateAnimation = new TranslateAnimation(lastTab.getSlideBlock().getLeft(),
                    currentTab.getSlideBlock().getLeft(), 0, 0);
            translateAnimation.setDuration(200);
            translateAnimation.setFillAfter(true);
            slideBlock.startAnimation(translateAnimation);

            //tab
            lastTabIndex = arg0;
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {

        }

        @Override
        public void onPageScrollStateChanged(int arg0) {

        }
    });
}