Java 类android.view.animation.LinearInterpolator 实例源码

项目:AndroidShareElement    文件:ShareElementActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setTheme(R.style.AppTheme);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_share_element);
    mImageView = (ImageView) findViewById(R.id.image_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mImageView.setTransitionName(MainActivity.TRANSITION_NAME_SHARE);
    } else {
        ShareElementInfo info = getIntent().getExtras().getParcelable(MainActivity.EXTRA_SHARE_ELEMENT_INFO);
        mShareElement = new FKJShareElement(info, this, mImageView.getRootView());
        mShareElement.convert(mImageView)
                .setDuration(ANIMATOR_DURATION)
                .setInterpolator(new LinearInterpolator())
                .startEnterAnimator();
    }
}
项目:MyLoadingViews    文件:IndicatorLoadingView.java   
/**
 * 开始旋转
 *
 * @param start
 * @param end
 * @param time
 */
private void startAnim(int start, final int end, long time) {
    isAround = true;
    mCurrentMode = MODE_ROTATE;
    mValueAnimator = ValueAnimator.ofInt(start, end);
    mValueAnimator.setDuration(time);
    mValueAnimator.setRepeatCount(getRepeatCount());
    mValueAnimator.setRepeatMode(ValueAnimator.RESTART);
    mValueAnimator.setInterpolator(new LinearInterpolator());
    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (currentValue != (int) (animation.getAnimatedValue())) {
                onAnimatorUpdate(animation);
            }
        }
    });
    mValueAnimator.start();
}
项目:XRadarView    文件:XRadarView.java   
public void loadAnimation(boolean enabled) {
    if (!enabled) {
        currentScale = 1;
        invalidate();
    } else {
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(0.3f, 1.0f);
        valueAnimator.setInterpolator(new LinearInterpolator());
        valueAnimator.setDuration(animDuration);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                currentScale = (float) animation.getAnimatedValue();
                invalidate();
            }
        });
        valueAnimator.start();
    }
}
项目:RLibrary    文件:SimpleProgressBar.java   
private void startIncertitudeAnimator() {
    if (mColorAnimator == null) {
        mColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mProgressColor, SkinHelper.getTranColor(mProgressColor, 0x10));
        mColorAnimator.setInterpolator(new LinearInterpolator());
        mColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                drawColor = (int) animation.getAnimatedValue();//之后就可以得到动画的颜色了.
                postInvalidate();
            }
        });
        mColorAnimator.setDuration(1000);
        mColorAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
    }
    mColorAnimator.start();
}
项目:GitHub    文件:PullToRefreshListView.java   
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;
    mRefreshViewImage.setMinimumHeight(50); //设置下拉最小的高度为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();
}
项目:Dachshund-Tab-Layout    文件:LineFadeIndicator.java   
public LineFadeIndicator(DachshundTabLayout dachshundTabLayout) {
    this.dachshundTabLayout = dachshundTabLayout;

    valueAnimator = new ValueAnimator();
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.setDuration(DEFAULT_DURATION);
    valueAnimator.addUpdateListener(this);
    valueAnimator.setIntValues(0,255);

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);

    rectF = new RectF();

    startXLeft = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
    startXRight = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());

    edgeRadius = -1;
}
项目:BookReader-master    文件:ReadEPubActivity.java   
private void toolbarAnimateHide() {
    if (mIsActionBarVisible) {
        mCommonToolbar.animate()
                .translationY(-mCommonToolbar.getHeight())
                .setInterpolator(new LinearInterpolator())
                .setDuration(180)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        toolbarSetElevation(0);
                        hideStatusBar();
                        if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
                            mTocListPopupWindow.dismiss();
                        }
                    }
                });
        mIsActionBarVisible = false;
    }
}
项目:floating_calc    文件:AnimatingDrawable.java   
private AnimatingDrawable(Drawable[] frames, long duration) {
    mFrames = frames;
    mAnimator = ValueAnimator.ofInt(0, mFrames.length - 1);
    mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            // Normalize the position in case the interporator isn't linear
            int pos = Math.max(Math.min((int) animation.getAnimatedValue(), mFrames.length - 1), 0);
            setFrame(mFrames[pos]);
        }
    });
    mAnimator.setDuration(duration);
    mAnimator.setInterpolator(new LinearInterpolator());

    // Calculate the largest drawable, and use that as our intrinsic width/height
    for (Drawable drawable : mFrames) {
        mIntrinsicWidth = Math.max(mIntrinsicWidth, drawable.getIntrinsicWidth());
        mIntrinsicHeight = Math.max(mIntrinsicHeight, drawable.getIntrinsicWidth());
    }

    setFrame(mFrames[0]);
}
项目:RetroMusicPlayer    文件:ScrollAwareFABBehavior.java   
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
                           @NonNull FloatingActionButton child,
                           @NonNull View target,
                           int dxConsumed,
                           int dyConsumed,
                           int dxUnconsumed,
                           int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

    //child -> Floating Action Button
    if (dyConsumed > 0) {
        Log.d("Scrolling", "Up");
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fab_bottomMargin = layoutParams.bottomMargin;
        child.animate().translationY(child.getHeight() + fab_bottomMargin).setInterpolator(new LinearInterpolator()).start();
    } else if (dyConsumed < 0) {
        Log.d("Scrolling", "down");
        child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
    }
}
项目:NeteaseCloudMusic    文件:ScanMusicActivity.java   
private void initAnimations() {
    searchAnimation = ValueAnimator.ofFloat(0f, 1f);
    searchAnimation.setDuration(50000);
    searchAnimation.setRepeatCount(ValueAnimator.INFINITE);
    searchAnimation.setRepeatMode(ValueAnimator.RESTART);
    searchAnimation.setInterpolator(new LinearInterpolator());
    searchAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float angle = (valueAnimator.getAnimatedFraction() * 360);
            ViewHelper.setTranslationX(ivSearch, (float) Math.sin(angle) * radius);
            ViewHelper.setTranslationY(ivSearch, (float) Math.cos(angle) * radius);
        }
    });


    scanAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.61f);
    scanAnimation.setDuration(2000);
    scanAnimation.setRepeatCount(TranslateAnimation.INFINITE);
    scanAnimation.setRepeatMode(TranslateAnimation.RESTART);
}
项目:FriskyImage    文件:FriskyTanslations.java   
public void MoveXBy(float distance,long duration,final boolean StopRotationAtCurrentAngle)
{
    final FriskyTanslations friskyTanslations1 =this;
    Runnable runnable=new Runnable() {
        @Override
        public void run() {

                if(StopRotationAtCurrentAngle)
                {
                    friskyTanslations1.StopCrazyRotationAtCurrentAngle();
                }
                else
                {
                    friskyTanslations1.StopCrazyRotationAtAngle(0);

                }


        }
    };
    view.animate().translationXBy(distance).setInterpolator(new LinearInterpolator()).withEndAction(runnable).setDuration(duration).start();


}
项目:CXJPadProject    文件:AnimationUtil.java   
public static void rotate(View v){
    //创建旋转动画 对象   fromDegrees:旋转开始的角度  toDegrees:结束的角度
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    //设置动画的显示时间
    rotateAnimation.setDuration(1000);
    //设置动画重复播放几次
    rotateAnimation.setRepeatCount(RotateAnimation.INFINITE);
    //设置动画插值器
    rotateAnimation.setInterpolator(new LinearInterpolator());
    //设置动画重复播放的方式,翻转播放
    rotateAnimation.setRepeatMode(Animation.RESTART);
    //拿着imageview对象来运行动画效果
    v.setAnimation(rotateAnimation);
}
项目:FriskyImage    文件:FriskyRotating.java   
public void CustomOscillation(int startAngle, final int MaxAngleOfRotation,final int TimeToReachStartAngle,final int TimePeriodOfOscillation)
{
     runnable1 = new Runnable() {
        @Override
        public void run() {
            imageView.animate().rotationBy((-1)*MaxAngleOfRotation).withEndAction(runnable2).setDuration(TimePeriodOfOscillation).setInterpolator(new LinearInterpolator()).start();
        }
    };

    runnable2 = new Runnable() {
        @Override
        public void run() {
            imageView.animate().rotationBy(MaxAngleOfRotation).withEndAction(runnable1).setDuration(TimePeriodOfOscillation).setInterpolator(new LinearInterpolator()).start();
        }
    };

    imageView.animate().rotationBy(startAngle).withEndAction(runnable1).setDuration(TimeToReachStartAngle).setInterpolator(new LinearInterpolator()).start();

}
项目:FriskyImage    文件:FriskyRotating.java   
public void StopCrazyRotationAtCurrentAngle()
{
    runnable1 = new Runnable() {
        @Override
        public void run() {
            imageView.animate().rotationBy(0).withEndAction(runnable2).setDuration(0).setInterpolator(new LinearInterpolator()).start();
        }
    };

    runnable2 = new Runnable() {
        @Override
        public void run() {
            imageView.animate().rotationBy(0).withEndAction(runnable1).setDuration(0).setInterpolator(new LinearInterpolator()).start();
        }
    };

    imageView.animate().rotationBy(0).withEndAction(runnable1).setDuration(0).setInterpolator(new LinearInterpolator()).start();

}
项目:SunmiUI    文件:LoadView.java   
private void init(){
    mView = getView();
    mText = (TextView)mView.findViewById(R.id.txt);
    img = (ImageView)mView.findViewById(R.id.img);
    Animation operatingAnim = AnimationUtils.loadAnimation(getContext(), R.anim.loading_anim);
    LinearInterpolator lin = new LinearInterpolator();
    operatingAnim.setInterpolator(lin);
    img.setAnimation(operatingAnim);
    img.startAnimation(operatingAnim);
}
项目:GracefulMovies    文件:BackgroundDrawableSwitchCompat.java   
private void startAnimation(boolean firstToSecond) {
        if (animator != null) {
            animator.cancel();
        }
        animator = ValueAnimator.ofInt(firstToSecond ? OPAQUE : TRANSPARENT, firstToSecond ? TRANSPARENT : OPAQUE);
        animator.setDuration(THUMB_ANIMATION_DURATION);
        animator.setInterpolator(new LinearInterpolator());
//        animator.setRepeatMode(ValueAnimator.RESTART);
//        animator.setRepeatCount(ValueAnimator.INFINITE);

        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                mFirstDrawableAlpha = (int) animation.getAnimatedValue();
                mSecondDrawableAlpha = OPAQUE - (int) animation.getAnimatedValue();
                invalidate();
            }
        });

        animator.start();
    }
