Merge "Remove insets due to Taskbar, except on workspace elements" into sc-dev
This commit is contained in:
commit
9f9787ad76
5 files changed
+17
-5
No files matched your search
@@ -167,6 +167,8 @@ public class DeviceProfile {
|
||||
// Taskbar
|
||||
public boolean isTaskbarPresent;
|
||||
public int taskbarSize;
|
||||
// How much of the bottom inset is due to Taskbar rather than other system elements.
|
||||
public int nonOverlappingTaskbarInset;
|
||||
|
||||
DeviceProfile(Context context, InvariantDeviceProfile inv, Info info,
|
||||
Point minSize, Point maxSize, int width, int height, boolean isLandscape,
|
||||
@@ -221,7 +223,7 @@ public class DeviceProfile {
|
||||
WindowInsets windowInsets = DisplayController.INSTANCE.get(context).getHolder(mInfo.id)
|
||||
.getDisplayContext().getSystemService(WindowManager.class)
|
||||
.getCurrentWindowMetrics().getWindowInsets();
|
||||
int nonOverlappingTaskbarInset =
|
||||
nonOverlappingTaskbarInset =
|
||||
taskbarSize - windowInsets.getSystemWindowInsetBottom();
|
||||
if (nonOverlappingTaskbarInset > 0) {
|
||||
nonFinalAvailableHeightPx -= nonOverlappingTaskbarInset;
|
||||
|
||||
@@ -41,8 +41,15 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
}
|
||||
|
||||
private void handleSystemWindowInsets(Rect insets) {
|
||||
// Update device profile before notifying th children.
|
||||
mActivity.getDeviceProfile().updateInsets(insets);
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
|
||||
// Taskbar provides insets, but we don't want that for most Launcher elements so remove it.
|
||||
mTempRect.set(insets);
|
||||
insets = mTempRect;
|
||||
insets.bottom = Math.max(0, insets.bottom - dp.nonOverlappingTaskbarInset);
|
||||
|
||||
// Update device profile before notifying the children.
|
||||
dp.updateInsets(insets);
|
||||
boolean resetState = !insets.equals(mInsets);
|
||||
setInsets(insets);
|
||||
|
||||
|
||||
@@ -309,6 +309,8 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
Rect padding = grid.workspacePadding;
|
||||
setPadding(padding.left, padding.top, padding.right, padding.bottom);
|
||||
mInsets.set(insets);
|
||||
// Increase our bottom insets so we don't overlap with the taskbar.
|
||||
mInsets.bottom += grid.nonOverlappingTaskbarInset;
|
||||
|
||||
if (mWorkspaceFadeInAdjacentScreens) {
|
||||
// In landscape mode the page spacing is set to the default.
|
||||
|
||||
@@ -395,7 +395,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
||||
@Override
|
||||
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
|
||||
if (Utilities.ATLEAST_Q) {
|
||||
mNavBarScrimHeight = insets.getTappableElementInsets().bottom;
|
||||
mNavBarScrimHeight = insets.getTappableElementInsets().bottom
|
||||
- mLauncher.getDeviceProfile().nonOverlappingTaskbarInset;
|
||||
} else {
|
||||
mNavBarScrimHeight = insets.getStableInsetBottom();
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi
|
||||
lp.leftMargin = lp.rightMargin = 0;
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
lp.bottomMargin = grid.isTaskbarPresent
|
||||
? grid.workspacePadding.bottom + insets.bottom
|
||||
? grid.workspacePadding.bottom + grid.taskbarSize
|
||||
: grid.hotseatBarSizePx + insets.bottom;
|
||||
}
|
||||
setLayoutParams(lp);
|
||||
|
||||
Reference in new issue
Block a user