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

Commit 3ad1120f authored by Abhishek Aggarwal's avatar Abhishek Aggarwal Committed by Mohammed Althaf T
Browse files

fix(home): default page and hotseat coming back

parent edca61ac
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1594,7 +1594,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        boolean playFallBackAnimation = (launcherView == null
                && launcherIsForceInvisibleOrOpening)
                || mLauncher.getWorkspace().isOverlayShown()
                || shouldPlayFallbackClosingAnimation(appTargets);
                || shouldPlayFallbackClosingAnimation(appTargets)
                || mLauncher.getWorkspace().getDestinationPage() == 0;

        boolean playWorkspaceReveal = !fromPredictiveBack;
        boolean skipAllAppsScale = false;
+9 −0
Original line number Diff line number Diff line
@@ -109,6 +109,15 @@ public class Hotseat extends CellLayout implements Insettable {
        return mHasVerticalHotseat;
    }

    public void setForcedTranslationY(float translationY){
        super.setTranslationY(translationY);
    }

    @Override
    public void setTranslationY(float translationY) {
        // Thread.dumpStack();
    }

    public void resetLayout(boolean hasVerticalHotseat) {
        ActivityContext activityContext = ActivityContext.lookupContext(getContext());
        boolean bubbleBarEnabled = activityContext.isBubbleBarEnabled();
+2 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
        val currentPage =
            if (pagesBoundFirst != null && !pagesBoundFirst.isEmpty)
                launcher.workspace.getPageIndexForScreenId(pagesBoundFirst.array[0])
            else PagedView.INVALID_PAGE
            else Workspace.DEFAULT_PAGE
        // When undoing the removal of the last item on a page, return to that page.
        // Since we are just resetting the current page without user interaction,
        // override the previous page so we don't log the page switch.
@@ -395,6 +395,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
                isFirstPagePinnedItemEnabled &&
                    !SHOULD_SHOW_FIRST_PAGE_WIDGET &&
                    screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID
                        || FeatureFlags.QSB_ON_FIRST_SCREEN && screenId == Workspace.SECOND_SCREEN_ID
            }
            .forEach { screenId ->
                launcher.workspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId)
+21 −5
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.pageindicators.PageIndicatorDots;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
@@ -625,6 +626,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
            Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
            mFirstPagePinnedItem = null;
        }

        insertNewWorkspaceScreen(SECOND_SCREEN_ID, getChildCount());
    }

    public void removeAllWorkspaceScreens() {
@@ -799,8 +802,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
            int screenId = mScreenOrder.get(pageIndex);
            CellLayout screen = mWorkspaceScreens.get(screenId);
            if (screen == null || screen.getShortcutsAndWidgets().getChildCount() != 0
                    || screen.isDropPending()) {
                // Final screen doesn't exist or it isn't empty or there's a pending drop
                    || screen.isDropPending()
                    || (FeatureFlags.QSB_ON_FIRST_SCREEN && screenId == SECOND_SCREEN_ID)) {
                // Final screen doesn't exist or it isn't empty or there's a pending drop or
                // It is an empty page used when QSB is there
                return;
            }
            finalScreens.append(screenId, screen);
@@ -1043,7 +1048,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
            // FIRST_SCREEN_ID can never be removed.
            if (((!FeatureFlags.QSB_ON_FIRST_SCREEN
                    || SHOULD_SHOW_FIRST_PAGE_WIDGET)
                    || id > FIRST_SCREEN_ID)
                    || id > SECOND_SCREEN_ID)
                    && cl.getShortcutsAndWidgets().getChildCount() == 0) {
                removeScreens.add(id);
            }
@@ -1311,8 +1316,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>

        float qsbPadding = progress * bottomPadding;

        getHotseat().setTranslationY(dockTranslationY);
        getPageIndicator().setTranslationY(dockTranslationY);
        getHotseat().setForcedTranslationY(dockTranslationY);
        ((PageIndicatorDots) getPageIndicator()).setForcedTranslationY(dockTranslationY);
        setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
                progress != 0 ? (int) qsbPadding : getPaddingBottom());
    }
@@ -1385,6 +1390,17 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        }
    }

    @Override
    public void setCurrentPage(int currentPage, int overridePrevPage) {
        if (currentPage == FIRST_SCREEN_ID) {
            Hotseat hotseat = getHotseat();
             if (hotseat.getTranslationY() >= 0) {
                 hotseat.setForcedTranslationY(hotseat.getHeight() + getPageIndicator().getHeight());
             }
        }
        super.setCurrentPage(currentPage, overridePrevPage);
    }

    protected void setWallpaperDimension() {
        Executors.THREAD_POOL_EXECUTOR.execute(new Runnable() {
            @Override
+1 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ public class BgDataModel {
                && !SHOULD_SHOW_FIRST_PAGE_WIDGET)
                || screenSet.isEmpty()) {
            screenSet.add(Workspace.FIRST_SCREEN_ID);
            screenSet.add(Workspace.SECOND_SCREEN_ID);
        }
        return screenSet.getArray();
    }
Loading