项目:widgetlab    文件:BouncingSlidingDotView.java   
@NonNull
private AnimatorSet getMoveAnimator(long ratioAnimationTotalDuration) {
    AnimatorSet moveAnimatorSet = new AnimatorSet();

    ValueAnimator slidingAnimator = ValueAnimator.ofInt(startLeft, 0);
    slidingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            targetLeft = (int) animator.getAnimatedValue();
            invalidate();
        }
    });
    slidingAnimator.setInterpolator(new LinearInterpolator());
    slidingAnimator.setDuration(ratioAnimationTotalDuration);

    AnimatorSet bounceSet = getBounceAnimatorSet(ratioAnimationTotalDuration);

    moveAnimatorSet.playTogether(slidingAnimator, bounceSet);
    return moveAnimatorSet;
}
项目:passman-android    文件: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));
    }

    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);
        }
    };
}
项目:PageScrollView    文件:PageScrollTab.java   
public void smoothScroll(int from, int to, Animation.AnimationListener l) {
    int childCount = getItemCount();
    if (from >= 0 && to >= 0 && (from < childCount && to < childCount)) {
        if (getAnimation() != null) {
            getAnimation().cancel();
            clearAnimation();
        }
        boolean horizontal = mOrientation == HORIZONTAL;
        int scrollFrom = computeScrollOffset(getVirtualChildAt(from, true), 0, false, horizontal);
        int scrollTo = computeScrollOffset(getVirtualChildAt(to, true), 0, false, horizontal);
        if (scrollTo != scrollFrom) {
            int absDx = Math.abs(scrollTo - scrollFrom);
            ScrollAnimation anim = new ScrollAnimation(scrollFrom, scrollTo);
            int measureWidth = getMeasuredWidth();
            if (measureWidth == 0) {
                measureWidth = Math.max(getSuggestedMinimumWidth(), 1);
            }
            anim.setDuration(Math.min(4000, absDx * 1800 / measureWidth));
            anim.setInterpolator(new LinearInterpolator());
            anim.setAnimationListener(l);
            startAnimation(anim);
        }
    }
}
项目:AndroidSkinAnimator    文件:AlphaHideAnimator.java   
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0)
    );
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new LinearInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
项目:yyox    文件:RefreshListView.java   
private void init(Context context) {
    inflater = LayoutInflater.from(context);
    headView = (LinearLayout) inflater.inflate(R.layout.kf5_list_head, null);
    arrowImageView = (ImageView) headView.findViewById(R.id.kf5_head_arrowImageView);
    arrowImageView.setMinimumWidth(70);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.kf5_head_progressBar);
    tipsTextview = (TextView) headView.findViewById(R.id.kf5_head_tipsTextView);
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.kf5_head_lastUpdatedTextView);
    measureView(headView);
    headContentHeight = headView.getMeasuredHeight();
    headContentWidth = headView.getMeasuredWidth();
    headView.setPadding(0, -1 * headContentHeight, 0, 0);
    headView.invalidate();
    addHeaderView(headView);
    setOnScrollListener(this);
    animation = new RotateAnimation(0, -180,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true);
    reverseAnimation = new RotateAnimation(-180, 0,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(200);
    reverseAnimation.setFillAfter(true);

    state = DONE;
    isRefreshable = false;
}
项目:MVVMFrames    文件:BlurEngine.java   
@Override
@SuppressLint("NewApi")
protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);

    view.destroyDrawingCache();
    view.setDrawingCacheEnabled(false);

    activity.getWindow().addContentView(
            blurredBackgroundView,
            blurredBackgroundLayoutParams
    );

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        blurredBackgroundView.setAlpha(0f);
        blurredBackgroundView
                .animate()
                .alpha(1f)
                .setDuration(300)
                .setInterpolator(new LinearInterpolator())
                .start();
    }
    view = null;
    bitmap = null;
}
项目:BrotherWeather    文件:CustomRefreshLayout.java   
private void startLoadingAnimation(ImageView imageView) {
  RotateAnimation loadingAnimation =
      new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
          0.5f);
  loadingAnimation.setDuration(1000);
  loadingAnimation.setRepeatCount(-1);
  loadingAnimation.setInterpolator(new LinearInterpolator());
  loadingAnimation.setFillAfter(false);
  imageView.setAnimation(loadingAnimation);
  loadingAnimation.start();
}
项目:TreebolicLib    文件:Animator.java   
@Override
public boolean run(final ActionListener thisListener, final int theseSteps, final int startDelay)
{
    // Log.d(Animator.TAG, "animate steps " + theseSteps);
    this.theLastStep = theseSteps - 1;
    this.theListener = thisListener;
    this.theAnimator = ValueAnimator.ofInt(0, this.theLastStep);
    this.theAnimator.setRepeatCount(0);
    this.theAnimator.setDuration(1000);
    this.theAnimator.setStartDelay(startDelay);
    this.theAnimator.setInterpolator(new LinearInterpolator());
    this.theAnimator.addUpdateListener(this);
    this.theAnimator.addListener(this);
    this.theAnimator.start();
    return true;
}
项目:boohee_v5.6    文件:VideoPlayActivity.java   
private void updateProgress() {
    if (this.progressAnimator != null && this.progressAnimator.isRunning()) {
        this.progressAnimator.end();
    }
    double progress = (double) (((this.mentionIndex * 1000) + ((this.playCountNum * 1000) /
            this.currentMention.number)) / this.totalMetionCount);
    this.progressAnimator = ObjectAnimator.ofInt(this.progressBar, "progress", new int[]{
            (int) progress});
    if (this.currentMention.is_times) {
        this.progressAnimator.setDuration(((long) this.currentMention.rate) * 1000);
    } else {
        this.progressAnimator.setDuration(1000);
    }
    this.progressAnimator.setInterpolator(new LinearInterpolator());
    this.progressAnimator.start();
}
项目:secretknock    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
    editor = sharedPreferences.edit();

    an = new RotateAnimation(0.0f,
            360.0f,Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF,
            0.5f);

    // Set the animation's parameters
    an.setInterpolator(new LinearInterpolator());
    an.setDuration(7000);               // duration in ms
    an.setRepeatCount(-1);                // -1 = infinite repeated
}
项目:Musicoco    文件:AlbumSurfaceView.java   
@Override
public void run() {

    rotateAnim = ObjectAnimator.ofInt(0, 360);
    rotateAnim.setInterpolator(new LinearInterpolator());
    rotateAnim.setRepeatCount(ValueAnimator.INFINITE);
    rotateAnim.setRepeatMode(ValueAnimator.RESTART);
    rotateAnim.setDuration(40000);
    rotateAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            rotateAngle = (int) animation.getAnimatedValue();
            repaint();
        }
    });

    Looper.prepare();
    mLooper = Looper.myLooper();
    handler = new DrawHandler(Looper.myLooper());
    repaint();
    Looper.loop();
}
项目:BilibiliClient    文件:LoveLikeLayout.java   
/**
 * 爱心的显示动画实现
 */
