Commit 22b9ac0a authored by Manu Cornet's avatar Manu Cornet

CrOS Home launcher: Rename animation state enum values

Also rename "animation state" to "transition state" since this also
represents drag state.

Bug: 1012760
Change-Id: Ic890be82ddd4cb713759c07985cc7e4b1210b029
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910761Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714384}
parent 1f58991d
...@@ -635,7 +635,7 @@ void AppListControllerImpl::OnOverviewModeEnding(OverviewSession* session) { ...@@ -635,7 +635,7 @@ void AppListControllerImpl::OnOverviewModeEnding(OverviewSession* session) {
return; return;
const int64_t display_id = last_visible_display_id_; const int64_t display_id = last_visible_display_id_;
bool target_visibility = GetTargetVisibility(); bool target_visibility = GetTargetVisibility();
if (home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished) if (home_launcher_transition_state_ == HomeLauncherTransitionState::kFinished)
target_visibility &= !HasVisibleWindows(); target_visibility &= !HasVisibleWindows();
OnHomeLauncherTargetPositionChanged(target_visibility, display_id); OnHomeLauncherTargetPositionChanged(target_visibility, display_id);
OnVisibilityWillChange(target_visibility, display_id); OnVisibilityWillChange(target_visibility, display_id);
...@@ -789,7 +789,7 @@ void AppListControllerImpl::OnUiVisibilityChanged( ...@@ -789,7 +789,7 @@ void AppListControllerImpl::OnUiVisibilityChanged(
void AppListControllerImpl::OnHomeLauncherAnimationComplete( void AppListControllerImpl::OnHomeLauncherAnimationComplete(
bool shown, bool shown,
int64_t display_id) { int64_t display_id) {
home_launcher_animation_state_ = HomeLauncherAnimationState::kFinished; home_launcher_transition_state_ = HomeLauncherTransitionState::kFinished;
CloseAssistantUi(shown ? AssistantExitPoint::kLauncherOpen CloseAssistantUi(shown ? AssistantExitPoint::kLauncherOpen
: AssistantExitPoint::kLauncherClose); : AssistantExitPoint::kLauncherClose);
// Animations can be reversed (e.g. in a drag). Let's ensure the target // Animations can be reversed (e.g. in a drag). Let's ensure the target
...@@ -804,9 +804,11 @@ void AppListControllerImpl::OnHomeLauncherAnimationComplete( ...@@ -804,9 +804,11 @@ void AppListControllerImpl::OnHomeLauncherAnimationComplete(
void AppListControllerImpl::OnHomeLauncherTargetPositionChanged( void AppListControllerImpl::OnHomeLauncherTargetPositionChanged(
bool showing, bool showing,
int64_t display_id) { int64_t display_id) {
home_launcher_animation_state_ = showing // TODO(manucornet): Make these depend on how far into the animation or drag
? HomeLauncherAnimationState::kShowing // we are.
: HomeLauncherAnimationState::kHiding; home_launcher_transition_state_ =
showing ? HomeLauncherTransitionState::kMostlyShown
: HomeLauncherTransitionState::kMostlyHidden;
OnVisibilityWillChange(showing, display_id); OnVisibilityWillChange(showing, display_id);
} }
...@@ -1339,8 +1341,8 @@ void AppListControllerImpl::OnVisibilityChanged(bool visible, ...@@ -1339,8 +1341,8 @@ void AppListControllerImpl::OnVisibilityChanged(bool visible,
// HomeLauncher is only visible when no other app windows are visible, // HomeLauncher is only visible when no other app windows are visible,
// unless we are in the process of animating to (or dragging) the home // unless we are in the process of animating to (or dragging) the home
// launcher. // launcher.
if (IsTabletMode() && if (IsTabletMode() && home_launcher_transition_state_ ==
home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished) { HomeLauncherTransitionState::kFinished) {
real_visibility &= !HasVisibleWindows(); real_visibility &= !HasVisibleWindows();
} }
...@@ -1380,8 +1382,8 @@ void AppListControllerImpl::OnVisibilityWillChange(bool visible, ...@@ -1380,8 +1382,8 @@ void AppListControllerImpl::OnVisibilityWillChange(bool visible,
// HomeLauncher is only visible when no other app windows are visible, // HomeLauncher is only visible when no other app windows are visible,
// unless we are in the process of animating to (or dragging) the home // unless we are in the process of animating to (or dragging) the home
// launcher. // launcher.
if (IsTabletMode() && if (IsTabletMode() && home_launcher_transition_state_ ==
home_launcher_animation_state_ == HomeLauncherAnimationState::kFinished) { HomeLauncherTransitionState::kFinished) {
real_target_visibility &= !HasVisibleWindows(); real_target_visibility &= !HasVisibleWindows();
} }
......
...@@ -68,10 +68,10 @@ class ASH_EXPORT AppListControllerImpl ...@@ -68,10 +68,10 @@ class ASH_EXPORT AppListControllerImpl
AppListControllerImpl(); AppListControllerImpl();
~AppListControllerImpl() override; ~AppListControllerImpl() override;
enum HomeLauncherAnimationState { enum HomeLauncherTransitionState {
kFinished, kFinished, // No drag or animation is in progress
kShowing, kMostlyShown, // The home launcher occupies more than half of the screen
kHiding, kMostlyHidden, // The home launcher occupies less than half of the screen
}; };
static void RegisterProfilePrefs(PrefRegistrySimple* registry); static void RegisterProfilePrefs(PrefRegistrySimple* registry);
...@@ -293,8 +293,8 @@ class ASH_EXPORT AppListControllerImpl ...@@ -293,8 +293,8 @@ class ASH_EXPORT AppListControllerImpl
bool onscreen_keyboard_shown() const { return onscreen_keyboard_shown_; } bool onscreen_keyboard_shown() const { return onscreen_keyboard_shown_; }
HomeLauncherAnimationState home_launcher_animation_state() const { HomeLauncherTransitionState home_launcher_transition_state() const {
return home_launcher_animation_state_; return home_launcher_transition_state_;
} }
// Performs the 'back' action for the active page. // Performs the 'back' action for the active page.
...@@ -389,7 +389,7 @@ class ASH_EXPORT AppListControllerImpl ...@@ -389,7 +389,7 @@ class ASH_EXPORT AppListControllerImpl
// information given by "showing" versus "hiding" is the starting point of // information given by "showing" versus "hiding" is the starting point of
// the drag and the assumed final state (which won't be accurate if the // the drag and the assumed final state (which won't be accurate if the
// gesture is reversed). // gesture is reversed).
HomeLauncherAnimationState home_launcher_animation_state_ = kFinished; HomeLauncherTransitionState home_launcher_transition_state_ = kFinished;
AppListClient* client_ = nullptr; AppListClient* client_ = nullptr;
......
...@@ -703,8 +703,8 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { ...@@ -703,8 +703,8 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
// If the home launcher is shown, being animated, or dragged, show the // If the home launcher is shown, being animated, or dragged, show the
// default background. // default background.
if (app_list_is_visible || if (app_list_is_visible ||
Shell::Get()->app_list_controller()->home_launcher_animation_state() != Shell::Get()->app_list_controller()->home_launcher_transition_state() !=
AppListControllerImpl::HomeLauncherAnimationState::kFinished) AppListControllerImpl::HomeLauncherTransitionState::kFinished)
return SHELF_BACKGROUND_DEFAULT; return SHELF_BACKGROUND_DEFAULT;
} else if (app_list_is_visible) { } else if (app_list_is_visible) {
return maximized ? SHELF_BACKGROUND_MAXIMIZED_WITH_APP_LIST return maximized ? SHELF_BACKGROUND_MAXIMIZED_WITH_APP_LIST
...@@ -1102,12 +1102,12 @@ HotseatState ShelfLayoutManager::CalculateHotseatState( ...@@ -1102,12 +1102,12 @@ HotseatState ShelfLayoutManager::CalculateHotseatState(
switch (drag_status_) { switch (drag_status_) {
case kDragNone: case kDragNone:
case kDragHomeToOverviewInProgress: { case kDragHomeToOverviewInProgress: {
switch (app_list_controller->home_launcher_animation_state()) { switch (app_list_controller->home_launcher_transition_state()) {
case AppListControllerImpl::HomeLauncherAnimationState::kShowing: case AppListControllerImpl::HomeLauncherTransitionState::kMostlyShown:
return HotseatState::kShown; return HotseatState::kShown;
case AppListControllerImpl::HomeLauncherAnimationState::kHiding: case AppListControllerImpl::HomeLauncherTransitionState::kMostlyHidden:
return in_overview ? HotseatState::kExtended : HotseatState::kHidden; return in_overview ? HotseatState::kExtended : HotseatState::kHidden;
case AppListControllerImpl::HomeLauncherAnimationState::kFinished: case AppListControllerImpl::HomeLauncherTransitionState::kFinished:
// Consider the AppList visible if it is beginning to show. Also // Consider the AppList visible if it is beginning to show. Also
// detect the case where the last window is being minimized. // detect the case where the last window is being minimized.
if (app_list_visible) if (app_list_visible)
...@@ -1436,8 +1436,8 @@ void ShelfLayoutManager::CalculateTargetBounds( ...@@ -1436,8 +1436,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
if (state.IsShelfAutoHidden()) { if (state.IsShelfAutoHidden()) {
shelf_in_screen_portion = shelf_in_screen_portion =
Shell::Get()->app_list_controller()->home_launcher_animation_state() == Shell::Get()->app_list_controller()->home_launcher_transition_state() ==
AppListControllerImpl::HomeLauncherAnimationState::kShowing AppListControllerImpl::HomeLauncherTransitionState::kMostlyShown
? shelf_size ? shelf_size
: ShelfConfig::Get()->hidden_shelf_in_screen_portion(); : ShelfConfig::Get()->hidden_shelf_in_screen_portion();
} else if (state.visibility_state == SHELF_HIDDEN || } else if (state.visibility_state == SHELF_HIDDEN ||
...@@ -1892,8 +1892,8 @@ float ShelfLayoutManager::ComputeTargetOpacity(const State& state) const { ...@@ -1892,8 +1892,8 @@ float ShelfLayoutManager::ComputeTargetOpacity(const State& state) const {
// The shelf should not become transparent during the animation to or from // The shelf should not become transparent during the animation to or from
// HomeLauncher. // HomeLauncher.
if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletModeEnabled() && if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletModeEnabled() &&
Shell::Get()->app_list_controller()->home_launcher_animation_state() != Shell::Get()->app_list_controller()->home_launcher_transition_state() !=
AppListControllerImpl::HomeLauncherAnimationState::kFinished) { AppListControllerImpl::HomeLauncherTransitionState::kFinished) {
return 1.0f; return 1.0f;
} }
......
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