mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Merge "Fix taskbar in overview touch and stash behavior" into tm-qpr-dev
This commit is contained in:
@@ -44,7 +44,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
|
||||
/** The bottom insets taskbar provides to the IME when IME is visible. */
|
||||
val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize(
|
||||
KtR.dimen.taskbar_ime_size)
|
||||
private val contentRegion: Region = Region()
|
||||
private val touchableRegion: Region = Region()
|
||||
private val deviceProfileChangeListener = { _: DeviceProfile ->
|
||||
onTaskbarWindowHeightOrInsetsChanged()
|
||||
}
|
||||
@@ -77,10 +77,11 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
|
||||
}
|
||||
|
||||
fun onTaskbarWindowHeightOrInsetsChanged() {
|
||||
var contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
|
||||
contentRegion.set(0, windowLayoutParams.height - contentHeight,
|
||||
val touchableHeight = controllers.taskbarStashController.touchableHeight
|
||||
touchableRegion.set(0, windowLayoutParams.height - touchableHeight,
|
||||
context.deviceProfile.widthPx, windowLayoutParams.height)
|
||||
var tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
|
||||
val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
|
||||
val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
|
||||
for (provider in windowLayoutParams.providedInsets) {
|
||||
if (provider.type == ITYPE_EXTRA_NAVIGATION_BAR) {
|
||||
provider.insetsSize = Insets.of(0, 0, 0, contentHeight)
|
||||
@@ -154,7 +155,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
|
||||
if (context.isTaskbarWindowFullscreen) {
|
||||
TOUCHABLE_INSETS_FRAME
|
||||
} else {
|
||||
insetsInfo.touchableRegion.set(contentRegion)
|
||||
insetsInfo.touchableRegion.set(touchableRegion)
|
||||
TOUCHABLE_INSETS_REGION
|
||||
}
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 4; // setup wizard and AllSetActivity
|
||||
public static final int FLAG_STASHED_IN_APP_IME = 1 << 5; // IME is visible
|
||||
public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 6;
|
||||
public static final int FLAG_STASHED_IN_APP_ALL_APPS = 1 << 7; // All apps is visible.
|
||||
public static final int FLAG_STASHED_IN_TASKBAR_ALL_APPS = 1 << 7; // All apps is visible.
|
||||
public static final int FLAG_IN_SETUP = 1 << 8; // In the Setup Wizard
|
||||
public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 9; // phone screen gesture nav, stashed
|
||||
|
||||
@@ -77,8 +77,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
// If we're in an app and any of these flags are enabled, taskbar should be stashed.
|
||||
private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
|
||||
| FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP
|
||||
| FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_APP_ALL_APPS |
|
||||
FLAG_STASHED_SMALL_SCREEN;
|
||||
| FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_TASKBAR_ALL_APPS
|
||||
| FLAG_STASHED_SMALL_SCREEN;
|
||||
|
||||
private static final int FLAGS_STASHED_IN_APP_IGNORING_IME =
|
||||
FLAGS_STASHED_IN_APP & ~FLAG_STASHED_IN_APP_IME;
|
||||
@@ -88,7 +88,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
// Currently any flag that causes us to stash in an app is included, except for IME or All Apps
|
||||
// since those cover the underlying app anyway and thus the app shouldn't change insets.
|
||||
private static final int FLAGS_REPORT_STASHED_INSETS_TO_APP = FLAGS_STASHED_IN_APP
|
||||
& ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_APP_ALL_APPS;
|
||||
& ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_TASKBAR_ALL_APPS;
|
||||
|
||||
/**
|
||||
* How long to stash/unstash when manually invoked via long press.
|
||||
@@ -168,9 +168,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
boolean inApp = hasAnyFlag(flags, FLAGS_IN_APP);
|
||||
boolean stashedInApp = hasAnyFlag(flags, FLAGS_STASHED_IN_APP);
|
||||
boolean stashedLauncherState = hasAnyFlag(flags, FLAG_IN_STASHED_LAUNCHER_STATE);
|
||||
boolean stashedInTaskbarAllApps =
|
||||
hasAnyFlag(flags, FLAG_STASHED_IN_TASKBAR_ALL_APPS);
|
||||
boolean stashedForSmallScreen = hasAnyFlag(flags, FLAG_STASHED_SMALL_SCREEN);
|
||||
return (inApp && stashedInApp) || (!inApp && stashedLauncherState)
|
||||
|| stashedForSmallScreen;
|
||||
|| stashedInTaskbarAllApps || stashedForSmallScreen;
|
||||
});
|
||||
|
||||
public TaskbarStashController(TaskbarActivityContext activity) {
|
||||
@@ -316,6 +318,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
return hasAnyFlag(FLAGS_IN_APP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height that taskbar will be touchable.
|
||||
*/
|
||||
public int getTouchableHeight() {
|
||||
return mIsStashed ? mStashedHeight : mUnstashedHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height that taskbar will inset when inside apps.
|
||||
* @see WindowInsets.Type#navigationBars()
|
||||
@@ -659,7 +668,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
return;
|
||||
}
|
||||
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, false);
|
||||
updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
|
||||
if (applyState) {
|
||||
applyState(ALL_APPS.getTransitionDuration(
|
||||
mControllers.taskbarActivityContext, false /* isToState */));
|
||||
@@ -779,7 +788,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
appendFlag(str, flags, FLAG_STASHED_IN_APP_SETUP, "FLAG_STASHED_IN_APP_SETUP");
|
||||
appendFlag(str, flags, FLAG_STASHED_IN_APP_IME, "FLAG_STASHED_IN_APP_IME");
|
||||
appendFlag(str, flags, FLAG_IN_STASHED_LAUNCHER_STATE, "FLAG_IN_STASHED_LAUNCHER_STATE");
|
||||
appendFlag(str, flags, FLAG_STASHED_IN_APP_ALL_APPS, "FLAG_STASHED_IN_APP_ALL_APPS");
|
||||
appendFlag(str, flags, FLAG_STASHED_IN_TASKBAR_ALL_APPS, "FLAG_STASHED_IN_APP_ALL_APPS");
|
||||
appendFlag(str, flags, FLAG_IN_SETUP, "FLAG_IN_SETUP");
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS;
|
||||
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
@@ -84,7 +84,7 @@ final class TaskbarAllAppsViewController {
|
||||
}
|
||||
|
||||
private void setUpTaskbarStashing() {
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, true);
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true);
|
||||
mTaskbarStashController.applyState(
|
||||
ALL_APPS.getTransitionDuration(mContext, true /* isToState */));
|
||||
mNavbarButtonsViewController.setSlideInViewVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user