From 560d53cafc4aa81b949d3a0b46e1e5837b47f775 Mon Sep 17 00:00:00 2001 From: haijiang <181069201@qq.com> Date: Fri, 20 Apr 2018 11:59:03 +0800 Subject: [PATCH] 修复bug --- app/src/main/java/com/moral/yunfushao/ui/PanelView.java | 88 ++++++++++++++++++++++++++++---------------- 1 files changed, 56 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/com/moral/yunfushao/ui/PanelView.java b/app/src/main/java/com/moral/yunfushao/ui/PanelView.java index afba247..0a9bf10 100644 --- a/app/src/main/java/com/moral/yunfushao/ui/PanelView.java +++ b/app/src/main/java/com/moral/yunfushao/ui/PanelView.java @@ -28,7 +28,11 @@ private int mmHeight; //��������������������������� private Paint mShaderPaint; - private int[] mshaderColor = new int[]{Color.RED, Color.RED, Color.GREEN, Color.GREEN, Color.YELLOW, Color.YELLOW, Color.RED}; + private int[] mshaderColor = new int[]{0xfff70e17,0xfff70e17,0xfff70e17,0xffff5c92,0xff00c44a,0xff00d062,0xff00f5af,0xff00f6cb,0xff00ccff,0xff179fff,0xffa054ff,0xffa53aff,0xffd74bff,0xfff64da5,0xfff70e17}; + private int[] mshaderRedColor = new int[]{0xfff70e17,0xffff5c92}; + private int[] mshaderZiseColor = new int[]{0xffa53aff,0xffd74bff,0xfff64da5}; + private int[] mshaderBlueColor = new int[]{0xff00f6cb,0xff00ccff,0xff179fff,0xffa054ff}; + private int[] mshaderGreenColor = new int[]{0xff00c44a,0xff00d062,0xff00f5af}; //������������������������ private SweepGradient mSweepGradient; private int mShaderWidth = 70; @@ -36,11 +40,11 @@ private Paint paintGapLine; //������������������3����������� - private int line1Color = 0xFFFAEAEB; + private int line1Color = 0xffb8e8f4; //������������������15����������� - private int line2Color = 0xFFFEB7B9; + private int line2Color = 0xff7ed3ff; //������������������60����������� - private int line3Color = 0xFFFF6C7E; + private int line3Color = 0xff009cff; //������������ private int line1Length = 50; //������������ @@ -55,16 +59,16 @@ private Paint drawTextPaint; private int textColor = Color.GRAY; private int textSize = 36; - private String[] level = {"������","���������","������������","������������","���������"}; + private String[] level = {"������������","������������","������������","������������"}; //������������ private Paint mCirclePaint; - private int innerCircleColor = 0xFFF6DFE1; + private int innerCircleColor = 0xffb8e8f4; private int mCircleWidth = 70; private int innerPadding = 20; //��������� private Paint mProgressPaint; - private int progressCircleColor = 0xFFFEB7B9; + private int progressCircleColor = 0xff53c9ff; //��������� private Paint mBitPaint; @@ -253,48 +257,73 @@ drawTextPaint.setColor(Color.GRAY); } canvas.save(); - canvas.rotate(-120+i*60,mWidth/2,mWidth/2); + if(i==0){ + canvas.rotate(-120,mWidth/2,mWidth/2); + }else if(i==1){ + canvas.rotate(-45,mWidth/2,mWidth/2); + }else if(i==2){ + canvas.rotate(45,mWidth/2,mWidth/2); + }else if(i==3){ + canvas.rotate(120,mWidth/2,mWidth/2); + } canvas.drawText(level[i],mWidth / 2-textWidth/2, paddingKedu+line2Length+textSize,drawTextPaint); canvas.restore(); - }else if(percent<0.25&&percent>=0.44){ + }else if(percent>=0.25&&percent<0.5){ if(i==1){ drawTextPaint.setColor(line3Color); }else{ drawTextPaint.setColor(Color.GRAY); } canvas.save(); - canvas.rotate(-120+i*60,mWidth/2,mWidth/2); +// canvas.rotate(-120+i*75,mWidth/2,mWidth/2); + if(i==0){ + canvas.rotate(-120,mWidth/2,mWidth/2); + }else if(i==1){ + canvas.rotate(-45,mWidth/2,mWidth/2); + }else if(i==2){ + canvas.rotate(45,mWidth/2,mWidth/2); + }else if(i==3){ + canvas.rotate(120,mWidth/2,mWidth/2); + } canvas.drawText(level[i],mWidth / 2-textWidth/2, paddingKedu+line2Length+textSize,drawTextPaint); canvas.restore(); - }else if(percent>=0.44&&percent<0.7){ + }else if(percent>=0.5&&percent<0.75){ if(i==2){ drawTextPaint.setColor(line3Color); }else{ drawTextPaint.setColor(Color.GRAY); } canvas.save(); - canvas.rotate(-120+i*60,mWidth/2,mWidth/2); +// canvas.rotate(-120+i*75,mWidth/2,mWidth/2); + if(i==0){ + canvas.rotate(-120,mWidth/2,mWidth/2); + }else if(i==1){ + canvas.rotate(-45,mWidth/2,mWidth/2); + }else if(i==2){ + canvas.rotate(45,mWidth/2,mWidth/2); + }else if(i==3){ + canvas.rotate(120,mWidth/2,mWidth/2); + } canvas.drawText(level[i],mWidth / 2-textWidth/2, paddingKedu+line2Length+textSize,drawTextPaint); canvas.restore(); - }else if(percent>=0.7&&percent<0.9){ + }else if(percent>=0.75){ if(i==3){ drawTextPaint.setColor(line3Color); }else{ drawTextPaint.setColor(Color.GRAY); } canvas.save(); - canvas.rotate(-120+i*60,mWidth/2,mWidth/2); - canvas.drawText(level[i],mWidth / 2-textWidth/2, paddingKedu+line2Length+textSize,drawTextPaint); - canvas.restore(); - }else { - if (i == 4) { - drawTextPaint.setColor(line3Color); - } else { - drawTextPaint.setColor(Color.GRAY); +// canvas.rotate(-105+i*75,mWidth/2,mWidth/2); + if(i==0){ + canvas.rotate(-120,mWidth/2,mWidth/2); + }else if(i==1){ + canvas.rotate(-45,mWidth/2,mWidth/2); + }else if(i==2){ + canvas.rotate(45,mWidth/2,mWidth/2); + }else if(i==3){ + canvas.rotate(120,mWidth/2,mWidth/2); } - canvas.save(); - canvas.rotate(-120 + i * 60, mWidth / 2, mWidth / 2); - canvas.drawText(level[i], mWidth / 2 - textWidth / 2, paddingKedu + line2Length + textSize, drawTextPaint); + canvas.drawText(level[i],mWidth / 2-textWidth/2, paddingKedu+line2Length+textSize,drawTextPaint); canvas.restore(); } } @@ -307,23 +336,18 @@ private void drawJianbianCircle(Canvas canvas){ mSweepGradient = new SweepGradient(mWidth / 2, mWidth / 2, mshaderColor, null); mShaderPaint.setShader(mSweepGradient); - //145, 250 canvas.drawArc(new RectF(mShaderWidth + widthInner, mShaderWidth + widthInner, mWidth - mShaderWidth - widthInner, mWidth - mShaderWidth - widthInner), 120, 300, false, mShaderPaint); //��������������� canvas.save(); - canvas.rotate(30, mWidth / 2, mWidth / 2); + canvas.rotate(75, mWidth / 2, mWidth / 2); canvas.drawLine(mWidth / 2, line2Length + paddingKedu*3, mWidth / 2, (float) (line2Length + paddingKedu*0.65+mShaderWidth*2), paintGapLine); canvas.restore(); canvas.save(); - canvas.rotate(90, mWidth / 2, mWidth / 2); + canvas.rotate(0, mWidth / 2, mWidth / 2); canvas.drawLine(mWidth / 2, line2Length + paddingKedu*3, mWidth / 2, (float) (line2Length + paddingKedu*0.65+mShaderWidth*2), paintGapLine); canvas.restore(); canvas.save(); - canvas.rotate(-30, mWidth / 2, mWidth / 2); - canvas.drawLine(mWidth / 2, line2Length + paddingKedu*3, mWidth / 2, (float) (line2Length + paddingKedu*0.65+mShaderWidth*2), paintGapLine); - canvas.restore(); - canvas.save(); - canvas.rotate(-90, mWidth / 2, mWidth / 2); + canvas.rotate(-75, mWidth / 2, mWidth / 2); canvas.drawLine(mWidth / 2, line2Length + paddingKedu*3, mWidth / 2, (float) (line2Length + paddingKedu*0.65+mShaderWidth*2), paintGapLine); canvas.restore(); } -- Gitblit v1.8.0