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

Commit 209dd03b authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Send corrent SUW insets for taskbar portrait vs landscape

* There were two separate blocks of code for sending insets
for Taskbar during SUW, consolidate those
* We also weren't changing Taskbar window height corresponding
to the added insets/change of height for different
orientations in SUW

Fixes: 253538830
Test: Went through SUW and switched orientations,
no back button overlap

Change-Id: Ifb3bc1c20a793ef062bf338a3bdf933b8ae98c28
parent 9de32565
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        DeviceProfile deviceProfile = mContext.getDeviceProfile();
        Resources resources = mContext.getResources();
        Point p = !mContext.isUserSetupComplete()
                ? new Point(0, resources.getDimensionPixelSize(R.dimen.taskbar_suw_frame))
                ? new Point(0, controllers.taskbarActivityContext.getSetupWindowHeight())
                : DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources,
                        TaskbarManager.isPhoneMode(deviceProfile));
        mNavButtonsView.getLayoutParams().height = p.y;
@@ -691,8 +691,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
                        (resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) / 2);
        navButtonsLayoutParams.setMarginEnd(0);
        navButtonsLayoutParams.gravity = Gravity.START;
        mNavButtonsView.getLayoutParams().height =
                mControllers.taskbarActivityContext.getSetupWindowHeight();
        mNavButtonContainer.setLayoutParams(navButtonsLayoutParams);
        mNavButtonContainer.requestLayout();
    }

    /**
+8 −1
Original line number Diff line number Diff line
@@ -341,6 +341,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    public void onConfigurationChanged(@Config int configChanges) {
        mControllers.onConfigurationChanged(configChanges);
        if (!mIsUserSetupComplete) {
            setTaskbarWindowHeight(getSetupWindowHeight());
        }
    }

    public boolean isThreeButtonNav() {
@@ -673,7 +676,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        }

        if (!isUserSetupComplete()) {
            return resources.getDimensionPixelSize(R.dimen.taskbar_suw_frame);
            return getSetupWindowHeight();
        }

        if (DisplayController.isTransientTaskbar(this)) {
@@ -685,6 +688,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius());
    }

    public int getSetupWindowHeight() {
        return getResources().getDimensionPixelSize(R.dimen.taskbar_suw_frame);
    }

    /**
     * Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar
     * window.
+4 −8
Original line number Diff line number Diff line
@@ -369,11 +369,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

        if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
            DeviceProfile dp = mActivity.getDeviceProfile();
            if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && dp.isTaskbarPresent && !dp.isLandscape) {
            if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && dp.isTaskbarPresent) {
                // We always show the back button in SUW but in portrait the SUW layout may not
                // be wide enough to support overlapping the nav bar with its content.  For now,
                // just inset by the bar height.
                return mUnstashedHeight;
                // be wide enough to support overlapping the nav bar with its content.
                // We're sending different res values in portrait vs landscape
                return mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_suw_insets);
            }
            boolean isAnimating = mAnimator != null && mAnimator.isStarted();
            if (!mControllers.stashedHandleViewController.isStashedHandleVisible()
@@ -387,10 +387,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
            return mStashedHeight;
        }

        if (!mActivity.isUserSetupComplete()) {
            // Special insets for SUW.
            return mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_suw_insets);
        }
        return mUnstashedHeight;
    }