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:com.nao20010128nao.RSRL.SwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 * @param context//from  ww w. j av  a  2s .  c  o m
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mProgressBar = new SwipeProgressBar(this);
    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
}

From source file:com.purplelight.redstar.component.view.SwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 * @param context/*from  w  w w  .j ava  2 s.c  o m*/
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mProgressBar = new SwipeProgressBar(this);
    mProgressBarBottom = new SwipeProgressBar(this);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();
}

From source file:com.hiyjeain.android.DevBase.widget.DoubleSwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context//w w w  .ja va2 s  .com
 * @param attrs
 */
public DoubleSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    mMoreCircleHeight = mMoreCircleWidth = (int) (CIRCLE_DIAMETER_LARGE * metrics.density);

    createProgressView();
    createMoreView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}

From source file:org.floens.chan.ui.controller.AlbumDownloadController.java

@SuppressWarnings("deprecation")
private void setItemChecked(AlbumDownloadCell cell, boolean checked, boolean animated) {
    float scale = checked ? 0.75f : 1f;
    if (animated) {
        cell.thumbnailView.animate().scaleX(scale).scaleY(scale).setInterpolator(new DecelerateInterpolator(3f))
                .setDuration(500).start();
    } else {/*w  w w.  jav  a2  s.c  o m*/
        cell.thumbnailView.setScaleX(scale);
        cell.thumbnailView.setScaleY(scale);
    }

    Drawable drawable = context.getResources().getDrawable(
            checked ? R.drawable.ic_check_circle_white_24dp : R.drawable.ic_radio_button_unchecked_white_24dp);

    if (checked) {
        Drawable wrapped = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(wrapped, ThemeHelper.PrimaryColor.BLUE.color);
        cell.checkbox.setImageDrawable(wrapped);
    } else {
        cell.checkbox.setImageDrawable(drawable);
    }
}

From source file:com.filemanager.free.fragments.TabFragment.java

@Override
public void onPageSelected(int p1) {

    mToolBarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    currenttab = p1;//  ww  w . j a  v  a2 s .c o m
    Fragment fragment = fragments.get(p1);
    if (fragment != null) {
        String name = fragments.get(p1).getClass().getName();
        if (name != null && name.contains("Main")) {
            Main ma = ((Main) fragments.get(p1));
            if (ma.CURRENT_PATH != null) {
                try {
                    mainActivity.updateDrawer(ma.CURRENT_PATH);
                    mainActivity.updatePath(ma.CURRENT_PATH, ma.results, ma.openMode, ma.folder_count,
                            ma.file_count);
                    if (buttons.getVisibility() == View.VISIBLE) {
                        mainActivity.bbar(ma);
                    }
                } catch (Exception e) {
                    //       e.printStackTrace();5
                }
            }
        }
    }
}

From source file:com.bitfyr.picassoswiperefreshlayout.PicassoSwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context// w ww  . j a  v a  2  s  .  c o m
 * @param attrs
 */
public PicassoSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}

From source file:com.telenav.nodeflow.NodeFlowLayout.java

/**
 * perform alpha animation associated with closing or opening a node
 *
 * @param startIndex start index of child views to be animated
 * @param endIndex   end index of child views to be animated
 * @param destAlpha  final alpha of child views to be animated
 *//*  w w  w . j  a  v a2  s.c o m*/
private void animateDrillAlpha(final int startIndex, final int endIndex, final int destAlpha) {
    ValueAnimator animator = ValueAnimator.ofFloat(1 - destAlpha, destAlpha);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            for (int i = startIndex; i < endIndex; ++i) {
                getChildAt(i).setAlpha(((Float) animation.getAnimatedValue()));
            }
        }
    });
    animator.addListener(new CustomAnimationListener() {
        @Override
        public void onAnimationStart(Animator animator) {
            for (int i = startIndex; i < getChildCount(); ++i) {
                getChildAt(i).setAlpha(1 - destAlpha);
            }
        }
    });
    animator.setDuration(duration);
    if (destAlpha == 1)
        animator.setInterpolator(new AccelerateInterpolator());
    else
        animator.setInterpolator(new DecelerateInterpolator(2));
    animator.start();
}

From source file:com.ymsfd.practices.ui.widget.SwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *///ww  w . j a v a2 s  . co  m
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleDiameter = (int) (CIRCLE_DIAMETER * metrics.density);
    D("Density->" + metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
    mTotalDragDistance = mSpinnerOffsetEnd;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);

    mOriginalOffsetTop = mCurrentTargetOffsetTop = -mCircleDiameter;
    moveToStart(1.0f);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();
}

From source file:com.xfzbd.cqi.widget.srl.ShyaringanSwipeRefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context//from w ww  .j av  a2  s .com
 * @param attrs
 */
public ShyaringanSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mLinearInterpolator = new LinearInterpolator();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleDiameter = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
    mTotalDragDistance = mSpinnerOffsetEnd;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);

    mOriginalOffsetTop = mCurrentTargetOffsetTop = -mCircleDiameter;
    moveToStart(1.0f);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();
}

From source file:com.ray.appchallenge.view.SwipeRefreshLayoutBottom.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param  context// ww  w .  j ava2s  .c om
 * @param  attrs
 */
public SwipeRefreshLayoutBottom(final Context context, final AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);

    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}