Commit eb59216d authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Commit Bot

[Bluetooth] Change Bluetooth subtext to gray

As per recommendation in Comment #30 of crbug.com/1114876.

BUG=b:167556640

Change-Id: I57bc4ff360d05d1d6a0b03f58d4f24e23492b858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410746Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808073}
parent 4c98fe79
...@@ -254,7 +254,7 @@ void BluetoothDetailedView::AppendSameTypeDevicesToScrollList( ...@@ -254,7 +254,7 @@ void BluetoothDetailedView::AppendSameTypeDevicesToScrollList(
SetupConnectingScrollListItem(container); SetupConnectingScrollListItem(container);
break; break;
case BluetoothDeviceInfo::ConnectionState::kConnected: case BluetoothDeviceInfo::ConnectionState::kConnected:
SetupConnectedScrollListItem( SetupNeutralColorConnectedScrollListItem(
container, device->battery_info container, device->battery_info
? base::make_optional<uint8_t>( ? base::make_optional<uint8_t>(
device->battery_info->battery_percentage) device->battery_info->battery_percentage)
......
...@@ -353,10 +353,19 @@ HoverHighlightView* TrayDetailedView::AddScrollListCheckableItem( ...@@ -353,10 +353,19 @@ HoverHighlightView* TrayDetailedView::AddScrollListCheckableItem(
} }
void TrayDetailedView::SetupConnectedScrollListItem(HoverHighlightView* view) { void TrayDetailedView::SetupConnectedScrollListItem(HoverHighlightView* view) {
SetupConnectedScrollListItem(view, base::nullopt /* battery_percentage */); DCHECK(view->is_populated());
base::string16 status;
view->SetSubText(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED));
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION);
style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED);
style.SetupLabel(view->sub_text_label());
} }
void TrayDetailedView::SetupConnectedScrollListItem( void TrayDetailedView::SetupNeutralColorConnectedScrollListItem(
HoverHighlightView* view, HoverHighlightView* view,
base::Optional<uint8_t> battery_percentage) { base::Optional<uint8_t> battery_percentage) {
DCHECK(view->is_populated()); DCHECK(view->is_populated());
...@@ -373,7 +382,14 @@ void TrayDetailedView::SetupConnectedScrollListItem( ...@@ -373,7 +382,14 @@ void TrayDetailedView::SetupConnectedScrollListItem(
} }
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION); TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION);
style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED); // The subtext is used for the "Connected" status and also the battery
// indicator percentage value. Using fixed green color may give the impression
// that the battery is in good state even though the charge value is low. In
// the future the UI will be re-implemented using a battery icon and different
// colors depending on the charge value (b/167556800). For now, we use the
// neutral gray color for both the "Connected" text and the battery value to
// avoid this confusion.
style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE);
style.SetupLabel(view->sub_text_label()); style.SetupLabel(view->sub_text_label());
} }
......
...@@ -97,9 +97,14 @@ class ASH_EXPORT TrayDetailedView : public views::View, ...@@ -97,9 +97,14 @@ class ASH_EXPORT TrayDetailedView : public views::View,
void SetupConnectedScrollListItem(HoverHighlightView* view); void SetupConnectedScrollListItem(HoverHighlightView* view);
// Adds connected sub label with the device's battery percentage to the |view| // Adds connected sub label with the device's battery percentage to the |view|
// with appropriate style and updates accessibility label. // with appropriate style and updates accessibility label. Exclusively used
void SetupConnectedScrollListItem(HoverHighlightView* view, // for Bluetooth since its Connected state also contains the battery charge
base::Optional<uint8_t> battery_percentage); // value and the color needs to be gray (neutral for all battery values).
// TODO(b/167556800): Remove this Bluetooth-specific view once the battery
// indicator has been re-implemented as an icon with its separate color.
void SetupNeutralColorConnectedScrollListItem(
HoverHighlightView* view,
base::Optional<uint8_t> battery_percentage);
// Adds connecting sub label to the |view| with appropriate style and updates // Adds connecting sub label to the |view| with appropriate style and updates
// accessibility label. // accessibility label.
......
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