Commit 73320317 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Chromium LUCI CQ

Removing High and Medium battery level labels

This CL removes labels for high and medium stylus battery levels
as well as changes the battery icon color for this state to
match the system tray's battery color.

Bug: 1164299
Change-Id: I881936b280357f03891cb649b73cfe69b1001fd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617978Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842238}
parent 3c5bfcbb
......@@ -1226,16 +1226,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_PHONE_HUB_ENABLE_HOTSPOT_NO_RECEPTION_STATE_TOOLTIP" desc="Tooltip message that indicates to the user that the Enable Hotspot feature is disabled because their phone does not have mobile data.">
Your phone must have mobile data to provide a hotspot
</message>
<message name="IDS_ASH_STYLUS_BATTERY_LOW_LABEL">
<message name="IDS_ASH_STYLUS_BATTERY_LOW_LABEL" desc="The label next to the stylus battery indicator when the battery level is below 24%">
Low
</message>
<message name="IDS_ASH_STYLUS_BATTERY_MED_LABEL">
Med
</message>
<message name="IDS_ASH_STYLUS_BATTERY_HI_LABEL">
Hi
</message>
<message name="IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION" desc="Title of the capture region action in the stylus tools (a pop-up panel next to the status tray). This causes a partial screenshot to be taken (the user selects an area of the screen to take a screenshot of).">
Capture region
</message>
......
f9dfa5adb30c929b0694cbf46ed7893fee05d1fb
\ No newline at end of file
a2bda703b9e32c023a76e2845d05b1c17718630e
\ No newline at end of file
......@@ -97,12 +97,15 @@ class BatteryView : public views::View {
icon_ = AddChildView(std::make_unique<views::ImageView>());
icon_->SetImage(delegate->GetBatteryImage());
if (delegate->IsBatteryLevelLow()) {
label_ = AddChildView(std::make_unique<views::Label>(
l10n_util::GetStringUTF16(delegate->GetLabelIdForBatteryLevel())));
l10n_util::GetStringUTF16(IDS_ASH_STYLUS_BATTERY_LOW_LABEL)));
label_->SetEnabledColor(delegate->GetColorForBatteryLevel());
TrayPopupUtils::SetLabelFontList(label_,
TrayPopupUtils::FontStyle::kSmallTitle);
}
}
private:
views::ImageView* icon_ = nullptr;
......
......@@ -15,10 +15,8 @@
namespace ash {
namespace {
// Battery percentage thresholds to used to label the battery level
// as Hi, Med or Low.
// Battery percentage threshold used to label the battery level as Low.
constexpr int kStylusLowBatteryThreshold = 24;
constexpr int kStylusMediumBatteryThreshold = 71;
} // namespace
StylusBatteryDelegate::StylusBatteryDelegate() {
......@@ -34,17 +32,7 @@ SkColor StylusBatteryDelegate::GetColorForBatteryLevel() const {
AshColorProvider::ContentLayerType::kIconColorAlert);
}
return AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconColorPositive);
}
int StylusBatteryDelegate::GetLabelIdForBatteryLevel() const {
if (battery_level_ <= kStylusLowBatteryThreshold) {
return IDS_ASH_STYLUS_BATTERY_LOW_LABEL;
}
if (battery_level_ <= kStylusMediumBatteryThreshold) {
return IDS_ASH_STYLUS_BATTERY_MED_LABEL;
}
return IDS_ASH_STYLUS_BATTERY_HI_LABEL;
AshColorProvider::ContentLayerType::kIconColorPrimary);
}
gfx::ImageSkia StylusBatteryDelegate::GetBatteryImage() const {
......@@ -58,6 +46,10 @@ gfx::ImageSkia StylusBatteryDelegate::GetBatteryImage() const {
icon_fg_color);
}
bool StylusBatteryDelegate::IsBatteryLevelLow() const {
return battery_level_ <= kStylusLowBatteryThreshold;
}
void StylusBatteryDelegate::OnAddingBattery(
const PeripheralBatteryListener::BatteryInfo& battery) {
battery_level_ = battery.level;
......
......@@ -22,8 +22,8 @@ class ASH_EXPORT StylusBatteryDelegate
~StylusBatteryDelegate() override;
SkColor GetColorForBatteryLevel() const;
int GetLabelIdForBatteryLevel() const;
gfx::ImageSkia GetBatteryImage() const;
bool IsBatteryLevelLow() const;
base::Optional<uint8_t> battery_level() const { return battery_level_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment