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

Commit 11e96498 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Do not clear grid accupancy if nothing changes

Hotseat is calling setGridSize on every layout which was clearing gridOccupancy, marking the cells as empty

Bug: 73867732
Change-Id: Ie07f5786f2e5bfe2340fd0b8723964f651c929d4
parent 3d58de67
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -81,12 +81,17 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett
    protected void onFinishInflate() {
        super.onFinishInflate();
        mContent = findViewById(R.id.layout);

        resetLayout();
    }

    void resetLayout() {
    void resetLayout(boolean hasVerticalHotseat) {
        mContent.removeAllViewsInLayout();
        mHasVerticalHotseat = hasVerticalHotseat;
        InvariantDeviceProfile idp = mLauncher.getDeviceProfile().inv;
        if (hasVerticalHotseat) {
            mContent.setGridSize(1, idp.numHotseatIcons);
        } else {
            mContent.setGridSize(idp.numHotseatIcons, 1);
        }

        if (!FeatureFlags.NO_ALL_APPS_ICON) {
            // Add the Apps button
@@ -148,10 +153,8 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett
    public void setInsets(Rect insets) {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
        DeviceProfile grid = mLauncher.getDeviceProfile();
        mHasVerticalHotseat = mLauncher.getDeviceProfile().isVerticalBarLayout();

        if (mHasVerticalHotseat) {
            mContent.setGridSize(1, grid.inv.numHotseatIcons);
        if (grid.isVerticalBarLayout()) {
            lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
            if (grid.isSeascape()) {
                lp.gravity = Gravity.LEFT;
@@ -161,8 +164,6 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett
                lp.width = grid.hotseatBarSizePx + insets.right + grid.hotseatBarSidePaddingPx;
            }
        } else {
            mContent.setGridSize(grid.inv.numHotseatIcons, 1);

            lp.gravity = Gravity.BOTTOM;
            lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
            lp.height = grid.hotseatBarSizePx + insets.bottom;
+1 −1
Original line number Diff line number Diff line
@@ -1840,7 +1840,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, L
        mAppWidgetHost.clearViews();

        if (mHotseat != null) {
            mHotseat.resetLayout();
            mHotseat.resetLayout(mDeviceProfile.isVerticalBarLayout());
        }
        TraceHelper.endSection("startBinding");
    }