| 114 | } |
| 115 | |
| 116 | void BaseTheme::drawBatteryRight(const GfxRenderer& renderer, Rect rect, const bool showPercentage) const { |
| 117 | // Right aligned: percentage on left, icon on right (UI headers) |
| 118 | // rect.x is already positioned for the icon (drawHeader calculated it) |
| 119 | const uint16_t percentage = powerManager.getBatteryPercentage(); |
| 120 | const int y = rect.y + 6; |
| 121 | |
| 122 | if (showPercentage) { |
| 123 | const auto percentageText = std::to_string(percentage) + "%"; |
| 124 | const int textWidth = renderer.getTextWidth(SMALL_FONT_ID, percentageText.c_str()); |
| 125 | renderer.drawText(SMALL_FONT_ID, rect.x - textWidth - batteryPercentSpacing, rect.y, percentageText.c_str()); |
| 126 | } |
| 127 | |
| 128 | const Rect iconRect{rect.x, y, rect.width, rect.height}; |
| 129 | drawBatteryOutline(renderer, rect.x, y, rect.width, rect.height); |
| 130 | fillBatteryIcon(renderer, iconRect, percentage); |
| 131 | } |
| 132 | |
| 133 | void BaseTheme::drawProgressBar(const GfxRenderer& renderer, Rect rect, const size_t current, |
| 134 | const size_t total) const { |
nothing calls this directly
no test coverage detected