private AnimatorSet getEnterAnimtorSet(View target) {
  //爱心的3中动画组合 透明度 x,y轴的缩放
  ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
  ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
  ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);

  //组合动画
  AnimatorSet set = new AnimatorSet();
  set.setDuration(500);
  set.setInterpolator(new LinearInterpolator());
  set.playTogether(alpha, scaleX, scaleY);
  set.setTarget(target);

  return set;
}
项目:RefreshLoadLayout    文件:DefaultRefreshIndicator.java   
private void initAnimation() {
    LinearInterpolator linearInterpolator=new LinearInterpolator();
    flipUpAnimation =new RotateAnimation(0,-180,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
    flipUpAnimation.setDuration(FLIP_DURATION);
    flipUpAnimation.setFillAfter(true);
    flipUpAnimation.setInterpolator(linearInterpolator);

    flipDownAnimation=new RotateAnimation(-180,0,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
    flipDownAnimation.setDuration(FLIP_DURATION);
    flipDownAnimation.setFillAfter(true);
    flipDownAnimation.setInterpolator(linearInterpolator);

    infiniteRotation=new RotateAnimation(0,360,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
    infiniteRotation.setDuration(ROTATE_DURATION);
    infiniteRotation.setRepeatCount(Animation.INFINITE);
    infiniteRotation.setInterpolator(linearInterpolator);
}
项目:TextReader    文件:ReadEPubActivity.java   
private void toolbarAnimateHide() {
    if (mIsActionBarVisible) {
        mCommonToolbar.animate()
                .translationY(-mCommonToolbar.getHeight())
                .setInterpolator(new LinearInterpolator())
                .setDuration(180)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        toolbarSetElevation(0);
                        hideStatusBar();
                        if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
                            mTocListPopupWindow.dismiss();
                        }
                    }
                });
        mIsActionBarVisible = false;
    }
}
项目:ImitateZHRB    文件:SquareSpinIndicator.java   
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
项目:revolution-irc    文件:LabelLayout.java   
public LabelLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);
    setAddStatesFromChildren(true);

    mInputFrame = new FrameLayout(context);
    mInputFrame.setAddStatesFromChildren(true);
    super.addView(mInputFrame, -1, generateDefaultLayoutParams());

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(Typeface.DEFAULT);// getTypeface());
    mTextSizeCollapsed = getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material);
    mTextSizeExpanded = getResources().getDimensionPixelSize(R.dimen.abc_text_size_medium_material);
    mTextPaint.setTextSize(mTextSizeCollapsed);

    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context, attrs,
            new int[] { R.attr.doNotExpand, android.R.attr.hint, android.R.attr.textColorHint });
    try {
        mDoNotExpand = ta.getBoolean(R.attr.doNotExpand, false);
        mHint = ta.getString(android.R.attr.hint);
        mTextColorUnfocused = ta.getColorStateList(android.R.attr.textColorHint);
    } finally {
        ta.recycle();
    }
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused.getColorForState(getDrawableState(), mTextColorUnfocused.getDefaultColor()));

    mAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setDuration(200);
    mAnimator.addUpdateListener((ValueAnimator animation) -> {
        mAnimState = (float) animation.getAnimatedValue();
        invalidate();
    });

    updateTopMargin();
    updateTextPositions();
}
项目:Slide-RSS    文件:ToolbarScrollHideHandler.java   
private void toolbarAnimateShow(final int verticalOffset) {
    mAppBar.animate()
            .translationY(0)
            .setInterpolator(new LinearInterpolator())
            .setDuration(180);
    if (extra != null)
        extra.animate()
                .translationY(0)
                .setInterpolator(new LinearInterpolator())
                .setDuration(180);
}
项目:Make-A-Pede-Android-App    文件:ControllerActivity.java   
@Override
public void onBluetoothConnectionEvent(String event) {
    switch (event) {
        case ACTION_CONNECTED:
            progress.hide();
            bluetoothConnection.subscribeToHeadingNotifications((heading) -> {
                if(heading != null) {
                    int r = 360 - (int) (Float.parseFloat(heading));

                    int headingDelta = r-currentHeading;
                    currentHeading = r;

                    headingIndicator.setVisibility(View.VISIBLE);

                    headingIndicator.animate()
                                    .rotationBy(headingDelta)
                                    .setDuration(99)
                                    .setInterpolator(new LinearInterpolator())
                                    .start();
                }
            });
            break;

        case ACTION_DISCONNECTED:
        case ACTION_ERROR:
            finish();
            break;
    }
}
项目:LJFramework    文件:LoadingRefreshHeader.java   
private Animator createLoadingAnimator() {
    ObjectAnimator rotation = ObjectAnimator
            .ofFloat(mImgLoading, "rotation", 0, 360);
    //RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotation.setRepeatCount(ObjectAnimator.INFINITE);
    rotation.setRepeatMode(ObjectAnimator.RESTART);
    rotation.setInterpolator(new LinearInterpolator());
    rotation.setDuration(mLoadingTime);
    return rotation;
}
项目:loaderviewlibrary-shading    文件:LoaderController.java   
private void setValueAnimator(float begin, float end, int repeatCount) {
    valueAnimator = ValueAnimator.ofFloat(begin, end);
    valueAnimator.setRepeatCount(repeatCount);
    valueAnimator.setDuration(ANIMATION_CYCLE_DURATION);
    valueAnimator.setRepeatMode(ValueAnimator.REVERSE);
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float) animation.getAnimatedValue();
            loaderView.invalidate();
        }
    });
}
项目:AndroidSkinAnimator    文件:ScaleAnimator.java   
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("ScaleX",
                    1, 0),
            PropertyValuesHolder.ofFloat("ScaleY",
                    1, 0))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new LinearInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("ScaleX",
                    0, 1),
            PropertyValuesHolder.ofFloat("ScaleY",
                    0, 1))
            .setDuration(AFTER_DURATION * 2);
    afterAnimator.setInterpolator(new OvershootInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });

    return this;
}
项目:GitHub    文件:LoadingView.java   
private void buildAnimator() {
    final ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(ANIMATOR_DURATION);
    valueAnimator.setRepeatCount(-1);
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mRotation = (float) valueAnimator.getAnimatedValue();
            invalidate();
        }
    });
    animator = valueAnimator;
    animatorSet = buildFlexibleAnimation();
    animatorSet.addListener(animatorListener);
}
项目:GitHub    文件:ReadEPubActivity.java   
private void toolbarAnimateShow(final int verticalOffset) {
    showStatusBar();
    mCommonToolbar.animate()
            .translationY(0)
            .setInterpolator(new LinearInterpolator())
            .setDuration(180)
            .setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationStart(Animator animation) {
                    toolbarSetElevation(verticalOffset == 0 ? 0 : 1);
                }
            });

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (mIsActionBarVisible) {
                        toolbarAnimateHide();
                    }
                }
            });
        }
    }, 10000);

    mIsActionBarVisible = true;
}
项目:mediasession-mediaplayer    文件:MediaSeekBar.java   
@Override
public void onPlaybackStateChanged(PlaybackStateCompat state) {
    super.onPlaybackStateChanged(state);

    // If there's an ongoing animation, stop it now.
    if (mProgressAnimator != null) {
        mProgressAnimator.cancel();
        mProgressAnimator = null;
    }

    final int progress = state != null
            ? (int) state.getPosition()
            : 0;
    setProgress(progress);
    Log.d("nicole", "Set progress to: " + (progress / 1000.0f));

    // If the media is playing then the seekbar should follow it, and the easiest
    // way to do that is to create a ValueAnimator to update it so the bar reaches
    // the end of the media the same time as playback gets there (or close enough).
    if (state != null && state.getState() == PlaybackStateCompat.STATE_PLAYING) {
        final int timeToEnd = (int) ((getMax() - progress) / state.getPlaybackSpeed());

        mProgressAnimator = ValueAnimator.ofInt(progress, getMax())
                .setDuration(timeToEnd);
        mProgressAnimator.setInterpolator(new LinearInterpolator());
        mProgressAnimator.addUpdateListener(this);
        mProgressAnimator.start();
    }
}