@@ 45,6 45,19 @@ namespace gui
if (batteryContext.state == Store::Battery::State::Charging) {
img->set(battery::battery_charging, gui::ImageTypeSpecifier::W_M);
+ if (level == 100) {
+ img->setMargins(gui::Margins(0, 0, battery::image_right_margin, 0));
+ img->informContentChanged();
+ }
+ else if (level < 10) {
+ img->setMargins(gui::Margins(battery::image_left_margin_big, 0, battery::image_right_margin, 0));
+ img->informContentChanged();
+ }
+ else {
+ img->setMargins(gui::Margins(battery::image_left_margin, 0, battery::image_right_margin, 0));
+ img->informContentChanged();
+ }
+
percentText->setText(std::to_string(level) + "%");
setVisible(true);
}
@@ 53,6 66,14 @@ namespace gui
setVisible(false);
}
else {
+ if (level < 10) {
+ img->setMargins(gui::Margins(battery::image_left_margin_big, 0, battery::image_right_margin, 0));
+ img->informContentChanged();
+ }
+ else {
+ img->setMargins(gui::Margins(battery::image_left_margin, 0, battery::image_right_margin, 0));
+ img->informContentChanged();
+ }
img->set(result->image, gui::ImageTypeSpecifier::W_M);
percentText->setText(std::to_string(level) + "%");
setVisible(true);
@@ 13,17 13,19 @@ namespace gui
namespace battery
{
- constexpr auto battery_low = "bell_battery_lvl1";
- constexpr auto battery_critical = "bell_battery_empty";
- constexpr auto battery_charging = "bell_battery_charging";
- constexpr auto font_small = style::window::font::largelight;
- constexpr auto image_h = 64;
- constexpr auto image_w = 64U;
- constexpr auto image_right_margin = 10U;
- constexpr auto percent_h = 102U;
- constexpr auto percent_w = 106U;
- constexpr auto battery_widget_h = 64U;
- constexpr auto battery_widget_w = 210U;
+ constexpr auto battery_low = "bell_battery_lvl1";
+ constexpr auto battery_critical = "bell_battery_empty";
+ constexpr auto battery_charging = "bell_battery_charging";
+ constexpr auto font_small = style::window::font::largelight;
+ constexpr auto image_h = 64;
+ constexpr auto image_w = 64U;
+ constexpr auto image_left_margin = 24U;
+ constexpr auto image_left_margin_big = 48U;
+ constexpr auto image_right_margin = 10U;
+ constexpr auto percent_h = 102U;
+ constexpr auto percent_w = 106U;
+ constexpr auto battery_widget_h = 64U;
+ constexpr auto battery_widget_w = 240U;
} // namespace battery