Example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator

List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator

Introduction

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

Prototype

public DecelerateInterpolator(float factor) 

Source Link

Document

Constructor

Usage

From source file:Main.java

public static DecelerateInterpolator getDecelerateInterpolator(float factor) {
    return new DecelerateInterpolator(factor);
}

From source file:Main.java

public static void show(View view) {
    if (view != null) {
        view.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }//w w  w.  j  a v a  2s .  c  o  m
}

From source file:Main.java

public static void show(View view, AnimatorListenerAdapter listener) {
    if (view != null) {
        view.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).setListener(listener)
                .start();/*from w  w  w . ja  v a2s.c om*/
    }
}

From source file:Main.java

public static AnimationSet RotateAndFadeInAnimation() {

    AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f);
    fade_in.setDuration(400);/*w w w.  j  a va2 s. co m*/
    fade_in.setStartOffset(0);
    fade_in.setFillAfter(true);

    ScaleAnimation expand = new ScaleAnimation(0.2f, 1, 0.2f, 1, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    expand.setDuration(500);
    expand.setStartOffset(0);
    expand.setFillAfter(true);

    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotate.setDuration(500);
    rotate.setStartOffset(0);
    // rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);

    AnimationSet Reload = new AnimationSet(true);
    Reload.addAnimation(fade_in);
    Reload.addAnimation(expand);
    Reload.addAnimation(rotate);
    Reload.setInterpolator(new DecelerateInterpolator(1.3f));
    return Reload;
}

From source file:Main.java

public static void collapse(final View v, final int initialHeight, final int targetHeight, int duration,
        Animation.AnimationListener listener) {
    final int diffHeight = initialHeight - targetHeight;
    Animation a = new Animation() {
        @Override/*from   w w w  .jav a 2  s  .  c  o m*/
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = initialHeight - (int) (diffHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };
    a.setDuration(duration);
    a.setInterpolator(new DecelerateInterpolator(2));
    if (listener != null) {
        a.setAnimationListener(listener);
    }
    v.startAnimation(a);
}

From source file:springindicator.viewpager.ScrollerViewPager.java

private void setScrollSpeedUsingRefection(int duration) {
    try {//from   w w w . j a v a  2 s  . co  m
        Field localField = ViewPager.class.getDeclaredField("mScroller");
        localField.setAccessible(true);
        FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(), new DecelerateInterpolator(1.5F));
        scroller.setDuration(duration);
        localField.set(this, scroller);
    } catch (IllegalAccessException | IllegalArgumentException | NoSuchFieldException ignored) {

    }
}

From source file:com.baibian.tool.springindicator.viewpager.ScrollerViewPager.java

private void setScrollSpeedUsingRefection(int duration) {
    try {//from  ww  w  .  ja v a2s. c o m
        Field localField = ViewPager.class.getDeclaredField("mScroller");
        localField.setAccessible(true);
        FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(), new DecelerateInterpolator(1.5F));
        scroller.setDuration(duration);
        localField.set(this, scroller);
        return;
    } catch (IllegalAccessException localIllegalAccessException) {
    } catch (IllegalArgumentException localIllegalArgumentException) {
    } catch (NoSuchFieldException localNoSuchFieldException) {
    }
}

From source file:android.view.ScrollerViewPager.java

private void setScrollSpeedUsingRefection(final int duration) {
    try {/*www .  ja va2  s  . c  o  m*/
        final Field localField = ViewPager.class.getDeclaredField("mScroller");
        localField.setAccessible(true);
        final FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(),
                new DecelerateInterpolator(1.5F));
        scroller.setDuration(duration);
        localField.set(this, scroller);
        return;
    } catch (final IllegalAccessException localIllegalAccessException) {
    } catch (final IllegalArgumentException localIllegalArgumentException) {
    } catch (final NoSuchFieldException localNoSuchFieldException) {
    }
}

From source file:com.grottworkshop.gwsspringindicator.ScrollerViewPager.java

private void setScrollSpeedUsingRefection(int duration)
        throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException {
    Field localField = ViewPager.class.getDeclaredField("mScroller");
    localField.setAccessible(true);/*w ww  .j  a  va  2s  .  c o  m*/
    FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(), new DecelerateInterpolator(1.5F));
    scroller.setDuration(duration);
    localField.set(this, scroller);
}

From source file:com.grottworkshop.gwsspringindicator.viewpager.ScrollerViewPager.java

/**
 *
 * @param duration the duration int/*from   w w  w  .  j  a  va2 s  .c o  m*/
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 * @throws NoSuchFieldException
 */
private void setScrollSpeedUsingRefection(int duration)
        throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException {
    Field localField = ViewPager.class.getDeclaredField("mScroller");
    localField.setAccessible(true);
    FixedSpeedScroller scroller = new FixedSpeedScroller(getContext(), new DecelerateInterpolator(1.5F));
    scroller.setDuration(duration);
    localField.set(this, scroller);
}