BatteryProgressView.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:BatteryProgressView 作者:
public void setProgress(int progress) {
    lastProgress=this.progress;
    this.progress = progress;
    post(new Runnable() {
        @Override
        public void run() {
            float incr=360/maxProgress;
            Log.e("pogress","last:"+lastProgress+",progress:"+BatteryProgressView.this.progress);
            if(lastProgress<BatteryProgressView.this.progress) {
                Log.e("first",lastProgress+" to "+ (incr * (BatteryProgressView.this.progress))+":"+lastProgress);
                animator = ValueAnimator.ofFloat(incr*lastProgress, incr * (BatteryProgressView.this.progress));
                animator.setDuration(800);
                animator.addUpdateListener(animatorUpdateListener);
                animator.setInterpolator(new DecelerateInterpolator());
                animator.start();
            }else {
                Log.e("second",lastProgress+" to "+ (incr * (BatteryProgressView.this.progress))+":"+lastProgress);
                animator = ValueAnimator.ofFloat((incr*lastProgress), incr * (BatteryProgressView.this.progress));
                animator.setDuration(800);
                animator.addUpdateListener(animatorUpdateListener);
                animator.setInterpolator(new DecelerateInterpolator());
                animator.start();
            }
        }
    });

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号