Commit 022ad252 authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

CrOS: Ensure that SearchBoxView rounded corners are 24 when reshown

Make sure the SBV corners are correct. Add a function to reset the
state of the view before it is reshown.

Bug: 976988
Change-Id: Ia726cc1244ba7a2cd47481a5dd67ed95734737ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677558
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672645}
parent 2c6508e1
......@@ -1894,7 +1894,7 @@ void AppListView::OnBoundsAnimationCompleted() {
// Reset the search box to be shown again. This is done after the animation
// is complete in order to minimize work during the animation.
search_box_view_->SetSearchBoxActive(false /*active*/, ui::ET_LAST);
search_box_view_->ClearSearchAndDeactivateSearchBox();
}
// Layout if the animation was completed.
......
......@@ -142,16 +142,13 @@ void ContentsView::Init(AppListModel* model) {
void ContentsView::ResetForShow() {
SetActiveState(ash::AppListState::kStateApps);
GetAppsContainerView()->ResetForShowApps();
// We clear the search when hiding so when app list appears it is not showing
// search results.
GetSearchBoxView()->ClearSearch();
GetSearchBoxView()->ResetForShow();
// In side shelf, the opacity of the contents is not animated so set it to the
// final state. In tablet mode, opacity of the elements is controlled by the
// HomeLauncherGestureHandler which expects these elements to be opaque.
// Otherwise the contents animate from 0 to 1 so set the initial opacity to 0.
const float initial_opacity =
app_list_view_->is_side_shelf() || app_list_view()->is_tablet_mode()
app_list_view_->is_side_shelf() || app_list_view_->is_tablet_mode()
? 1.0f
: 0.0f;
GetSearchBoxView()->layer()->SetOpacity(initial_opacity);
......
......@@ -113,6 +113,12 @@ void SearchBoxView::Init(bool is_tablet_mode) {
SearchBoxViewBase::Init();
}
void SearchBoxView::ResetForShow() {
ClearSearch();
SetSearchBoxBackgroundCornerRadius(
GetSearchBoxBorderCornerRadiusForState(contents_view_->GetActiveState()));
}
void SearchBoxView::ClearSearch() {
search_box::SearchBoxViewBase::ClearSearch();
app_list_view_->SetStateFromSearchBoxView(
......
......@@ -39,6 +39,9 @@ class APP_LIST_EXPORT SearchBoxView : public search_box::SearchBoxViewBase,
void Init(bool is_tablet_mode);
// Resets state of SearchBoxView so it can be reshown.
void ResetForShow();
// Returns the total focus ring spacing for use in folders.
static int GetFocusRingSpacing();
......
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