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

Commit b07a355f authored by Louis Begin's avatar Louis Begin Committed by Sunny Goyal
Browse files

Add checks for FeatureFlags.QSB_ON_FIRST_SCREEN

When false, it correctly does not show the QSB but leaves
a default style search bar which cannot be removed.

Add checks to control default view visibility in device
profile layout & re-layout, QSB container and in
Workspace's onMeasure

Bug: 35967694

Change-Id: I3d0f89e1022d838eeb95762fd1fb3f7257956c41
parent 3ba48fa0
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.widget.FrameLayout;

import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.badge.BadgeRenderer;
import com.android.launcher3.config.FeatureFlags;

import java.util.ArrayList;

@@ -530,10 +531,13 @@ public class DeviceProfile {
                workspacePadding.bottom);
        workspace.setPageSpacing(getWorkspacePageSpacing());

        // Only display when enabled
        if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
            View qsbContainer = launcher.getQsbContainer();
            lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
            lp.topMargin = mInsets.top + workspacePadding.top;
            qsbContainer.setLayoutParams(lp);
        }

        // Layout the hotseat
        Hotseat hotseat = (Hotseat) launcher.findViewById(R.id.hotseat);
+2 −1
Original line number Diff line number Diff line
@@ -643,7 +643,8 @@ public class Workspace extends PagedView
        // of workspace despite that it's not a true child.
        // Note that it relies on the strict ordering of measuring the workspace before the QSB
        // at the dragLayer level.
        if (getChildCount() > 0) {
        // Only measure the QSB when the view is enabled
        if (FeatureFlags.QSB_ON_FIRST_SCREEN && getChildCount() > 0) {
            CellLayout firstPage = (CellLayout) getChildAt(0);
            int cellHeight = firstPage.getCellHeight();

+11 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.config.FeatureFlags;

/**
 * A frame layout which contains a QSB. This internally uses fragment to bind the view, which
@@ -89,7 +90,11 @@ public class QsbContainerView extends FrameLayout {
                LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

            mWrapper = new FrameLayout(getActivity());

            // Only add the view when enabled
            if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
                mWrapper.addView(createQsb(mWrapper));
            }
            return mWrapper;
        }

@@ -197,6 +202,11 @@ public class QsbContainerView extends FrameLayout {
        }

        private void rebindFragment() {
            // Exit if the embedded qsb is disabled
            if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
                return;
            }

            if (mWrapper != null && getActivity() != null) {
                mWrapper.removeAllViews();
                mWrapper.addView(createQsb(mWrapper));