Example usage for android.view.animation LinearInterpolator LinearInterpolator

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

Introduction

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

Prototype

public LinearInterpolator() 

Source Link

Usage

From source file:com.coco.flowimageview.FlowImageView.java

private void initFlowImageView() {
    setScaleType(ImageView.ScaleType.MATRIX);

    final Context context = getContext();
    final float density = context.getResources().getDisplayMetrics().density;

    mMinFlowVelocity = MIN_FLOW_VELOCITY * density;
    mFlowVelocity = DEFAULT_FLOW_VELOCITY * density;

    mScroller = new Scroller(context, new LinearInterpolator());
}

From source file:com.guodong.sun.guodong.fragment.VideoFragment.java

private void initFButton() {
    mFButton.attachToRecyclerView(mRecyclerView);
    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override//w  w w  .j a  va 2 s  .  co m
        public void onClick(View v) {
            if (isRefreshing || isLoading)
                return;
            mAnimator = ObjectAnimator.ofFloat(v, "rotation", 0F, 360F);
            mAnimator.setDuration(500);
            mAnimator.setInterpolator(new LinearInterpolator());
            mAnimator.setRepeatCount(ValueAnimator.INFINITE);
            mAnimator.setRepeatMode(ValueAnimator.RESTART);
            mAnimator.start();
            mRecyclerView.scrollToPosition(0);
            isRefreshing = true;
            mVideoPresenter.getVideoData(1);
        }
    });
}

From source file:android.support.graphics.drawable.AnimationUtilsCompat.java

private static Interpolator createInterpolatorFromXml(Context context, Resources res, Theme theme,
        XmlPullParser parser) throws XmlPullParserException, IOException {

    Interpolator interpolator = null;//w  w w .j  a  va  2  s .  c om

    // Make sure we are on a start tag.
    int type;
    int depth = parser.getDepth();

    while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
            && type != XmlPullParser.END_DOCUMENT) {

        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        AttributeSet attrs = Xml.asAttributeSet(parser);

        String name = parser.getName();

        if (name.equals("linearInterpolator")) {
            interpolator = new LinearInterpolator();
        } else if (name.equals("accelerateInterpolator")) {
            interpolator = new AccelerateInterpolator(context, attrs);
        } else if (name.equals("decelerateInterpolator")) {
            interpolator = new DecelerateInterpolator(context, attrs);
        } else if (name.equals("accelerateDecelerateInterpolator")) {
            interpolator = new AccelerateDecelerateInterpolator();
        } else if (name.equals("cycleInterpolator")) {
            interpolator = new CycleInterpolator(context, attrs);
        } else if (name.equals("anticipateInterpolator")) {
            interpolator = new AnticipateInterpolator(context, attrs);
        } else if (name.equals("overshootInterpolator")) {
            interpolator = new OvershootInterpolator(context, attrs);
        } else if (name.equals("anticipateOvershootInterpolator")) {
            interpolator = new AnticipateOvershootInterpolator(context, attrs);
        } else if (name.equals("bounceInterpolator")) {
            interpolator = new BounceInterpolator();
        } else if (name.equals("pathInterpolator")) {
            interpolator = new PathInterpolatorCompat(context, attrs, parser);
        } else {
            throw new RuntimeException("Unknown interpolator name: " + parser.getName());
        }
    }
    return interpolator;
}

From source file:net.semantic_error.turritype.sample.TypeActivity.java

private List<TimeInterpolator> getDefaultInterpolatorList() {
    List<TimeInterpolator> interpolatorList = new ArrayList<>();
    interpolatorList.add(new LinearInterpolator());
    interpolatorList.add(new FastOutSlowInInterpolator());
    interpolatorList.add(new AccelerateDecelerateInterpolator());
    return interpolatorList;
}

From source file:com.kayac.slidingmenu.ui.views.DraggableLayout.java

@TargetApi(13)
private void init(Context context) {
    mContext = context;//from w ww . j  a v a2 s  .  co  m
    screenSize = getScreenSize(context);
    Log.d(TAG, "Screen width" + screenSize.x);
    mScroller = new Scroller(mContext, new LinearInterpolator());
    mHandler = new Handler();
    mPaint = new Paint();
    mPaint.setColor(color.background_dark);
    mBlackShadowRect = new Rect(screenSize.x, 0, 2 * screenSize.x, screenSize.y);
}

From source file:org.catrobat.paintroid.ui.BottomBar.java

private void delayedAnimateSelectedTool(int startDelay) {
    ImageButton button = getToolButtonByToolType(mCurrentToolType);
    int color = ContextCompat.getColor(button.getContext(), R.color.bottom_bar_button_activated);
    int fadedColor = color & 0x00ffffff;
    ValueAnimator valueAnimator = ObjectAnimator.ofInt(button, "backgroundColor", color, fadedColor);
    valueAnimator.setEvaluator(new ArgbEvaluator());
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.setDuration(500);/*  w  ww. j  a va2 s  . c o  m*/
    valueAnimator.setRepeatCount(5);
    valueAnimator.setRepeatMode(ValueAnimator.REVERSE);
    valueAnimator.setStartDelay(startDelay);
    valueAnimator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (PaintroidApplication.currentTool != null) {
                setActivatedToolButton(PaintroidApplication.currentTool.getToolType());
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
    valueAnimator.start();
}

From source file:es.wolfi.app.passman.CredentialDisplay.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        Vault v = (Vault) SingleTon.getTon().getExtra(SettingValues.ACTIVE_VAULT.toString());
        credential = v.findCredentialByGUID(getArguments().getString(CREDENTIAL));
    }/*from   w ww.j av a2  s .c om*/

    handler = new Handler();
    otp_refresh = new Runnable() {
        @Override
        public void run() {
            int progress = (int) (System.currentTimeMillis() / 1000) % 30;
            otp_progress.setProgress(progress * 100);

            ObjectAnimator animation = ObjectAnimator.ofInt(otp_progress, "progress", (progress + 1) * 100);
            animation.setDuration(1000);
            animation.setInterpolator(new LinearInterpolator());
            animation.start();

            otp.setText(TOTPHelper.generate(new Base32().decode(credential.getOtp())));
            handler.postDelayed(this, 1000);
        }
    };
}

