Avoid drawing the invalid levels in the chart view am: 40319d9d6f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14140152

Change-Id: I3cf7a4764aa3cf30ef370796e51f58bb496f74f3
This commit is contained in:
ykhung
2021-04-10 14:19:18 +00:00
committed by Automerger Merge Worker

View File

@@ -227,6 +227,10 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
// Draws all trapezoid shapes into the canvas.
final Path trapezoidPath = new Path();
for (int index = 0; index < mTrapezoidCount; index++) {
// Not draws the trapezoid for corner or not initialization cases.
if (mLevels[index] == 0 || mLevels[index + 1] == 0) {
continue;
}
// Configures the trapezoid paint color.
mTrapezoidPaint.setColor(
mSelectedIndex == index || mSelectedIndex == SELECTED_INDEX_ALL