Add icon buttons that open classroom and tasks home pages
Bug: b/296801986 Change-Id: Iced7f9e21905c764c0451611cb9082d418664ff6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4807406 Reviewed-by: Toni Barzic <tbarzic@chromium.org> Commit-Queue: Artsiom Mitrokhin <amitrokhin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1187893}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
07277c9c5a
commit
6dcd2404e6
@ -6958,6 +6958,12 @@ New install
|
||||
<message name="IDS_GLANCEABLES_TASKS_SELECTED_LIST_EMPTY_ACCESSIBLE_NAME" desc="The glanceable displays tasks items fetched from Google Tasks API. This is the text announced by ChromeVox in case the selected tasks list is empty.">
|
||||
Selected list empty, navigate down to add a new task
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_CLASSROOM_HEADER_ICON_ACCESSIBLE_NAME" desc="The glanceable displays classroom items fetched from Google Classroom API. This is the a11y name announced by ChromeVox for the top left corner header icon that opens Google Classroom website (home page).">
|
||||
Google Classroom website
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_HEADER_ICON_ACCESSIBLE_NAME" desc="The glanceable displays tasks items fetched from Google Tasks API. This is the a11y name announced by ChromeVox for the top left corner header icon that opens Google Calendar website with the companion app panel open.">
|
||||
Google tasks on web
|
||||
</message>
|
||||
|
||||
<!-- Do Not Disturb notification -->
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_TITLE" desc="Label used for the notification that shows up when the 'Do Not Disturb' feature is enabled.">
|
||||
|
@ -0,0 +1 @@
|
||||
18306df17874f019c85ab10b7ec7d026f0cb4655
|
@ -0,0 +1 @@
|
||||
d6b24b5b72e988c479223db12b9dc802275993b3
|
@ -17,19 +17,18 @@
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/style/typography.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/types/cxx23_to_underlying.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/combobox_model.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/combobox/combobox.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
#include "ui/views/controls/label.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
#include "ui/views/layout/flex_layout_view.h"
|
||||
@ -40,9 +39,11 @@ namespace ash {
|
||||
namespace {
|
||||
|
||||
constexpr int kInteriorGlanceableBubbleMargin = 16;
|
||||
|
||||
constexpr auto kHeaderIconButtonMargins = gfx::Insets::TLBR(0, 0, 0, 4);
|
||||
constexpr size_t kMaxAssignments = 3;
|
||||
|
||||
constexpr char kClassroomHomePage[] = "https://classroom.google.com/u/0/h";
|
||||
|
||||
} // namespace
|
||||
|
||||
ClassroomBubbleBaseView::ClassroomBubbleBaseView(
|
||||
@ -66,13 +67,13 @@ ClassroomBubbleBaseView::ClassroomBubbleBaseView(
|
||||
views::MaximumFlexSizeRule::kPreferred));
|
||||
|
||||
auto* const header_icon =
|
||||
header_view_->AddChildView(std::make_unique<views::ImageView>());
|
||||
header_icon->SetBackground(views::CreateThemedRoundedRectBackground(
|
||||
cros_tokens::kCrosSysBaseElevated, 16));
|
||||
header_icon->SetImage(ui::ImageModel::FromVectorIcon(
|
||||
kGlanceablesClassroomIcon, cros_tokens::kCrosSysOnSurface, 20));
|
||||
header_icon->SetPreferredSize(gfx::Size(32, 32));
|
||||
header_icon->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(0, 0, 0, 4));
|
||||
header_view_->AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(&ClassroomBubbleBaseView::OpenUrl,
|
||||
base::Unretained(this), GURL(kClassroomHomePage)),
|
||||
IconButton::Type::kMedium, &kGlanceablesClassroomIcon,
|
||||
IDS_GLANCEABLES_CLASSROOM_HEADER_ICON_ACCESSIBLE_NAME));
|
||||
header_icon->SetBackgroundColorId(cros_tokens::kCrosSysBaseElevated);
|
||||
header_icon->SetProperty(views::kMarginsKey, kHeaderIconButtonMargins);
|
||||
|
||||
combo_box_view_ = header_view_->AddChildView(
|
||||
std::make_unique<views::Combobox>(std::move(combobox_model)));
|
||||
|
@ -17,13 +17,12 @@
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/ash_color_id.h"
|
||||
#include "ash/style/combobox.h"
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/system/unified/glanceable_tray_child_bubble.h"
|
||||
#include "ash/system/unified/tasks_combobox_model.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/types/cxx23_to_underlying.h"
|
||||
#include "chromeos/constants/chromeos_features.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
@ -34,17 +33,17 @@
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/controls/button/label_button.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
#include "ui/views/layout/flex_layout_view.h"
|
||||
#include "ui/views/view_class_properties.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kMaximumTasks = 5;
|
||||
constexpr int kTasksIconRightPadding = 14;
|
||||
constexpr int kTasksIconViewSize = 32;
|
||||
constexpr int kInteriorGlanceableBubbleMargin = 16;
|
||||
constexpr auto kAddNewTaskButtonMargins = gfx::Insets::TLBR(0, 0, 16, 0);
|
||||
constexpr auto kHeaderIconButtonMargins = gfx::Insets::TLBR(0, 0, 0, 4);
|
||||
|
||||
constexpr char kTasksManagementPage[] =
|
||||
"https://calendar.google.com/calendar/u/0/r/week?opentasks=1";
|
||||
@ -132,21 +131,14 @@ void TasksBubbleView::InitViews(ui::ListModel<GlanceablesTaskList>* task_list) {
|
||||
add_new_task_button_->SetProperty(views::kMarginsKey,
|
||||
kAddNewTaskButtonMargins);
|
||||
|
||||
task_icon_view_ =
|
||||
tasks_header_view_->AddChildView(std::make_unique<views::ImageView>());
|
||||
task_icon_view_->SetPreferredSize(
|
||||
gfx::Size(kTasksIconViewSize, kTasksIconViewSize));
|
||||
task_icon_view_->SetBackground(views::CreateThemedRoundedRectBackground(
|
||||
cros_tokens::kCrosSysBaseElevated, kTasksIconViewSize / 2));
|
||||
if (chromeos::features::IsJellyEnabled()) {
|
||||
task_icon_view_->SetImage(ui::ImageModel::FromVectorIcon(
|
||||
kGlanceablesTasksIcon, cros_tokens::kCrosSysOnSurface));
|
||||
} else {
|
||||
task_icon_view_->SetImage(ui::ImageModel::FromVectorIcon(
|
||||
kGlanceablesTasksIcon, kColorAshTextColorPrimary));
|
||||
}
|
||||
task_icon_view_->SetProperty(
|
||||
views::kMarginsKey, gfx::Insets::TLBR(0, 0, 0, kTasksIconRightPadding));
|
||||
auto* const header_icon =
|
||||
tasks_header_view_->AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(&TasksBubbleView::ActionButtonPressed,
|
||||
base::Unretained(this)),
|
||||
IconButton::Type::kMedium, &kGlanceablesTasksIcon,
|
||||
IDS_GLANCEABLES_TASKS_HEADER_ICON_ACCESSIBLE_NAME));
|
||||
header_icon->SetBackgroundColorId(cros_tokens::kCrosSysBaseElevated);
|
||||
header_icon->SetProperty(views::kMarginsKey, kHeaderIconButtonMargins);
|
||||
|
||||
tasks_combobox_model_ = std::make_unique<TasksComboboxModel>(task_list);
|
||||
task_list_combo_box_view_ = tasks_header_view_->AddChildView(
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "ui/views/view_observer.h"
|
||||
|
||||
namespace views {
|
||||
class ImageView;
|
||||
class LabelButton;
|
||||
} // namespace views
|
||||
|
||||
@ -51,7 +50,7 @@ class TasksComboboxModel;
|
||||
// +----------------------------------------------+
|
||||
// |`tasks_header_view_` |
|
||||
// |+---------------+ +-------------------------+ |
|
||||
// ||task_icon_view_| |task_list_combo_box_view_| |
|
||||
// ||`IconButton` | |task_list_combo_box_view_| |
|
||||
// |+---------------+ +-------------------------+ |
|
||||
// +----------------------------------------------+
|
||||
//
|
||||
@ -110,7 +109,6 @@ class ASH_EXPORT TasksBubbleView : public GlanceableTrayChildBubble,
|
||||
|
||||
// Owned by views hierarchy.
|
||||
raw_ptr<views::FlexLayoutView, ExperimentalAsh> tasks_header_view_ = nullptr;
|
||||
raw_ptr<views::ImageView, ExperimentalAsh> task_icon_view_ = nullptr;
|
||||
raw_ptr<Combobox, ExperimentalAsh> task_list_combo_box_view_ = nullptr;
|
||||
raw_ptr<views::FlexLayoutView, ExperimentalAsh> button_container_ = nullptr;
|
||||
raw_ptr<views::View, ExperimentalAsh> task_items_container_view_ = nullptr;
|
||||
|
Reference in New Issue
Block a user