From source file:org.runbuddy.tomahawk.views.SimplePagerTabs.java

public void setViewPager(final ViewPager viewPager) {
    removeAllViews();/*from  w w w  .  j  a v  a  2s  .  c  om*/
    viewPager.addOnPageChangeListener(mOnPageChangeListener);
    LinearLayout itemContainer = new LinearLayout(getContext());
    addView(itemContainer);
    mItemCount = viewPager.getAdapter().getCount();
    for (int i = 0; i < viewPager.getAdapter().getCount(); i++) {
        if (i > 0) {
            View divider = LayoutInflater.from(getContext()).inflate(R.layout.simplepagertabs_tab_divider,
                    itemContainer, false);
            itemContainer.addView(divider);
        }
        TextView item = (TextView) LayoutInflater.from(getContext()).inflate(R.layout.simplepagertabs_tab_item,
                itemContainer, false);
        item.setText(viewPager.getAdapter().getPageTitle(i));
        itemContainer.addView(item);
        if (i == 0) {
            ViewUtils.afterViewGlobalLayout(new ViewUtils.ViewRunnable(item) {
                @Override
                public void run() {
                    View tabIndicator = LayoutInflater.from(getContext())
                            .inflate(R.layout.simplepagertabs_tab_indicator, SimplePagerTabs.this, false);
                    tabIndicator.getLayoutParams().width = getLayedOutView().getWidth();
                    addView(tabIndicator);
                    int xGoal = (mItemCount - 1) * (getLayedOutView().getWidth() + 1) - 1;
                    mAnimator = ObjectAnimator.ofFloat(tabIndicator, "x", 0, xGoal);
                    mAnimator.setInterpolator(new LinearInterpolator());
                    mAnimator.setDuration(10000);
                }
            });
        }

        final int j = i;
        item.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                viewPager.setCurrentItem(j);
            }
        });
    }
}

From source file:org.tomahawk.tomahawk_android.views.SimplePagerTabs.java

public void setViewPager(final ViewPager viewPager) {
    removeAllViews();/*www . j a  v a  2 s .c om*/
    viewPager.setOnPageChangeListener(mOnPageChangeListener);
    LinearLayout itemContainer = new LinearLayout(getContext());
    addView(itemContainer);
    mItemCount = viewPager.getAdapter().getCount();
    for (int i = 0; i < viewPager.getAdapter().getCount(); i++) {
        if (i > 0) {
            View divider = LayoutInflater.from(getContext()).inflate(R.layout.simplepagertabs_tab_divider,
                    itemContainer, false);
            itemContainer.addView(divider);
        }
        TextView item = (TextView) LayoutInflater.from(getContext()).inflate(R.layout.simplepagertabs_tab_item,
                itemContainer, false);
        item.setText(viewPager.getAdapter().getPageTitle(i));
        itemContainer.addView(item);
        if (i == 0) {
            ViewUtils.afterViewGlobalLayout(new ViewUtils.ViewRunnable(item) {
                @Override
                public void run() {
                    View tabIndicator = LayoutInflater.from(getContext())
                            .inflate(R.layout.simplepagertabs_tab_indicator, SimplePagerTabs.this, false);
                    tabIndicator.getLayoutParams().width = getLayedOutView().getWidth();
                    addView(tabIndicator);
                    int xGoal = (mItemCount - 1) * (getLayedOutView().getWidth() + 1) - 1;
                    mAnimator = ObjectAnimator.ofFloat(tabIndicator, "x", 0, xGoal);
                    mAnimator.setInterpolator(new LinearInterpolator());
                    mAnimator.setDuration(10000);
                }
            });
        }

        final int j = i;
        item.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                viewPager.setCurrentItem(j);
            }
        });
    }
}

From source file:com.guodong.sun.guodong.fragment.PictureFragment.java

private void initFButton() {
    mFButton.attachToRecyclerView(mRecyclerView);
    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override//from www. j  av  a2 s  . co  m
        public void onClick(View v) {
            if (isRefreshing || isLoadingMore)
                return;
            mAnimator = ObjectAnimator.ofFloat(v, "rotation", 0F, 360F);
            mAnimator.setDuration(500);
            mAnimator.setInterpolator(new LinearInterpolator());
            mAnimator.setRepeatCount(ValueAnimator.INFINITE);
            mAnimator.setRepeatMode(ValueAnimator.RESTART);
            mAnimator.start();
            mRecyclerView.scrollToPosition(0);
            isRefreshing = true;
            mPicturePreenter.getPictureData();
        }
    });
}