Skip to content

Commit

Permalink
优化电池控件的最大电池参数
Browse files Browse the repository at this point in the history
  • Loading branch information
uni7corn committed Dec 9, 2017
1 parent 98db4eb commit a136f40
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,10 @@ private String FormatTextPower(float power) {


public void setAh(int battery) {
if (battery < 0 || battery > 100) return;
int fullBattery = this.mFullBattery;
if (battery < 0 || battery > fullBattery) return;
this.mCurrentBattery = battery;
mProgress = (float) battery / mFullBattery;
mProgress = (float) battery / fullBattery;
mClipPath.rewind();
mAhClipRectF.right = mAhClipRectF.left + (mBatteryAhWidth) * mProgress;
mClipPath.addRoundRect(mAhClipRectF, mBatteryRadius, mBatteryRadius, Path.Direction.CCW);
Expand Down

0 comments on commit a136f40

Please sign in to comment.