Commit 974c67a7 authored by azurewei's avatar azurewei Committed by Commit bot

[ash-md] Add on-screen keyboard toggle row in IME menu view.

1. Add vector icons ime_menu_on_screen_keyboard.*.icon for on-screen keyboard.
2. Add new class MaterialKeyboardStatusRowView in ImeListView to show the keyboard row: a on-screen keyboard, a label and a toggle button.
3. Makes s shown only for MD and sticky when scrolling.
4. Updates the ImeInfoView as simple Label+Label+Image with TriView. And updates the id size.

* Still needs follow-up CL to make MaterialKeyboardStatusRowView has shadow and shown in opt-in IME menu.

BUG=657146, 642385, 652677
TEST=Verified on local build.

Review-Url: https://codereview.chromium.org/2469663002
Cr-Commit-Position: refs/heads/master@{#430186}
parent 6f10b685
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
#include "ash/common/system/tray/ime_info.h" #include "ash/common/system/tray/ime_info.h"
#include "ash/common/system/tray/tray_details_view.h" #include "ash/common/system/tray/tray_details_view.h"
#include "ui/views/controls/button/button.h"
namespace ash { namespace ash {
class MaterialKeyboardStatusRowView;
// The detailed view for showing IME list. // The detailed view for showing IME list.
class ImeListView : public TrayDetailsView { class ImeListView : public TrayDetailsView {
public: public:
...@@ -34,10 +37,16 @@ class ImeListView : public TrayDetailsView { ...@@ -34,10 +37,16 @@ class ImeListView : public TrayDetailsView {
// TrayDetailsView: // TrayDetailsView:
void HandleViewClicked(views::View* view) override; void HandleViewClicked(views::View* view) override;
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
private: private:
// To allow the test class to access |ime_map_|. // To allow the test class to access |ime_map_|.
friend class ImeMenuTrayTest; friend class ImeMenuTrayTest;
// Removes (and destroys) all child views.
void ResetImeListView();
// Appends the IMEs to the scrollable area of the detailed view. // Appends the IMEs to the scrollable area of the detailed view.
void AppendIMEList(const IMEInfoList& list); void AppendIMEList(const IMEInfoList& list);
...@@ -53,9 +62,16 @@ class ImeListView : public TrayDetailsView { ...@@ -53,9 +62,16 @@ class ImeListView : public TrayDetailsView {
// view. // view.
void AppendKeyboardStatus(); void AppendKeyboardStatus();
// Appends the material on-screen keyboard status to the top area of the
// detailed view.
void AppendMaterialKeyboardStatus();
std::map<views::View*, std::string> ime_map_; std::map<views::View*, std::string> ime_map_;
std::map<views::View*, std::string> property_map_; std::map<views::View*, std::string> property_map_;
// On-screen keyboard view which is not used in material design.
views::View* keyboard_status_; views::View* keyboard_status_;
// On-screen keyboard view which is only used in material design.
MaterialKeyboardStatusRowView* material_keyboard_statuts_view_;
DISALLOW_COPY_AND_ASSIGN(ImeListView); DISALLOW_COPY_AND_ASSIGN(ImeListView);
}; };
......
...@@ -133,6 +133,9 @@ void TrayIMETest::TearDown() { ...@@ -133,6 +133,9 @@ void TrayIMETest::TearDown() {
// Tests that if the keyboard is not suppressed the default view is hidden // Tests that if the keyboard is not suppressed the default view is hidden
// if less than 2 IMEs are present. // if less than 2 IMEs are present.
TEST_F(TrayIMETest, HiddenWithNoIMEs) { TEST_F(TrayIMETest, HiddenWithNoIMEs) {
if (MaterialDesignController::IsSystemTrayMenuMaterial())
return;
SetIMELength(0); SetIMELength(0);
EXPECT_FALSE(default_view()->visible()); EXPECT_FALSE(default_view()->visible());
SetIMELength(1); SetIMELength(1);
...@@ -144,6 +147,9 @@ TEST_F(TrayIMETest, HiddenWithNoIMEs) { ...@@ -144,6 +147,9 @@ TEST_F(TrayIMETest, HiddenWithNoIMEs) {
// Tests that if no IMEs are present the default view is hidden when a11y is // Tests that if no IMEs are present the default view is hidden when a11y is
// enabled. // enabled.
TEST_F(TrayIMETest, HidesOnA11yEnabled) { TEST_F(TrayIMETest, HidesOnA11yEnabled) {
if (MaterialDesignController::IsSystemTrayMenuMaterial())
return;
SetIMELength(0); SetIMELength(0);
SuppressKeyboard(); SuppressKeyboard();
EXPECT_TRUE(default_view()->visible()); EXPECT_TRUE(default_view()->visible());
...@@ -158,6 +164,9 @@ TEST_F(TrayIMETest, HidesOnA11yEnabled) { ...@@ -158,6 +164,9 @@ TEST_F(TrayIMETest, HidesOnA11yEnabled) {
// Tests that clicking on the keyboard toggle causes the virtual keyboard // Tests that clicking on the keyboard toggle causes the virtual keyboard
// to toggle between enabled and disabled. // to toggle between enabled and disabled.
TEST_F(TrayIMETest, PerformActionOnDetailedView) { TEST_F(TrayIMETest, PerformActionOnDetailedView) {
if (MaterialDesignController::IsSystemTrayMenuMaterial())
return;
SetIMELength(0); SetIMELength(0);
SuppressKeyboard(); SuppressKeyboard();
EXPECT_FALSE(keyboard::IsKeyboardEnabled()); EXPECT_FALSE(keyboard::IsKeyboardEnabled());
......
...@@ -12,6 +12,8 @@ action("aggregate_vector_icons") { ...@@ -12,6 +12,8 @@ action("aggregate_vector_icons") {
"ime_menu_emoticon.icon", "ime_menu_emoticon.icon",
"ime_menu_microphone.1x.icon", "ime_menu_microphone.1x.icon",
"ime_menu_microphone.icon", "ime_menu_microphone.icon",
"ime_menu_on_screen_keyboard.1x.icon",
"ime_menu_on_screen_keyboard.icon",
"ime_menu_write.1x.icon", "ime_menu_write.1x.icon",
"ime_menu_write.icon", "ime_menu_write.icon",
"network_badge_add_other.1x.icon", "network_badge_add_other.1x.icon",
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 20,
MOVE_TO, 3, 7,
LINE_TO, 3, 12,
LINE_TO, 14, 12,
LINE_TO, 14, 7,
LINE_TO, 3, 7,
CLOSE,
MOVE_TO, 1.64f, 0,
CUBIC_TO, 0.74f, 0, 0, 0.75f, 0, 1.67f,
LINE_TO, 0, 13.35f,
CUBIC_TO, 0, 14.27f, 0.74f, 15, 1.64f, 15,
LINE_TO, 15.36f, 15,
CUBIC_TO, 16.26f, 15, 17, 14.27f, 17, 13.35f,
LINE_TO, 17, 1.67f,
CUBIC_TO, 17, 0.75f, 16.26f, 0, 15.36f, 0,
LINE_TO, 1.64f, 0,
CLOSE,
MOVE_TO, 2, 13,
LINE_TO, 2, 2,
LINE_TO, 15, 2,
LINE_TO, 15, 13,
LINE_TO, 2, 13,
CLOSE,
MOVE_TO, 6, 10,
LINE_TO, 11, 10,
LINE_TO, 11, 11,
LINE_TO, 6, 11,
LINE_TO, 6, 10,
CLOSE,
MOVE_TO, 5, 8,
LINE_TO, 6, 8,
LINE_TO, 6, 9,
LINE_TO, 5, 9,
LINE_TO, 5, 8,
CLOSE,
MOVE_TO, 7, 8,
LINE_TO, 8, 8,
LINE_TO, 8, 9,
LINE_TO, 7, 9,
LINE_TO, 7, 8,
CLOSE,
MOVE_TO, 9, 8,
LINE_TO, 10, 8,
LINE_TO, 10, 9,
LINE_TO, 9, 9,
LINE_TO, 9, 8,
CLOSE,
MOVE_TO, 11, 8,
LINE_TO, 12, 8,
LINE_TO, 12, 9,
LINE_TO, 11, 9,
LINE_TO, 11, 8,
CLOSE,
END
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 40,
MOVE_TO, 31, 15,
LINE_TO, 5, 15,
LINE_TO, 5, 25,
LINE_TO, 31, 25,
LINE_TO, 31, 15,
LINE_TO, 31, 15,
CLOSE,
MOVE_TO, 32.73f, 0,
LINE_TO, 3.27f, 0,
CUBIC_TO, 1.47f, 0, 0, 1.5f, 0, 3.34f,
LINE_TO, 0, 26.7f,
CUBIC_TO, 0, 28.53f, 1.47f, 30, 3.27f, 30,
LINE_TO, 32.73f, 30,
CUBIC_TO, 34.53f, 30, 36, 28.53f, 36, 26.7f,
LINE_TO, 36, 3.34f,
CUBIC_TO, 36, 1.5f, 34.53f, 0, 32.73f, 0,
LINE_TO, 32.73f, 0,
CLOSE,
MOVE_TO, 33, 27,
LINE_TO, 3, 27,
LINE_TO, 3, 3,
LINE_TO, 33, 3,
LINE_TO, 33, 27,
LINE_TO, 33, 27,
CLOSE,
MOVE_TO, 12, 21,
LINE_TO, 24, 21,
LINE_TO, 24, 23,
LINE_TO, 12, 23,
LINE_TO, 12, 21,
CLOSE,
MOVE_TO, 7, 17,
LINE_TO, 9, 17,
LINE_TO, 9, 19,
LINE_TO, 7, 19,
LINE_TO, 7, 17,
CLOSE,
MOVE_TO, 11, 17,
LINE_TO, 13, 17,
LINE_TO, 13, 19,
LINE_TO, 11, 19,
LINE_TO, 11, 17,
CLOSE,
MOVE_TO, 15, 17,
LINE_TO, 17, 17,
LINE_TO, 17, 19,
LINE_TO, 15, 19,
LINE_TO, 15, 17,
CLOSE,
MOVE_TO, 19, 17,
LINE_TO, 21, 17,
LINE_TO, 21, 19,
LINE_TO, 19, 19,
LINE_TO, 19, 17,
CLOSE,
MOVE_TO, 23, 17,
LINE_TO, 25, 17,
LINE_TO, 25, 19,
LINE_TO, 23, 19,
LINE_TO, 23, 17,
CLOSE,
MOVE_TO, 27, 17,
LINE_TO, 29, 17,
LINE_TO, 29, 19,
LINE_TO, 27, 19,
LINE_TO, 27, 17,
CLOSE,
END
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