Search in sources :

Example 26 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project remusic by aa112901.

the class RoundFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    //        animatorWeakReference = new  WeakReference<ObjectAnimator>(new ObjectAnimator());
    //        animator = animatorWeakReference.get();
    animatorWeakReference = new WeakReference(ObjectAnimator.ofFloat(getView(), "rotation", new float[] { 0.0F, 360.0F }));
    animator = animatorWeakReference.get();
    //animator = ObjectAnimator.ofFloat(getView(), "rotation", new float[]{0.0F, 360.0F});
    animator.setRepeatCount(Integer.MAX_VALUE);
    animator.setDuration(25000L);
    animator.setInterpolator(new LinearInterpolator());
    if (getView() != null)
        getView().setTag(R.id.tag_animator, this.animator);
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) WeakReference(java.lang.ref.WeakReference)

Example 27 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project remusic by aa112901.

the class RecommendFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContent = (ViewGroup) inflater.inflate(R.layout.fragment_recommend_container, container, false);
    mLayoutInflater = LayoutInflater.from(mContext);
    mRecommendView = mLayoutInflater.inflate(R.layout.recommend, container, false);
    String date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "";
    TextView dailyText = (TextView) mRecommendView.findViewById(R.id.daily_text);
    dailyText.setText(date);
    mItemLayout = (LinearLayout) mRecommendView.findViewById(R.id.item_change);
    mViewContent = (LinearLayout) mRecommendView.findViewById(R.id.recommend_layout);
    if (!PreferencesUtility.getInstance(mContext).isCurrentDayFirst(date)) {
        PreferencesUtility.getInstance(mContext).setCurrentDate(date);
        View dayRec = mLayoutInflater.inflate(R.layout.loading_daymusic, container, false);
        ImageView view1 = (ImageView) dayRec.findViewById(R.id.loading_dayimage);
        RotateAnimation rotateAnimation = new RotateAnimation(0, 360, 1, 0.5F, 1, 0.5F);
        rotateAnimation.setDuration(20000L);
        rotateAnimation.setInterpolator(new LinearInterpolator());
        rotateAnimation.setRepeatCount(Animation.INFINITE);
        rotateAnimation.setRepeatMode(Animation.INFINITE);
        view1.startAnimation(rotateAnimation);
        isDayFirst = true;
        mContent.addView(dayRec);
    }
    mLoadView = mLayoutInflater.inflate(R.layout.loading, null, false);
    mItemLayout.setVisibility(View.INVISIBLE);
    mViewContent.addView(mLoadView);
    mRecomendAdapter = new RecommendAdapter(null);
    mNewAlbumsAdapter = new NewAlbumsAdapter(null);
    mRadioAdapter = new RadioAdapter(null);
    TextView change = (TextView) mRecommendView.findViewById(R.id.change_item_position);
    change.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent itent = new Intent(mContext, NetItemChangeActivity.class);
            mContext.startActivity(itent);
        }
    });
    mLoodView = (LoodView) mRecommendView.findViewById(R.id.loop_view);
    if (!isDayFirst) {
        mContent.addView(mRecommendView);
    }
    return mContent;
}
Also used : Intent(android.content.Intent) SpannableString(android.text.SpannableString) ImageView(android.widget.ImageView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) LoodView(com.wm.remusic.widget.LoodView) NetItemChangeActivity(com.wm.remusic.activity.NetItemChangeActivity) RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 28 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project FastDev4Android by jiangqqlmj.

the class PullToRefreshListView method init.

private void init(Context context) {
    mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mFlipAnimation.setInterpolator(new LinearInterpolator());
    mFlipAnimation.setDuration(250);
    mFlipAnimation.setFillAfter(true);
    mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
    mReverseFlipAnimation.setDuration(250);
    mReverseFlipAnimation.setFillAfter(true);
    mRefreshView = (LinearLayout) View.inflate(context, R.layout.pull_to_refresh_header, null);
    mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
    mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
    mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
    mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
    mRefreshState = PULL_TO_REFRESH;
    //设置下拉最小的高度为50
    mRefreshViewImage.setMinimumHeight(50);
    setFadingEdgeLength(0);
    setHeaderDividersEnabled(false);
    //把refreshview加入到listview的头部
    addHeaderView(mRefreshView);
    super.setOnScrollListener(this);
    mRefreshView.setOnClickListener(this);
    mRefreshView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    mRefreshViewHeight = mRefreshView.getMeasuredHeight();
    mRefreshOriginalTopPadding = -mRefreshViewHeight;
    resetHeaderPadding();
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator)

Example 29 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project XRecyclerView by jianghejie.

the class BallScaleIndicator method createAnimation.

@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1);
    scaleAnim.setInterpolator(new LinearInterpolator());
    scaleAnim.setDuration(1000);
    scaleAnim.setRepeatCount(-1);
    scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            scale = (float) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    scaleAnim.start();
    ValueAnimator alphaAnim = ValueAnimator.ofInt(255, 0);
    alphaAnim.setInterpolator(new LinearInterpolator());
    alphaAnim.setDuration(1000);
    alphaAnim.setRepeatCount(-1);
    alphaAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            alpha = (int) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    alphaAnim.start();
    animators.add(scaleAnim);
    animators.add(alphaAnim);
    return animators;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) ArrayList(java.util.ArrayList) ValueAnimator(android.animation.ValueAnimator)

Example 30 with LinearInterpolator

use of android.view.animation.LinearInterpolator in project XRecyclerView by jianghejie.

the class BallScaleMultipleIndicator method createAnimation.

@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    long[] delays = new long[] { 0, 200, 400 };
    for (int i = 0; i < 3; i++) {
        final int index = i;
        ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1);
        scaleAnim.setInterpolator(new LinearInterpolator());
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.start();
        ValueAnimator alphaAnim = ValueAnimator.ofInt(255, 0);
        alphaAnim.setInterpolator(new LinearInterpolator());
        alphaAnim.setDuration(1000);
        alphaAnim.setRepeatCount(-1);
        alphaAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                alphaInts[index] = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.setStartDelay(delays[i]);
        alphaAnim.start();
        animators.add(scaleAnim);
        animators.add(alphaAnim);
    }
    return animators;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) ArrayList(java.util.ArrayList) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Aggregations

LinearInterpolator (android.view.animation.LinearInterpolator)209 ValueAnimator (android.animation.ValueAnimator)59 Animator (android.animation.Animator)42 ObjectAnimator (android.animation.ObjectAnimator)40 Paint (android.graphics.Paint)30 ArrayList (java.util.ArrayList)28 AlphaAnimation (android.view.animation.AlphaAnimation)27 RotateAnimation (android.view.animation.RotateAnimation)24 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)22 PropertyValuesHolder (android.animation.PropertyValuesHolder)18 Animatable (android.graphics.drawable.Animatable)17 Animation (android.view.animation.Animation)17 Transformation (android.view.animation.Transformation)17 View (android.view.View)16 AnimatorSet (android.animation.AnimatorSet)15 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)9 AnimationListener (android.view.animation.Animation.AnimationListener)8