Commit fd6a9094 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Reland "Remove hover on icons in launcher"

This is a reland of 517fd5f9
Original change's description:
> Remove hover on icons in launcher
> 
> Changes:
> Disable ImageShadowAnimator in fullscreen app list mode so that the icon
> will not jump when hovered.
> 
> BUG=748236
> 
> Change-Id: Iba8c0717f7cdb132a28c4c21eb9add81a652e93a
> Reviewed-on: https://chromium-review.googlesource.com/592335
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
> Commit-Queue: Weidong Guo <weidongg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#490526}

Bug: 748236
Change-Id: I2721590e0b42a03e87ca277a82b7929124704412
Reviewed-on: https://chromium-review.googlesource.com/593188Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490800}
parent 93f029ee
......@@ -76,10 +76,13 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
icon_(new views::ImageView),
title_(new views::Label),
progress_bar_(new views::ProgressBar),
shadow_animator_(this),
is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) {
shadow_animator_.animation()->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN);
shadow_animator_.SetStartAndEndShadows(IconStartShadows(), IconEndShadows());
if (!is_fullscreen_app_list_enabled_) {
shadow_animator_.reset(new ImageShadowAnimator(this));
shadow_animator_->animation()->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN);
shadow_animator_->SetStartAndEndShadows(IconStartShadows(),
IconEndShadows());
}
icon_->set_can_process_events_within_subtree(false);
icon_->SetVerticalAlignment(views::ImageView::LEADING);
......@@ -135,7 +138,10 @@ void AppListItemView::SetIcon(const gfx::ImageSkia& icon) {
icon,
skia::ImageOperations::RESIZE_BEST,
gfx::Size(kGridIconDimension, kGridIconDimension)));
shadow_animator_.SetOriginalImage(resized);
if (shadow_animator_)
shadow_animator_->SetOriginalImage(resized);
else
icon_->SetImage(resized);
}
void AppListItemView::SetUIState(UIState ui_state) {
......@@ -266,13 +272,15 @@ void AppListItemView::ShowContextMenuForView(views::View* source,
void AppListItemView::StateChanged(ButtonState old_state) {
if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
shadow_animator_.animation()->Show();
if (shadow_animator_)
shadow_animator_->animation()->Show();
// Show the hover/tap highlight: for tap, lighter highlight replaces darker
// keyboard selection; for mouse hover, keyboard selection takes precedence.
if (!apps_grid_view_->IsSelectedView(this) || state() == STATE_PRESSED)
SetItemIsHighlighted(true);
} else {
shadow_animator_.animation()->Hide();
if (shadow_animator_)
shadow_animator_->animation()->Hide();
SetItemIsHighlighted(false);
if (item_weak_)
item_weak_->set_highlighted(false);
......
......@@ -160,7 +160,7 @@ class APP_LIST_EXPORT AppListItemView : public views::CustomButton,
// True if scroll gestures should contribute to dragging.
bool touch_dragging_ = false;
ImageShadowAnimator shadow_animator_;
std::unique_ptr<ImageShadowAnimator> shadow_animator_;
bool is_installing_ = false;
bool is_highlighted_ = false;
......
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