Skip to content

Commit cfca3f4

Browse files
daffaaji29hungphan2001
authored andcommitted
Battery: make fill path rounded
Signed-off-by: 703joko <703joko@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
1 parent dea9926 commit cfca3f4

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

packages/SettingsLib/src/com/android/settingslib/graph/LandscapeBatteryDrawable.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,16 @@ open class LandscapeBatteryDrawable(private val context: Context, frameColor: In
202202
fillRect.left + (fillRect.width() * (1 - fillFraction))
203203

204204
levelRect.left = Math.floor(fillTop.toDouble()).toFloat()
205-
levelPath.addRect(levelRect, Path.Direction.CCW)
205+
//levelPath.addRect(levelRect, Path.Direction.CCW)
206+
levelPath.addRoundRect(levelRect,
207+
floatArrayOf(2.0f,
208+
2.0f,
209+
2.0f,
210+
2.0f,
211+
2.0f,
212+
2.0f,
213+
2.0f,
214+
2.0f), Path.Direction.CCW)
206215

207216
// The perimeter should never change
208217
unifiedPath.addPath(scaledPerimeter)

packages/SettingsLib/src/com/android/settingslib/graph/RLandscapeBatteryDrawable.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,16 @@ open class RLandscapeBatteryDrawable(private val context: Context, frameColor: I
202202
fillRect.right - (fillRect.width() * (1 - fillFraction))
203203

204204
levelRect.right = Math.floor(fillTop.toDouble()).toFloat()
205-
levelPath.addRect(levelRect, Path.Direction.CCW)
205+
//levelPath.addRect(levelRect, Path.Direction.CCW)
206+
levelPath.addRoundRect(levelRect,
207+
floatArrayOf(2.0f,
208+
2.0f,
209+
2.0f,
210+
2.0f,
211+
2.0f,
212+
2.0f,
213+
2.0f,
214+
2.0f), Path.Direction.CCW)
206215

207216
// The perimeter should never change
208217
unifiedPath.addPath(scaledPerimeter)

0 commit comments

Comments
 (0)