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.blinktextview.BlinkTextView.java

private void initBlinkTextView() {
    final Context context = getContext();
    mScroller = new Scroller(context, new LinearInterpolator());
    mCurrentAlpha = MAX_ALPHA;/* w w w. ja va 2s. c om*/
}

From source file:io.apptik.multiview.ScalableRVFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    this.setHasOptionsMenu(true);
    View v = inflater.inflate(R.layout.fragment_scalablerv, container, false);
    recyclerView = (ScalableRecyclerGridView) v.findViewById(R.id.recyclerView);

    recyclerMixedAdapter = new BasicMixedRecyclerAdapter(MockData.getMockJsonArray(333, 500),
            getActivity().getApplicationContext());

    recyclerView.setAdapter(recyclerMixedAdapter);
    defaultAnimator = new DefaultItemAnimator();
    //                new FlexiItemAnimator(
    //                        Providers.defaultAddAnimProvider(),
    //                        Providers.defaultChangeOldViewAnimProvider(),
    //                        Providers.defaultChangeNewViewAnimProvider(),
    //                        Providers.defaultMoveAnimProvider(),
    //                        Providers.defaultRemoveAnimProvider()
    //                );
    customAnimator = new FlexiItemAnimator(Providers.teleportAddNewViewAnimProvider(),
            Providers.teleportChangeOldViewAnimProvider(), Providers.teleportChangeNewViewAnimProvider(), null,
            null);//  www .  j a  v  a2  s  .co m
    defaultAnimator.setChangeDuration(500);
    customAnimator.setChangeDuration(500);
    customAnimator.setIpChangeNew(new LinearInterpolator());
    customAnimator.setIpChangeOld(new LinearInterpolator());

    return v;
}

From source file:com.unovo.apartment.ui.main.MainActivity.java

public void toggleNavTabView(boolean isShowOrHide) {
    final View view = mNavBar.getView();
    if (view == null)
        return;/*from  w  w w. j  av  a 2 s . c om*/
    // hide
    view.setVisibility(View.VISIBLE);
    if (!isShowOrHide) {
        view.animate().translationY(view.getHeight()).setDuration(180).setInterpolator(new LinearInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        view.setTranslationY(view.getHeight());
                        view.setVisibility(View.GONE);
                    }
                });
    } else {
        view.animate().translationY(0).setDuration(180).setInterpolator(new LinearInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        // fix:bug > ???
                        view.setVisibility(View.VISIBLE);
                        view.setTranslationY(0);
                    }
                });
    }
}

From source file:com.actinarium.kinetic.ui.RecordFragment.java

@Override
public void onClick(View v) {
    if (!mIsRecording) {
        // Start recording
        mIsRecording = true;/*from   w w  w  . j  a  v  a  2 s .c  o m*/
        mRecordButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_pause));
        mRecorder.startRecording();

        mAnimator = ObjectAnimator.ofInt(mProgress, "level", 0, 10000)
                .setDuration(DataRecorder.DEFAULT_RECORDING_TIME_MILLIS);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.start();
    } else {
        // End animation quickly
        mAnimator.end();

        // Stop recording - the drawable and the boolean will be updated in a callback method
        mRecorder.stop();
    }
}

From source file:library.internal.IndicatorLayout.java

public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
    super(context);
    mArrowImageView = new ImageView(context);

    Drawable arrowD = ContextCompat.getDrawable(context, R.drawable.indicator_arrow);
    mArrowImageView.setImageDrawable(arrowD);

    final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
    mArrowImageView.setPadding(padding, padding, padding, padding);
    addView(mArrowImageView);/*from   ww  w . j a  v  a2  s.co m*/

    int inAnimResId, outAnimResId;
    switch (mode) {
    case PULL_FROM_END:
        inAnimResId = R.anim.slide_in_from_bottom;
        outAnimResId = R.anim.slide_out_to_bottom;
        setBackgroundResource(R.drawable.indicator_bg_bottom);

        // Rotate Arrow so it's pointing the correct way
        mArrowImageView.setScaleType(ScaleType.MATRIX);
        Matrix matrix = new Matrix();
        matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
        mArrowImageView.setImageMatrix(matrix);
        break;
    default:
    case PULL_FROM_START:
        inAnimResId = R.anim.slide_in_from_top;
        outAnimResId = R.anim.slide_out_to_top;
        setBackgroundResource(R.drawable.indicator_bg_top);
        break;
    }

    mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
    mInAnim.setAnimationListener(this);

    mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
    mOutAnim.setAnimationListener(this);

    final Interpolator interpolator = new LinearInterpolator();
    mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(interpolator);
    mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setFillAfter(true);

    mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    mResetRotateAnimation.setInterpolator(interpolator);
    mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
    mResetRotateAnimation.setFillAfter(true);

}

From source file:test.hugo.ui.ImgShowActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }/*from  w w  w. j ava2  s.  c o m*/
    setContentView(R.layout.activity_sub);
    // start the information passed in the Bundle
    extractViewInfoFromBundle(getIntent());
    vp_data = (ViewPager) findViewById(R.id.vp_data);
    vp_data.setAdapter(new MyAdapter(this));
    initPosition = 1;
    vp_data.setCurrentItem(initPosition);
    vp_data.setOnPageChangeListener(this);
    interpolator = new LinearInterpolator();
}

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

private void initFButton() {
    mFButton.attachToRecyclerView(mRecyclerView);
    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override// ww  w . j a  va 2s .c  o  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;
            mMeiziPresenter.getMeiziData(1);
        }
    });
}

From source file:cn.djangoogle.pull2load.internal.IndicatorLayout.java

public IndicatorLayout(Context context, Pull2LoadBase.Mode mode) {
    super(context);
    mArrowImageView = new ImageView(context);

    Drawable arrowD = ContextCompat.getDrawable(context, R.drawable.indicator_arrow);
    mArrowImageView.setImageDrawable(arrowD);

    final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
    mArrowImageView.setPadding(padding, padding, padding, padding);
    addView(mArrowImageView);//from  ww w .  ja  v  a  2 s  .c o m

    int inAnimResId, outAnimResId;
    switch (mode) {
    case PULL_FROM_END:
        inAnimResId = R.anim.slide_in_from_bottom;
        outAnimResId = R.anim.slide_out_to_bottom;
        setBackgroundResource(R.drawable.indicator_bg_bottom);

        // Rotate Arrow so it's pointing the correct way
        mArrowImageView.setScaleType(ScaleType.MATRIX);
        Matrix matrix = new Matrix();
        matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
        mArrowImageView.setImageMatrix(matrix);
        break;
    default:
    case PULL_FROM_START:
        inAnimResId = R.anim.slide_in_from_top;
        outAnimResId = R.anim.slide_out_to_top;
        setBackgroundResource(R.drawable.indicator_bg_top);
        break;
    }

    mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
    mInAnim.setAnimationListener(this);

    mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
    mOutAnim.setAnimationListener(this);

    final Interpolator interpolator = new LinearInterpolator();
    mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(interpolator);
    mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setFillAfter(true);

    mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    mResetRotateAnimation.setInterpolator(interpolator);
    mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
    mResetRotateAnimation.setFillAfter(true);

}

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

private void initFButton() {
    mFButton.attachToRecyclerView(mRecyclerView);
    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override/*from  www. j a v  a  2s.  c  o 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;
            mDuanziPresenter.getDuanziData(1);
        }
    });
}

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

private void initFButton() {
    mFButton.attachToRecyclerView(mRecyclerView);
    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override/* w w w .jav  a2  s  . c o  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;
            mQiubaiPresenter.getQiubaiData(1);
        }
    });
}