Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f9787ad authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Remove insets due to Taskbar, except on workspace elements" into sc-dev

parents 5b7c5e79 145b7fd6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
+9 −2
Original line number Diff line number Diff line
@@ -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);

+2 −0
Original line number Diff line number Diff line
@@ -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.
+2 −1
Original line number Diff line number Diff line
@@ -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();
        }
+1 −1
Original line number Diff line number Diff line
@@ -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);