| | |
| | | private Bitmap mBitmap; |
| | | |
| | | private float percent = 0;//百分比数据 |
| | | private float percent2 = (float) 0.27;//百分比数据 |
| | | private float percent2 = 0;//百分比数据 |
| | | |
| | | |
| | | private String statusStr = "未连接"; |
| | |
| | | } |
| | | |
| | | public void setPercent(float percent) { |
| | | this.percent = percent; |
| | | // this.percent2 = percent; |
| | | postInvalidate(); |
| | | // if (anim.isStarted() || anim.isRunning()) { |
| | | // anim.end(); |
| | | // anim.cancel(); |
| | | // } |
| | | // anim.start(); |
| | | this.percent2 = percent; |
| | | startAnimation(); |
| | | } |
| | | |
| | | public PanelView(Context context) { |
| | |
| | | mBitPaint.setFilterBitmap(true); |
| | | mBitPaint.setDither(true); |
| | | mBitmap = ((BitmapDrawable) mContext.getResources().getDrawable(R.mipmap.zhizhen)).getBitmap(); |
| | | // startAnimation(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | setMeasuredDimension(mmWidth, mmHeight); |
| | | } |
| | | |
| | | // private void startAnimation() { |
| | | // anim = ValueAnimator.ofObject(new CustomPointEvaluator(),(float)0, percent2); |
| | | // anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | // @Override |
| | | // public void onAnimationUpdate(ValueAnimator animation) { |
| | | // percent = (float) animation.getAnimatedValue(); |
| | | // System.out.println("chenqi rotato " + percent + " all -> " + percent2 * 300); |
| | | //// invalidate(); |
| | | // } |
| | | // }); |
| | | // anim.setDuration(3000L); |
| | | // anim.setRepeatCount(Animation.INFINITE); |
| | | // } |
| | | private void startAnimation() { |
| | | anim = ValueAnimator.ofFloat((float) percent, percent2); |
| | | anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | @Override |
| | | public void onAnimationUpdate(ValueAnimator animation) { |
| | | percent = (float) animation.getAnimatedValue(); |
| | | postInvalidate(); |
| | | } |
| | | }); |
| | | anim.setDuration(500L); |
| | | anim.start(); |
| | | } |
| | | // |
| | | // private class CustomPointEvaluator implements TypeEvaluator<Float> { |
| | | // @Override |