Snap for 13310998 from cb30e70576 to 25Q3-release
Change-Id: I18cea6f0fc07d4e67bbf68ade090297c4bfd9823
This commit is contained in:
commit
41df931cf0
26 files changed
+272
-152
No files matched your search
@@ -524,13 +524,6 @@ flag {
|
||||
bug: "377496684"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_pinning_app_with_context_menu"
|
||||
namespace: "launcher"
|
||||
description: "Add options to pin/unpin to taskbar to app context menus."
|
||||
bug: "375648361"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_launcher_icon_shapes"
|
||||
namespace: "launcher"
|
||||
|
||||
@@ -57,10 +57,17 @@ public abstract class BaseTaskbarContext extends BaseContext
|
||||
public abstract NavigationMode getNavigationMode();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is in desktop mode.
|
||||
* Returns whether the taskbar is in desktop mode. Implies that some desktop tasks are currently
|
||||
* visible.
|
||||
*/
|
||||
public abstract boolean isInDesktopMode();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is showing desktop tasks, which may happen even outside desktop
|
||||
* mode on freeform displays.
|
||||
*/
|
||||
public abstract boolean isTaskbarShowingDesktopTasks();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is forced to be pinned when home is visible.
|
||||
*/
|
||||
|
||||
@@ -442,6 +442,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
&& mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarShowingDesktopTasks() {
|
||||
return mControllers != null
|
||||
&& mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return DisplayController.showLockedTaskbarOnHome(this);
|
||||
@@ -598,6 +605,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return isPhoneMode() && !isThreeButtonNav();
|
||||
}
|
||||
|
||||
/** Returns whether Taskbar draws its own background, vs being translucent for apps to draw. */
|
||||
public boolean drawsTaskbarBackground() {
|
||||
return !isPhoneMode();
|
||||
}
|
||||
|
||||
/** Returns {@code true} iff a tiny version of taskbar is shown on phone. */
|
||||
public boolean isTinyTaskbar() {
|
||||
return enableTinyTaskbar() && mDeviceProfile.isPhone && mDeviceProfile.isTaskbarPresent;
|
||||
@@ -1463,6 +1475,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.uiController.startSplitSelection(splitSelectSource);
|
||||
}
|
||||
|
||||
// If in overview, and a desktop task is available, launches the overview desktop task and
|
||||
// schedules the provided runnable.
|
||||
// Returns whether the runnable has been posted.
|
||||
private boolean runAfterLaunchingDesktopTaskIfInOverview(
|
||||
RecentsView recents,
|
||||
Runnable runnableToRun) {
|
||||
if (recents == null || !isTaskbarShowingDesktopTasks()
|
||||
|| !mControllers.uiController.isInOverviewUi()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(runnableToRun));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void onTaskbarIconClicked(View view) {
|
||||
TaskbarUIController taskbarUIController = mControllers.uiController;
|
||||
RecentsView recents = taskbarUIController.getRecentsView();
|
||||
@@ -1474,25 +1508,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
// TODO: b/316004172, b/343289567: Handle `DesktopTask` and `SplitTask`.
|
||||
if (tag instanceof SingleTask singleTask) {
|
||||
RemoteTransition remoteTransition =
|
||||
(isInDesktopMode() && canUnminimizeDesktopTask(
|
||||
(isTaskbarShowingDesktopTasks() && canUnminimizeDesktopTask(
|
||||
singleTask.getTask().key.id))
|
||||
? createDesktopAppLaunchRemoteTransition(AppLaunchType.UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
|
||||
() -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
handleGroupTaskLaunch(singleTask, remoteTransition, isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
Runnable launchTask = () -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isTaskbarShowingDesktopTasks(), DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
} else if (tag instanceof FolderInfo) {
|
||||
// Tapping an expandable folder icon on Taskbar
|
||||
@@ -1515,24 +1541,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
AppLaunchType.UNMINIMIZE, Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
|
||||
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() ->
|
||||
// wrapped it in runnable here since we need the post for DW to be
|
||||
// ready. if we don't other DW will be gone and only the launched
|
||||
// task will show.
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP));
|
||||
Runnable launchTask = () ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
UI_HELPER_EXECUTOR.execute(launchTask);
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
|
||||
@@ -1789,17 +1803,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
.launchAppPair((AppPairIcon) launchingIconView,
|
||||
-1 /*cuj*/)));
|
||||
} else {
|
||||
if (isInDesktopMode()
|
||||
&& mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
|
||||
() -> startItemInfoActivity(itemInfos.get(0), foundTask)));
|
||||
}
|
||||
} else {
|
||||
startItemInfoActivity(itemInfos.get(0), foundTask);
|
||||
Runnable launchTask =
|
||||
() -> startItemInfoActivity(itemInfos.get(0), foundTask);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1835,7 +1842,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isInDesktopMode()
|
||||
if (isTaskbarShowingDesktopTasks()
|
||||
&& DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS_BUGFIX.isTrue()) {
|
||||
launchDesktopApp(intent, info, displayId);
|
||||
} else {
|
||||
|
||||
@@ -48,8 +48,12 @@ class TaskbarDesktopModeController(
|
||||
}
|
||||
|
||||
fun shouldShowDesktopTasksInTaskbar(): Boolean {
|
||||
return shouldShowDesktopTasksInTaskbar(context.displayId)
|
||||
}
|
||||
|
||||
fun shouldShowDesktopTasksInTaskbar(displayId: Int): Boolean {
|
||||
val activityContext = taskbarControllers.taskbarActivityContext
|
||||
return isInDesktopMode(context.displayId) ||
|
||||
return isInDesktopMode(displayId) ||
|
||||
activityContext.showDesktopTaskbarForFreeformDisplay() ||
|
||||
(activityContext.showLockedTaskbarOnHome() &&
|
||||
taskbarControllers.taskbarStashController.isOnHome)
|
||||
|
||||
@@ -215,7 +215,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
|
||||
private void updateBackgroundAlpha() {
|
||||
if (mActivity.isPhoneMode() || mActivity.isDestroyed()) {
|
||||
if (!mActivity.drawsTaskbarBackground() || mActivity.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,9 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
val taskbarStashController = controllers.taskbarStashController
|
||||
val tappableHeight = taskbarStashController.tappableHeightToReportToApps
|
||||
// We only report tappableElement height for unstashed, persistent taskbar,
|
||||
// which is also when we draw the rounded corners above taskbar.
|
||||
// which is also when we draw the rounded corners above taskbar on tablets.
|
||||
val insetsRoundedCornerFlag =
|
||||
if (tappableHeight > 0) {
|
||||
if (tappableHeight > 0 && context.drawsTaskbarBackground()) {
|
||||
FLAG_INSETS_ROUNDED_CORNER
|
||||
} else {
|
||||
0
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APP
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
|
||||
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
|
||||
import static com.android.window.flags.Flags.enablePinningAppWithContextMenu;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
@@ -147,7 +148,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
ItemInfo itemInfo = null;
|
||||
if (icon.getTag() instanceof ItemInfo item && ShortcutUtil.supportsShortcuts(item)) {
|
||||
itemInfo = item;
|
||||
} else if (Flags.enablePinningAppWithContextMenu()
|
||||
} else if (enablePinningAppWithContextMenu()
|
||||
&& icon.getTag() instanceof SingleTask task) {
|
||||
Task.TaskKey key = task.getTask().getKey();
|
||||
AppInfo appInfo = getApp(
|
||||
@@ -172,7 +173,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// TODO(b/375648361): Revisit to see if this can be implemented within getSystemShortcuts().
|
||||
if (Flags.enablePinningAppWithContextMenu()) {
|
||||
if (enablePinningAppWithContextMenu()) {
|
||||
SystemShortcut shortcut = createPinShortcut(context, itemInfo, icon);
|
||||
if (shortcut != null) {
|
||||
systemShortcuts.add(0, shortcut);
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.android.quickstep.RecentsModel
|
||||
import com.android.quickstep.util.DesktopTask
|
||||
import com.android.quickstep.util.GroupTask
|
||||
import com.android.quickstep.util.SingleTask
|
||||
import com.android.window.flags.Flags.enablePinningAppWithContextMenu
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
|
||||
import java.io.PrintWriter
|
||||
|
||||
@@ -331,7 +332,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
.filter {
|
||||
it is SingleTask &&
|
||||
it.task.key.id in deduplicatedDesktopTasks.map { it.task.key.id } &&
|
||||
(!Flags.enablePinningAppWithContextMenu() ||
|
||||
(!enablePinningAppWithContextMenu() ||
|
||||
shownHotseatItems.none { hotseatItem ->
|
||||
it.containsPackage(
|
||||
hotseatItem.targetPackage,
|
||||
|
||||
@@ -471,7 +471,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
|
||||
// Recents divider takes priority.
|
||||
if (!mAddedDividerForRecents && !mActivityContext.isInDesktopMode()) {
|
||||
if (!mAddedDividerForRecents && !mActivityContext.isTaskbarShowingDesktopTasks()) {
|
||||
updateAllAppsDivider();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,8 +756,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
|
||||
private boolean shouldUpdateIconContentDescription(BubbleTextView btv) {
|
||||
boolean isInDesktopMode = mControllers.taskbarDesktopModeController.isInDesktopMode(
|
||||
DEFAULT_DISPLAY);
|
||||
boolean isInDesktopMode =
|
||||
mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
DEFAULT_DISPLAY);
|
||||
boolean isAllAppsButton = btv instanceof TaskbarAllAppsButtonContainer;
|
||||
boolean isDividerButton = btv instanceof TaskbarDividerContainer;
|
||||
return isInDesktopMode && !isAllAppsButton && !isDividerButton;
|
||||
|
||||
@@ -162,6 +162,11 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
return mTaskbarContext.isInDesktopMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarShowingDesktopTasks() {
|
||||
return mTaskbarContext.isTaskbarShowingDesktopTasks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return mTaskbarContext.showLockedTaskbarOnHome();
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.annotation.VisibleForTesting
|
||||
import com.android.app.displaylib.PerDisplayRepository
|
||||
import com.android.app.tracing.traceSection
|
||||
import com.android.internal.jank.Cuj
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
|
||||
import com.android.launcher3.Flags.enableOverviewCommandHelperTimeout
|
||||
import com.android.launcher3.PagedView
|
||||
@@ -335,18 +336,34 @@ constructor(
|
||||
val recentsViewContainer = containerInterface.getCreatedContainer()
|
||||
val recentsView: RecentsView<*, *>? = recentsViewContainer?.getOverviewPanel()
|
||||
val deviceProfile = recentsViewContainer?.getDeviceProfile()
|
||||
val taskbarUIController: TaskbarUIController? = containerInterface.getTaskbarController()
|
||||
val taskbarUIController: TaskbarUIController? =
|
||||
if (command.displayId != DEFAULT_DISPLAY && !enableOverviewInWindow) {
|
||||
// When enableOverviewInWindow is false, getContainerInterface can only return
|
||||
// BaseContainerInterface of DEFAULT_DISPLAY. Getting TaskbarUiController from
|
||||
// TaskbarManager as a workaround.
|
||||
taskbarManager.getUIControllerForDisplay(command.displayId)
|
||||
} else {
|
||||
containerInterface.getTaskbarController()
|
||||
}
|
||||
|
||||
when (command.type) {
|
||||
HIDE -> {
|
||||
if (taskbarUIController == null || deviceProfile?.isTablet == false) return true
|
||||
if (
|
||||
taskbarUIController == null ||
|
||||
!shouldShowAltTabKqs(deviceProfile, command.displayId)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
keyboardTaskFocusIndex = taskbarUIController.launchFocusedTask()
|
||||
|
||||
if (keyboardTaskFocusIndex == -1) return true
|
||||
}
|
||||
|
||||
KEYBOARD_INPUT ->
|
||||
if (taskbarUIController != null && deviceProfile?.isTablet == true) {
|
||||
if (
|
||||
taskbarUIController != null &&
|
||||
shouldShowAltTabKqs(deviceProfile, command.displayId)
|
||||
) {
|
||||
taskbarUIController.openQuickSwitchView()
|
||||
return true
|
||||
} else {
|
||||
@@ -502,6 +519,12 @@ constructor(
|
||||
return false
|
||||
}
|
||||
|
||||
private fun shouldShowAltTabKqs(deviceProfile: DeviceProfile?, displayId: Int): Boolean =
|
||||
// Alt+Tab KQS is always shown on tablets (large screen devices).
|
||||
deviceProfile?.isTablet == true ||
|
||||
// For small screen devices, it's only shown on connected displays.
|
||||
displayId != DEFAULT_DISPLAY
|
||||
|
||||
private fun onTransitionComplete(
|
||||
command: CommandInfo,
|
||||
handler: AbsSwipeUpHandler<*, *, *>,
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.content.res.Resources;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.OrientationEventListener;
|
||||
|
||||
import com.android.app.displaylib.DisplayRepository;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
@@ -132,30 +133,34 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
*/
|
||||
private boolean mInOverview;
|
||||
private boolean mTaskListFrozen;
|
||||
private final Context mContext;
|
||||
private final Context mApplicationContext;
|
||||
private final Context mDisplayContext;
|
||||
|
||||
@Inject
|
||||
RotationTouchHelper(@ApplicationContext Context context,
|
||||
DisplayController displayController,
|
||||
SystemUiProxy systemUiProxy,
|
||||
DaggerSingletonTracker lifeCycle) {
|
||||
mContext = context;
|
||||
DaggerSingletonTracker lifeCycle,
|
||||
DisplayRepository displayRepository) {
|
||||
mApplicationContext = context;
|
||||
mDisplayController = displayController;
|
||||
mSystemUiProxy = systemUiProxy;
|
||||
// TODO (b/398195845): this needs updating so non-default displays do not rotate with the
|
||||
// default display.
|
||||
mDisplayId = DEFAULT_DISPLAY;
|
||||
mDisplayContext = mApplicationContext.createDisplayContext(
|
||||
displayRepository.getDisplay(mDisplayId));
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
Resources resources = mApplicationContext.getResources();
|
||||
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
|
||||
() -> QuickStepContract.getWindowCornerRadius(mContext));
|
||||
() -> QuickStepContract.getWindowCornerRadius(mDisplayContext));
|
||||
|
||||
// Register for navigation mode and rotation changes
|
||||
mDisplayController.addChangeListenerForDisplay(this, mDisplayId);
|
||||
DisplayController.Info info = mDisplayController.getInfoForDisplay(mDisplayId);
|
||||
onDisplayInfoChanged(context, info, CHANGE_ALL);
|
||||
|
||||
mOrientationListener = new OrientationEventListener(mContext) {
|
||||
mOrientationListener = new OrientationEventListener(mApplicationContext) {
|
||||
@Override
|
||||
public void onOrientationChanged(int degrees) {
|
||||
int newRotation = RecentsOrientedState.getRotationForUserDegreesRotated(degrees,
|
||||
@@ -263,7 +268,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
NavigationMode newMode = info.getNavigationMode();
|
||||
mOrientationTouchTransformer.setNavigationMode(newMode,
|
||||
mDisplayController.getInfoForDisplay(mDisplayId),
|
||||
mContext.getResources());
|
||||
mApplicationContext.getResources());
|
||||
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
@@ -285,7 +290,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
void setGesturalHeight(int newGesturalHeight) {
|
||||
mOrientationTouchTransformer.setGesturalHeight(
|
||||
newGesturalHeight, mDisplayController.getInfoForDisplay(mDisplayId),
|
||||
mContext.getResources());
|
||||
mApplicationContext.getResources());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.quickstep;
|
||||
import static com.android.launcher3.Flags.enableRefactorTaskThumbnail;
|
||||
import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL;
|
||||
import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED;
|
||||
import static com.android.quickstep.views.RecentsViewContainer.containerFromContext;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -34,7 +35,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
@@ -65,8 +65,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
public static List<SystemShortcut> getEnabledShortcuts(TaskView taskView,
|
||||
TaskContainer taskContainer) {
|
||||
final ArrayList<SystemShortcut> shortcuts = new ArrayList<>();
|
||||
final RecentsViewContainer container =
|
||||
RecentsViewContainer.containerFromContext(taskView.getContext());
|
||||
final RecentsViewContainer container = containerFromContext(taskView.getContext());
|
||||
for (TaskShortcutFactory menuOption : MENU_OPTIONS) {
|
||||
if (taskView instanceof GroupedTaskView && !menuOption.showForGroupedTask()) {
|
||||
continue;
|
||||
@@ -184,7 +183,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
|
||||
protected T getActionsView() {
|
||||
if (mActionsView == null) {
|
||||
mActionsView = (T) RecentsViewContainer.containerFromContext(
|
||||
mActionsView = (T) containerFromContext(
|
||||
mTaskContainer.getTaskView().getContext()).getActionsView();
|
||||
}
|
||||
return mActionsView;
|
||||
@@ -343,7 +342,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
RectF boundsInBitmapSpace = new RectF();
|
||||
boundsToBitmapSpace.mapRect(boundsInBitmapSpace, viewRect);
|
||||
|
||||
RecentsViewContainer container = RecentsViewContainer.containerFromContext(
|
||||
RecentsViewContainer container = containerFromContext(
|
||||
getTaskView().getContext());
|
||||
int bottomInset = container.getDeviceProfile().isTablet
|
||||
? Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom) : 0;
|
||||
@@ -364,7 +363,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
: mTaskContainer.getTaskView().getContext().getString(
|
||||
R.string.blocked_by_policy);
|
||||
|
||||
Snackbar.show(BaseActivity.fromContext(
|
||||
Snackbar.show(containerFromContext(
|
||||
mTaskContainer.getTaskView().getContext()), message, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ import com.android.quickstep.fallback.RecentsState
|
||||
import com.android.quickstep.fallback.RecentsState.BACKGROUND_APP
|
||||
import com.android.quickstep.fallback.RecentsState.BG_LAUNCHER
|
||||
import com.android.quickstep.fallback.RecentsState.DEFAULT
|
||||
import com.android.quickstep.fallback.RecentsState.MODAL_TASK
|
||||
import com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT
|
||||
import com.android.quickstep.fallback.toLauncherState
|
||||
import com.android.quickstep.fallback.toLauncherStateOrdinal
|
||||
import com.android.quickstep.util.RecentsAtomicAnimationFactory
|
||||
@@ -392,13 +394,28 @@ class RecentsWindowManager(context: Context, wallpaperColorHints: Int) :
|
||||
}
|
||||
|
||||
override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean {
|
||||
// TODO(b/368610710)
|
||||
return false
|
||||
return windowView?.dispatchGenericMotionEvent(ev) ?: false
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(ev: KeyEvent?): Boolean {
|
||||
// TODO(b/368610710)
|
||||
return false
|
||||
return windowView?.dispatchKeyEvent(ev) ?: false
|
||||
}
|
||||
|
||||
override fun onRootViewDispatchKeyEvent(event: KeyEvent?): Boolean {
|
||||
TestLogging.recordKeyEvent(SEQUENCE_MAIN, "Key event", event)
|
||||
return if (
|
||||
event?.action != KeyEvent.ACTION_DOWN || event.keyCode != KeyEvent.KEYCODE_ESCAPE
|
||||
) {
|
||||
super<RecentsWindowContext>.onRootViewDispatchKeyEvent(event)
|
||||
} else if (isInState(OVERVIEW_SPLIT_SELECT) || isInState(MODAL_TASK)) {
|
||||
stateManager.goToState(DEFAULT, true)
|
||||
true
|
||||
} else if (isInState(DEFAULT)) {
|
||||
returnToHomescreen()
|
||||
true
|
||||
} else {
|
||||
super<RecentsWindowContext>.onRootViewDispatchKeyEvent(event)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getActionsView(): OverviewActionsView<*>? {
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.view.RemoteAnimationTarget
|
||||
import android.view.SurfaceControl
|
||||
import android.view.SurfaceControl.Transaction
|
||||
import android.view.View
|
||||
import android.view.WindowManager.TRANSIT_CHANGE
|
||||
import android.view.WindowManager.TRANSIT_OPEN
|
||||
import android.view.WindowManager.TRANSIT_TO_FRONT
|
||||
import android.window.TransitionInfo
|
||||
@@ -65,6 +66,7 @@ import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource
|
||||
import com.android.launcher3.views.BaseDragLayer
|
||||
import com.android.quickstep.TaskViewUtils
|
||||
import com.android.quickstep.util.SplitScreenUtils.Companion.extractTopParentAndChildren
|
||||
import com.android.quickstep.views.FloatingAppPairView
|
||||
import com.android.quickstep.views.FloatingTaskView
|
||||
import com.android.quickstep.views.GroupedTaskView
|
||||
@@ -730,7 +732,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
val launchAnimation = AnimatorSet()
|
||||
|
||||
val splitRoots: Pair<Change, List<Change>>? =
|
||||
SplitScreenUtils.extractTopParentAndChildren(transitionInfo)
|
||||
extractTopParentAndChildren(transitionInfo)
|
||||
check(splitRoots != null) { "Could not find split roots" }
|
||||
|
||||
// Will point to change (0) in diagram above
|
||||
@@ -981,35 +983,19 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
progressUpdater.setDuration(QuickstepTransitionManager.APP_LAUNCH_DURATION)
|
||||
progressUpdater.interpolator = Interpolators.EMPHASIZED
|
||||
|
||||
var rootCandidate: Change? = null
|
||||
|
||||
for (change in transitionInfo.changes) {
|
||||
val taskInfo: RunningTaskInfo = change.taskInfo ?: continue
|
||||
|
||||
// TODO (b/316490565): Replace this logic when SplitBounds is available to
|
||||
// startAnimation() and we can know the precise taskIds of launching tasks.
|
||||
if (
|
||||
taskInfo.windowingMode == windowingMode &&
|
||||
(change.mode == TRANSIT_OPEN || change.mode == TRANSIT_TO_FRONT)
|
||||
) {
|
||||
// Found one!
|
||||
rootCandidate = change
|
||||
break
|
||||
val splitTree: Pair<Change, List<Change>>? = extractTopParentAndChildren(transitionInfo)
|
||||
check(splitTree != null) { "Could not find a split root candidate" }
|
||||
val rootCandidate = splitTree.first
|
||||
val stageRootTaskIds: Set<Int> = splitTree.second
|
||||
.map { it.taskInfo!!.taskId }
|
||||
.toSet()
|
||||
val leafTasks: List<Change> = transitionInfo.changes
|
||||
.filter {
|
||||
(TransitionUtil.isOpeningMode(it.mode) || it.mode == TRANSIT_CHANGE)
|
||||
&& it.taskInfo != null
|
||||
&& it.taskInfo!!.parentTaskId in stageRootTaskIds
|
||||
}
|
||||
}
|
||||
|
||||
// If we could not find a proper root candidate, something went wrong.
|
||||
check(rootCandidate != null) { "Could not find a split root candidate" }
|
||||
|
||||
// Recurse up the tree until parent is null, then we've found our root.
|
||||
var parentToken: WindowContainerToken? = rootCandidate.parent
|
||||
while (parentToken != null) {
|
||||
rootCandidate = transitionInfo.getChange(parentToken) ?: break
|
||||
parentToken = rootCandidate.parent
|
||||
}
|
||||
|
||||
// Make sure nothing weird happened, like getChange() returning null.
|
||||
check(rootCandidate != null) { "Failed to find a root leash" }
|
||||
.toList()
|
||||
|
||||
// Starting position is a 34% size tile centered in the middle of the screen.
|
||||
// Ending position is the full device screen.
|
||||
@@ -1037,13 +1023,38 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
t.apply()
|
||||
}
|
||||
|
||||
|
||||
// When animation ends, run finishCallback
|
||||
progressUpdater.addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
finishCallback.run()
|
||||
}
|
||||
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
// Reset leaf and stage root tasks, animation can begin from freeform windows
|
||||
for (leaf in leafTasks) {
|
||||
val endAbsBounds = leaf.endAbsBounds
|
||||
|
||||
t.setAlpha(leaf.leash, 1f)
|
||||
t.setCrop(leaf.leash, 0f, 0f,
|
||||
endAbsBounds.width().toFloat(), endAbsBounds.height().toFloat())
|
||||
t.setPosition(leaf.leash, 0f, 0f)
|
||||
}
|
||||
|
||||
for (stageRoot in splitTree.second) {
|
||||
val endAbsBounds = stageRoot.endAbsBounds
|
||||
|
||||
t.setAlpha(stageRoot.leash, 1f)
|
||||
t.setCrop(stageRoot.leash, 0f, 0f,
|
||||
endAbsBounds.width().toFloat(), endAbsBounds.height().toFloat())
|
||||
t.setPosition(stageRoot.leash, endAbsBounds.left.toFloat(),
|
||||
endAbsBounds.top.toFloat())
|
||||
}
|
||||
t.apply()
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
launchAnimation.play(progressUpdater)
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
package com.android.quickstep.util
|
||||
|
||||
import android.util.Log
|
||||
import android.view.WindowManager.TRANSIT_OPEN
|
||||
import android.view.WindowManager.TRANSIT_TO_FRONT
|
||||
import android.view.WindowManager.TRANSIT_CHANGE
|
||||
import android.window.TransitionInfo
|
||||
import android.window.TransitionInfo.Change
|
||||
import android.window.TransitionInfo.FLAG_FIRST_CUSTOM
|
||||
import com.android.launcher3.util.SplitConfigurationOptions
|
||||
import com.android.wm.shell.shared.TransitionUtil
|
||||
import com.android.wm.shell.shared.split.SplitBounds
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
class SplitScreenUtils {
|
||||
companion object {
|
||||
@@ -54,14 +53,7 @@ class SplitScreenUtils {
|
||||
): Pair<Change, List<Change>>? {
|
||||
val parentToChildren = mutableMapOf<Change, MutableList<Change>>()
|
||||
val hasParent = mutableSetOf<Change>()
|
||||
// filter out anything that isn't opening and the divider
|
||||
val taskChanges: List<Change> =
|
||||
transitionInfo.changes
|
||||
.filter { change ->
|
||||
(change.mode == TRANSIT_OPEN || change.mode == TRANSIT_TO_FRONT) &&
|
||||
change.flags < FLAG_FIRST_CUSTOM
|
||||
}
|
||||
.toList()
|
||||
val taskChanges: List<Change> = getNonClosingChanges(transitionInfo)
|
||||
|
||||
// 1. Build Parent-Child Relationships
|
||||
for (change in taskChanges) {
|
||||
@@ -90,5 +82,16 @@ class SplitScreenUtils {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** @return includes only opening + [TRANSIT_CHANGE] changes and the divider */
|
||||
private fun getNonClosingChanges(transitionInfo: TransitionInfo): List<Change> {
|
||||
return transitionInfo.changes
|
||||
.filter { change ->
|
||||
(TransitionUtil.isOpeningMode(change.mode) || change.mode == TRANSIT_CHANGE)
|
||||
&& change.flags < FLAG_FIRST_CUSTOM
|
||||
}
|
||||
.toList()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -757,6 +757,7 @@ public abstract class RecentsView<
|
||||
/**
|
||||
* Placeholder view indicating where the first split screen selected app will be placed
|
||||
*/
|
||||
@Nullable
|
||||
protected SplitSelectStateController mSplitSelectStateController;
|
||||
|
||||
/**
|
||||
@@ -1220,7 +1221,8 @@ public abstract class RecentsView<
|
||||
}
|
||||
|
||||
public boolean isSplitSelectionActive() {
|
||||
return mSplitSelectStateController.isSplitSelectActive();
|
||||
return mSplitSelectStateController != null
|
||||
&& mSplitSelectStateController.isSplitSelectActive();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4145,12 +4147,14 @@ public abstract class RecentsView<
|
||||
mTopRowIdSet.remove(dismissedTaskViewId);
|
||||
|
||||
if (taskCount == 1) {
|
||||
removeViewInLayout(mClearAllButton);
|
||||
removeViewInLayout(mAddDesktopButton);
|
||||
if (isHomeTaskDismissed) {
|
||||
updateEmptyMessage();
|
||||
} else if (!mSplitSelectStateController.isSplitSelectActive()) {
|
||||
startHome();
|
||||
if (!isSplitSelectionActive()) {
|
||||
removeViewInLayout(mClearAllButton);
|
||||
removeViewInLayout(mAddDesktopButton);
|
||||
if (isHomeTaskDismissed) {
|
||||
updateEmptyMessage();
|
||||
} else {
|
||||
startHome();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Update focus task and its size.
|
||||
@@ -4800,7 +4804,7 @@ public abstract class RecentsView<
|
||||
}
|
||||
|
||||
public void updateEmptyMessage() {
|
||||
boolean isEmpty = !hasTaskViews();
|
||||
boolean isEmpty = !hasTaskViews() && !isSplitSelectionActive();
|
||||
boolean hasSizeChanged = mLastMeasureSize.x != getWidth()
|
||||
|| mLastMeasureSize.y != getHeight();
|
||||
if (isEmpty == mShowEmptyMessage && !hasSizeChanged) {
|
||||
|
||||
+1
-1
@@ -23,7 +23,6 @@ import android.util.SparseArray
|
||||
import com.android.launcher3.AbstractFloatingView
|
||||
import com.android.launcher3.BubbleTextView
|
||||
import com.android.launcher3.Flags.FLAG_ENABLE_MULTI_INSTANCE_MENU_TASKBAR
|
||||
import com.android.launcher3.Flags.FLAG_ENABLE_PINNING_APP_WITH_CONTEXT_MENU
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.model.data.AppInfo
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo
|
||||
@@ -36,6 +35,7 @@ import com.android.launcher3.taskbar.rules.TaskbarWindowSandboxContext
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit.EmulatedDevices
|
||||
import com.android.quickstep.util.GroupTask
|
||||
import com.android.window.flags.Flags.FLAG_ENABLE_PINNING_APP_WITH_CONTEXT_MENU
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
style="@style/TextHeadline"
|
||||
style="@style/WidgetsTitle"
|
||||
android:id="@+id/widget_appName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
android:background="@drawable/bg_rounded_corner_bottom_sheet_handle"/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/WidgetsTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
@@ -52,6 +53,12 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
return mStatefulContainer.onRootViewDispatchKeyEvent(event)
|
||||
|| super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
mStatefulContainer.handleConfigurationChanged(
|
||||
|
||||
@@ -298,13 +298,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mContent.setFolder(this);
|
||||
|
||||
mPageIndicator = findViewById(R.id.folder_page_indicator);
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
MarginLayoutParams params = ((MarginLayoutParams) mPageIndicator.getLayoutParams());
|
||||
int horizontalMargin = getContext().getResources()
|
||||
.getDimensionPixelSize(R.dimen.folder_footer_horiz_padding);
|
||||
params.setMarginStart(horizontalMargin);
|
||||
params.setMarginEnd(horizontalMargin);
|
||||
}
|
||||
mFooter = findViewById(R.id.folder_footer);
|
||||
mFooterHeight = dp.folderFooterHeightPx;
|
||||
mFolderName = findViewById(R.id.folder_name);
|
||||
@@ -317,11 +310,26 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
| InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||
| InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
mFolderName.forceDisableSuggestions(true);
|
||||
|
||||
mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
|
||||
/** If arrows are visible, replace the container padding with indicator padding */
|
||||
public void onIndicatorVisibilityChanged() {
|
||||
int sidePadding = getResources().getDimensionPixelSize(R.dimen.folder_footer_horiz_padding);
|
||||
if (mPageIndicator.getVisibility() == View.VISIBLE) {
|
||||
// Replace the container padding with indicator padding for arrows
|
||||
mFooter.setPadding(0, 0, 0, 0);
|
||||
mPageIndicator.setPadding(sidePadding, 0, sidePadding, 0);
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams())
|
||||
.setMarginStart(sidePadding);
|
||||
} else {
|
||||
mFooter.setPadding(sidePadding, 0, sidePadding, 0);
|
||||
mPageIndicator.setPadding(0, 0, 0, 0);
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginStart(0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
// Return if global dragging is not enabled
|
||||
if (!getIsLauncherDraggingEnabled()) return true;
|
||||
@@ -1278,7 +1286,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
int minTitleWidth = getResources().getDimensionPixelSize(R.dimen.folder_title_min_width);
|
||||
if (enableLauncherVisualRefresh() && mFolderName.getMeasuredWidth() < minTitleWidth) {
|
||||
mFolderName.setVisibility(View.GONE);
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginStart(0);
|
||||
// The post is necessary for margins to be recalculated. RTL UI is shifted otherwise.
|
||||
mFolderName.post(() -> mFolderName.setVisibility(View.GONE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.folder;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_FOLDER;
|
||||
import static com.android.launcher3.Flags.enableLauncherVisualRefresh;
|
||||
import static com.android.launcher3.folder.FolderGridOrganizer.createFolderGridOrganizer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -390,6 +391,9 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
|
||||
// Update footer
|
||||
mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
mFolder.onIndicatorVisibilityChanged();
|
||||
}
|
||||
// Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
|
||||
int horizontalGravity = getPageCount() > 1
|
||||
? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL;
|
||||
|
||||
@@ -75,10 +75,8 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
private static final int ENTER_ANIMATION_STAGGERED_DELAY = 150;
|
||||
private static final int ENTER_ANIMATION_DURATION = 400;
|
||||
|
||||
private static final int LARGE_HEIGHT_MULTIPLIER = 12;
|
||||
private static final int SMALL_HEIGHT_MULTIPLIER = 4;
|
||||
private static final int LARGE_WIDTH_MULTIPLIER = 5;
|
||||
private static final int SMALL_WIDTH_MULTIPLIER = 3;
|
||||
private static final int HEIGHT_MULTIPLIER = 4;
|
||||
private static final int WIDTH_MULTIPLIER = 3;
|
||||
private static final float ARROW_TOUCH_BOX_FACTOR = 5f;
|
||||
|
||||
private static final int PAGE_INDICATOR_ALPHA = 255;
|
||||
@@ -88,7 +86,7 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
private static final int VISIBLE_ALPHA = 255;
|
||||
private static final int INVISIBLE_ALPHA = 0;
|
||||
private Paint mPaginationPaint;
|
||||
private Consumer<Direction> mOnArrowClickListener;
|
||||
private @Nullable Consumer<Direction> mOnArrowClickListener;
|
||||
|
||||
// This value approximately overshoots to 1.5 times the original size.
|
||||
private static final float ENTER_ANIMATION_OVERSHOOT_TENSION = 4.9f;
|
||||
@@ -135,6 +133,8 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
private final VectorDrawable mArrowLeft;
|
||||
private final Rect mArrowRightBounds = new Rect();
|
||||
private final Rect mArrowLeftBounds = new Rect();
|
||||
private final int mArrowWidth;
|
||||
private final int mArrowHeight;
|
||||
|
||||
private int mNumPages;
|
||||
private int mActivePage;
|
||||
@@ -188,6 +188,11 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
mIsRtl = Utilities.isRtl(getResources());
|
||||
mArrowRight = (VectorDrawable) getResources().getDrawable(R.drawable.ic_chevron_end);
|
||||
mArrowLeft = (VectorDrawable) getResources().getDrawable(R.drawable.ic_chevron_start);
|
||||
/* the width of the arrows themselves plus extra folder / touch padding. x2 for 2 arrows. */
|
||||
mArrowWidth = 2 * ((int) ((5.5f) * mGapWidth)
|
||||
+ getResources().getDimensionPixelSize(R.dimen.folder_footer_horiz_padding));
|
||||
mArrowHeight =
|
||||
getResources().getDimensionPixelSize(R.dimen.folder_footer_height_default);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,7 +431,7 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArrowClickListener(Consumer<Direction> listener) {
|
||||
public void setArrowClickListener(@Nullable Consumer<Direction> listener) {
|
||||
mOnArrowClickListener = listener;
|
||||
}
|
||||
|
||||
@@ -449,12 +454,15 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
|
||||
// and so the hitboxes of arrows can be clicked easier.
|
||||
int width = MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY ?
|
||||
MeasureSpec.getSize(widthMeasureSpec)
|
||||
: (int) ((mNumPages * ((enableLauncherVisualRefresh())
|
||||
? LARGE_WIDTH_MULTIPLIER : SMALL_WIDTH_MULTIPLIER) + 2) * mDotRadius);
|
||||
: (int) ((mNumPages * WIDTH_MULTIPLIER + 2) * mDotRadius);
|
||||
int height = MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY
|
||||
? MeasureSpec.getSize(heightMeasureSpec)
|
||||
: (int) (((enableLauncherVisualRefresh())
|
||||
? LARGE_HEIGHT_MULTIPLIER : SMALL_HEIGHT_MULTIPLIER) * mDotRadius);
|
||||
: (int) (HEIGHT_MULTIPLIER * mDotRadius);
|
||||
if (enableLauncherVisualRefresh() && mOnArrowClickListener != null) {
|
||||
// Extra height and width and gaps for accessibility arrows.
|
||||
width += mArrowWidth;
|
||||
height = mArrowHeight;
|
||||
}
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.AccessibilityDelegate;
|
||||
@@ -546,6 +547,14 @@ public interface ActivityContext extends SavedStateRegistryOwner {
|
||||
return (Context) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the current ActivityContext to intercept KeyEvent dispatches.
|
||||
* <p>
|
||||
* Returns true iff the event has been handled. */
|
||||
default boolean onRootViewDispatchKeyEvent(KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityContext associated with the given Context, or throws an exception if
|
||||
* the Context is not associated with any ActivityContext.
|
||||
|
||||
Reference in new issue
Block a user