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

Commit dad8a80d authored by zakcohen's avatar zakcohen
Browse files

Overview - Remove the space withheld for proactive chips

Remove the space in the ui that was being used for chips.
Centralize some of the logic around calculating the action margins to aid
that.

Bug: 179922117
Test: Local build and flash and run
Change-Id: Icd2f894c858fab475c5411f3f7c412b899d5b220
parent 81f5ff3b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,12 +25,12 @@
    <dimen name="overview_proactive_row_height">48dp</dimen>
    <dimen name="overview_proactive_row_bottom_margin">16dp</dimen>

    <dimen name="overview_minimum_next_prev_size">48dp</dimen>
    <dimen name="overview_minimum_next_prev_size">50dp</dimen>
    <dimen name="overview_task_margin">16dp</dimen>

    <!-- Overrideable in overlay that provides the Overview Actions. -->
    <dimen name="overview_actions_height">48dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture">12dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture">28dp</dimen>
    <dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
    <dimen name="overview_actions_horizontal_margin">16dp</dimen>

+1 −0
Original line number Diff line number Diff line
@@ -253,6 +253,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
                new SplitSelectStateController(mHandler, SystemUiProxy.INSTANCE.get(this))
        );
        overviewPanel.init(mActionsView, mSplitPlaceholderView);
        mActionsView.setDp(getDeviceProfile());
        mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this));

        mAppTransitionManager = new QuickstepTransitionManager(this);
+7 −13
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.SplitScreenBounds;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -212,7 +213,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        } else {
            int taskMargin = dp.overviewTaskMarginPx;
            int proactiveRowAndMargin;
            if (dp.isVerticalBarLayout()) {
            if (!TaskView.SHOW_PROACTIVE_ACTIONS || dp.isVerticalBarLayout()) {
                // In Vertical Bar Layout the proactive row doesn't have its own space, it's inside
                // the actions row.
                proactiveRowAndMargin = 0;
@@ -223,7 +224,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            }
            calculateTaskSizeInternal(context, dp,
                    dp.overviewTaskThumbnailTopMarginPx,
                    proactiveRowAndMargin + getOverviewActionsHeight(context) + taskMargin,
                    proactiveRowAndMargin + getOverviewActionsHeight(context, dp),
                    res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
                    outRect);
        }
@@ -314,23 +315,16 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        calculateTaskSizeInternal(
                context, dp,
                dp.overviewTaskMarginPx,
                getOverviewActionsHeight(context) + dp.overviewTaskMarginPx,
                getOverviewActionsHeight(context, dp),
                dp.overviewTaskMarginPx,
                outRect);
    }

    /** Gets the space that the overview actions will take, including bottom margin. */
    public final int getOverviewActionsHeight(Context context) {
    private int getOverviewActionsHeight(Context context, DeviceProfile dp) {
        Resources res = context.getResources();
        int actionsBottomMargin = 0;
        if (getMode(context) == Mode.THREE_BUTTONS) {
            actionsBottomMargin = res.getDimensionPixelSize(
                    R.dimen.overview_actions_bottom_margin_three_button);
        } else {
            actionsBottomMargin = res.getDimensionPixelSize(
                    R.dimen.overview_actions_bottom_margin_gesture);
        }
        return actionsBottomMargin
        return OverviewActionsView.getOverviewActionsBottomMarginPx(getMode(context), dp)
                + OverviewActionsView.getOverviewActionsTopMarginPx(getMode(context), dp)
                + res.getDimensionPixelSize(R.dimen.overview_actions_height);
    }

+40 −18
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
    private float mModalness;
    private float mModalTransformY;

    protected DeviceProfile mDp;

    public OverviewActionsView(Context context) {
        this(context, null);
    }
@@ -205,36 +207,25 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo

    /** Updates vertical margins for different navigation mode or configuration changes. */
    public void updateVerticalMargin(Mode mode) {
        if (mDp == null) {
            return;
        }
        LayoutParams actionParams = (LayoutParams) findViewById(
                R.id.action_buttons).getLayoutParams();
        actionParams.setMargins(
                actionParams.leftMargin, actionParams.topMargin, actionParams.rightMargin,
                getBottomVerticalMargin(mode));
                actionParams.leftMargin, getOverviewActionsTopMarginPx(mode, mDp),
                actionParams.rightMargin, getOverviewActionsBottomMarginPx(mode, mDp));
    }

    /**
     * Set the device profile for this view to draw with.
     */
    public void setDp(DeviceProfile dp) {
        mDp = dp;
        updateVerticalMargin(SysUINavigationMode.getMode(getContext()));
        requestLayout();
    }

    protected int getBottomVerticalMargin(Mode mode) {
        int bottomMargin;
        int orientation = getResources().getConfiguration().orientation;
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            bottomMargin = 0;
        } else if (mode == Mode.THREE_BUTTONS) {
            bottomMargin = getResources()
                    .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_three_button);
        } else {
            bottomMargin = getResources()
                    .getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_gesture);
        }
        bottomMargin += mInsets.bottom;
        return bottomMargin;
    }

    /**
     * The current task is fully modal (modalness = 1) when it is shown on its own in a modal
     * way. Modalness 0 means the task is shown in context with all the other tasks.
@@ -257,4 +248,35 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
        float progress = ACCEL_DEACCEL.getInterpolation(mModalness);
        return Utilities.mapRange(progress, 0, endTranslation);
    }

    /** Get the top margin associated with the action buttons in Overview. */
    public static int getOverviewActionsTopMarginPx(
            SysUINavigationMode.Mode mode, DeviceProfile dp) {
        // In vertical bar, use the smaller task margin for the top regardless of mode
        if (dp.isVerticalBarLayout()) {
            return dp.overviewTaskMarginPx;
        }

        if (mode == SysUINavigationMode.Mode.THREE_BUTTONS) {
            return dp.overviewActionsMarginThreeButtonPx;
        }

        return dp.overviewActionsMarginGesturePx;
    }

    /** Get the bottom margin associated with the action buttons in Overview. */
    public static int getOverviewActionsBottomMarginPx(
            SysUINavigationMode.Mode mode, DeviceProfile dp) {
        int inset = dp.getInsets().bottom;

        if (dp.isVerticalBarLayout()) {
            return inset;
        }

        if (mode == SysUINavigationMode.Mode.THREE_BUTTONS) {
            return dp.overviewActionsMarginThreeButtonPx + inset;
        }

        return dp.overviewActionsMarginGesturePx + inset;
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -132,6 +132,12 @@ public class TaskView extends FrameLayout implements Reusable {
    @IntDef({FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL})
    public @interface TaskDataChanges {}

    /**
     * Should the layout account for space for a proactive action (or chip) to be added under
     * the task.
     */
    public static final boolean SHOW_PROACTIVE_ACTIONS = false;

    /** The maximum amount that a task view can be scrimmed, dimmed or tinted. */
    public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;

Loading