Skip to content

Commit

Permalink
arc/gio: Show keyboard icon when the ActionLabel focused
Browse files Browse the repository at this point in the history
Show the keyboard icon instead of info icon when the ActionLabel is
focused.

      is focused.

Bug: b:232948415 b:188452744
Test: manual test if the icon shows keyboard icon when the ActionLabel
Change-Id: Ib8e05b99faec6041555b7af807f8fab071269a20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3727486
Reviewed-by: David Jacobo <djacobo@chromium.org>
Auto-Submit: Cici Ruan <cuicuiruan@google.com>
Commit-Queue: Cici Ruan <cuicuiruan@google.com>
Cr-Commit-Position: refs/heads/main@{#1018517}
  • Loading branch information
Cici Ruan authored and Chromium LUCI CQ committed Jun 28, 2022
1 parent 6d75ab2 commit 25b0ac0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions chrome/browser/ash/arc/input_overlay/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ enum class MessageType {
kInfo,
// |kError| is the type for error message.
kError,
// |kInfoLabelFocus| is the type for info message when the |ActionLabel| is
// focused.
kInfoLabelFocus,
};

} // namespace input_overlay
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ash/arc/input_overlay/ui/action_label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ void ActionLabel::OnFocus() {
static_cast<ActionView*>(parent())->ShowErrorMsg(
l10n_util::GetStringUTF8(IDS_INPUT_OVERLAY_EDIT_MISSING_BINDING), this);
} else {
static_cast<ActionView*>(parent())->ShowInfoMsg(
l10n_util::GetStringUTF8(IDS_INPUT_OVERLAY_EDIT_FOCUSED_KEY), this);
static_cast<ActionView*>(parent())->ShowLabelFocusInfoMsg(
l10n_util::GetStringUTF8(IDS_INPUT_OVERLAY_EDIT_FOCUSED_KEY));
}
}

Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/ash/arc/input_overlay/ui/action_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ void ActionView::ShowInfoMsg(const base::StringPiece& message,
display_overlay_controller_->AddEditMessage(message, MessageType::kInfo);
}

void ActionView::ShowLabelFocusInfoMsg(const base::StringPiece& message) {
display_overlay_controller_->AddEditMessage(message,
MessageType::kInfoLabelFocus);
}

void ActionView::RemoveMessage() {
display_overlay_controller_->RemoveEditMessage();
}
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/arc/input_overlay/ui/action_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ActionView : public views::View {
// Show info/edu message.
void ShowInfoMsg(const base::StringPiece& message,
ActionLabel* editing_label);
void ShowLabelFocusInfoMsg(const base::StringPiece& message);
void RemoveMessage();
// Change binding for |action| binding to |input_element| and set
// |kEditedSuccess| on |action_label| if |action_label| is not nullptr.
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/ash/arc/input_overlay/ui/message_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ MessageView::MessageView(DisplayOverlayController* controller,
gfx::CreateVectorIcon(gfx::IconDescription(
vector_icons::kErrorOutlineIcon, kIconSize, kErrorIconColor)));
break;
case MessageType::kInfoLabelFocus:
SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(gfx::IconDescription(
vector_icons::kKeyboardIcon, kIconSize, kInfoIconColor)));
break;
default:
NOTREACHED();
break;
Expand Down

0 comments on commit 25b0ac0

Please sign in to comment.