[*]
陈奇
2018-11-27 a45036d4003974f8e78eb819a932895291d677d6
app/src/main/java/com/moral/yunfushao/ui/PanelView.java
@@ -76,7 +76,7 @@
    private Bitmap mBitmap;
    private float percent = 0;//百分比数据
    private float percent2 = (float) 0.27;//百分比数据
    private float percent2 = 0;//百分比数据
    private String statusStr = "未连接";
@@ -88,14 +88,8 @@
    }
    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) {
@@ -160,7 +154,6 @@
        mBitPaint.setFilterBitmap(true);
        mBitPaint.setDither(true);
        mBitmap = ((BitmapDrawable) mContext.getResources().getDrawable(R.mipmap.zhizhen)).getBitmap();
//        startAnimation();
    }
    @Override
@@ -184,19 +177,18 @@
        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