Put taskbar all apps in separate overlay window and stash taskbar.
All apps should display below system UI components such as the
notification tray and power menu, so an overlay window is more
appropriate. As a result, all apps has a separate window activity
context, but some properties are delegated to the taskbar activity
context. Taskbar should also be stashed while all apps is open.
Change-Id: I593457708779d84a0ab8b949a966d247d0a2e1b7
Test: Manual
Bug: 216843189
Fix: 217383817
(cherry picked from commit 473b980bf9)
This commit is contained in:
committed by
Alex Chau
parent
0f3b6511aa
commit
a1370bfc5f
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView.DEFAULT_CLOSE_DURATION;
|
||||
import static com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView.DEFAULT_OPEN_DURATION;
|
||||
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
|
||||
|
||||
import com.android.launcher3.appprediction.AppsDividerView;
|
||||
import com.android.launcher3.appprediction.PredictionRowView;
|
||||
import com.android.launcher3.taskbar.TaskbarStashController;
|
||||
|
||||
/**
|
||||
* Handles the {@link TaskbarAllAppsContainerView} behavior and synchronizes its transitions with
|
||||
* taskbar stashing.
|
||||
*/
|
||||
final class TaskbarAllAppsViewController {
|
||||
|
||||
private final TaskbarAllAppsContext mContext;
|
||||
private final TaskbarAllAppsSlideInView mSlideInView;
|
||||
private final TaskbarAllAppsContainerView mAppsView;
|
||||
private final TaskbarStashController mTaskbarStashController;
|
||||
|
||||
TaskbarAllAppsViewController(
|
||||
TaskbarAllAppsContext context,
|
||||
TaskbarAllAppsSlideInView slideInView,
|
||||
TaskbarAllAppsController windowController,
|
||||
TaskbarStashController taskbarStashController) {
|
||||
|
||||
mContext = context;
|
||||
mSlideInView = slideInView;
|
||||
mAppsView = mSlideInView.getAppsView();
|
||||
mTaskbarStashController = taskbarStashController;
|
||||
|
||||
setUpIconLongClick();
|
||||
setUpAppDivider();
|
||||
setUpTaskbarStashing();
|
||||
mSlideInView.addOnCloseListener(windowController::closeWindow);
|
||||
}
|
||||
|
||||
/** Starts the {@link TaskbarAllAppsSlideInView} enter transition. */
|
||||
void show() {
|
||||
mSlideInView.show();
|
||||
}
|
||||
|
||||
/** Closes the {@link TaskbarAllAppsSlideInView}. */
|
||||
void close(boolean animate) {
|
||||
mSlideInView.close(animate);
|
||||
}
|
||||
|
||||
private void setUpIconLongClick() {
|
||||
mAppsView.setOnIconLongClickListener(
|
||||
mContext.getDragController()::startDragOnLongClick);
|
||||
mAppsView.getFloatingHeaderView()
|
||||
.findFixedRowByType(PredictionRowView.class)
|
||||
.setOnIconLongClickListener(
|
||||
mContext.getDragController()::startDragOnLongClick);
|
||||
}
|
||||
|
||||
private void setUpAppDivider() {
|
||||
mAppsView.getFloatingHeaderView()
|
||||
.findFixedRowByType(AppsDividerView.class)
|
||||
.setShowAllAppsLabel(!mContext.getOnboardingPrefs().hasReachedMaxCount(
|
||||
ALL_APPS_VISITED_COUNT));
|
||||
mContext.getOnboardingPrefs().incrementEventCount(ALL_APPS_VISITED_COUNT);
|
||||
}
|
||||
|
||||
private void setUpTaskbarStashing() {
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, true);
|
||||
mTaskbarStashController.applyState(DEFAULT_OPEN_DURATION);
|
||||
mSlideInView.setOnCloseBeginListener(() -> {
|
||||
mTaskbarStashController.updateStateForFlag(
|
||||
FLAG_STASHED_IN_APP_ALL_APPS, false);
|
||||
mTaskbarStashController.applyState(DEFAULT_CLOSE_DURATION);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user