0

focus-mode: Update tooltip text less than 1 min

This CL will update the tooltip text for the tile and the tray icon when
the session duration is less than 1 min.

Bug: b/343795770
Test: manual
Change-Id: I34c8e41f95686ac485db0ed61373deedfe01e0b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5602160
Commit-Queue: Hongyu Long <hongyulong@chromium.org>
Reviewed-by: Richard Chui <richui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312144}
This commit is contained in:
Hongyu Long
2024-06-07 18:35:14 +00:00
committed by Chromium LUCI CQ
parent ddde57b6d5
commit 08957416c7
4 changed files with 20 additions and 6 deletions

@ -910,6 +910,9 @@ Style notes:
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_TRAY_BUBBLE_ACCESSIBLE_NAME" desc="The accessible name for the tray bubble contextual panel when there is no selected task.">
Focus is on, <ph name="REMAINING_TIME">$1<ex>24 minutes 35 seconds</ex></ph> left
</message>
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_SESSION_LESS_THAN_ONE_MINUTE" desc="The tooltip text for the tray bubble and the focus mode feature tile in the quick settings menu when the focus session is less than 1 minute.">
less than 1 min
</message>
<message name="IDS_ASH_STATUS_TRAY_UPDATE" desc="The label used in the tray popup to notify that the user should restart to get system updates.">
Restart to update

@ -0,0 +1 @@
fbd2267b1657d977c801412ee1a28bc48def9178

@ -158,15 +158,21 @@ void FocusModeFeaturePodController::UpdateUI(
? l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_TIME_SUBLABEL, duration_string)
: duration_string);
const std::u16string tooltip_duration_string =
session_duration_remaining < base::Minutes(1)
? l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_SESSION_LESS_THAN_ONE_MINUTE)
: duration_string;
tile_->SetTooltipText(l10n_util::GetStringFUTF16(
in_focus_session ? IDS_ASH_STATUS_TRAY_FOCUS_MODE_TILE_ACTIVE
: IDS_ASH_STATUS_TRAY_FOCUS_MODE_TILE_INACTIVE,
duration_string));
tooltip_duration_string));
tile_->SetIconClickable(true);
tile_->SetIconButtonTooltipText(l10n_util::GetStringFUTF16(
in_focus_session ? IDS_ASH_STATUS_TRAY_FOCUS_MODE_TILE_BUTTON_ACTIVE
: IDS_ASH_STATUS_TRAY_FOCUS_MODE_TOGGLE_BUTTON_INACTIVE,
duration_string));
tooltip_duration_string));
}
} // namespace ash

@ -59,12 +59,16 @@ std::u16string GetAccessibleTrayName(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_ENDING_MOMENT_TITLE);
}
const std::u16string time_remaining =
focus_mode_util::GetDurationString(session_snapshot.remaining_time,
/*digital_format=*/false);
const std::u16string duration_string =
session_snapshot.remaining_time < base::Minutes(1)
? l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_SESSION_LESS_THAN_ONE_MINUTE)
: focus_mode_util::GetDurationString(session_snapshot.remaining_time,
/*digital_format=*/false);
return l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_FOCUS_MODE_TRAY_BUBBLE_ACCESSIBLE_NAME,
time_remaining);
duration_string);
}
std::u16string GetAccessibleBubbleName(