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

Commit aa7fa886 authored by Uwais Ashraf's avatar Uwais Ashraf
Browse files

Add margins to top and bottom when grid only overview enabled

Fix: 299100244
Test: OverviewImageTest and dump tests
Flag: ACONFIG com.android.launcher3.enable_grid_only_overview TEAMFOOD
Change-Id: I22ebced5bf1e27974036d6e2ef72d2b8d63df824
parent fbc8b715
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -84,4 +84,5 @@

    <dimen name="keyboard_quick_switch_taskview_width">205dp</dimen>
    <dimen name="keyboard_quick_switch_taskview_height">119dp</dimen>

</resources>
+6 −0
Original line number Diff line number Diff line
@@ -27,4 +27,10 @@
    <dimen name="gesture_tutorial_menu_done_button_top_spacing">40dp</dimen>
    <dimen name="gesture_tutorial_menu_back_shape_bottom_margin">49dp</dimen>

    <!-- Grid Only Overview -->
    <!-- The top margin above the top row of tasks in grid only overview -->
    <dimen name="overview_top_margin_grid_only">24dp</dimen>
    <!-- The bottom margin above the bottom row of tasks in grid only overview -->
    <dimen name="overview_bottom_margin_grid_only">40dp</dimen>

</resources>
+4 −0
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@
    <dimen name="overview_page_spacing">36dp</dimen>
    <!--  The space to the left and to the right of the "Clear all" button  -->
    <dimen name="overview_grid_side_margin">64dp</dimen>
    <!-- The top margin above the top row of tasks in grid only overview -->
    <dimen name="overview_top_margin_grid_only">80dp</dimen>
    <!-- The bottom margin above the bottom row of tasks in grid only overview -->
    <dimen name="overview_bottom_margin_grid_only">80dp</dimen>
    <!--  Overview actions  -->
    <dimen name="overview_actions_top_margin">24dp</dimen>

+9 −3
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        Resources res = context.getResources();
        float maxScale = res.getFloat(R.dimen.overview_max_scale);
        Rect gridRect = new Rect();
        calculateGridSize(dp, gridRect);
        calculateGridSize(dp, context, gridRect);
        calculateTaskSizeInternal(context, dp, gridRect, maxScale, Gravity.CENTER, outRect);
    }

@@ -321,10 +321,16 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
    /**
     * Calculates the overview grid size for the provided device configuration.
     */
    public final void calculateGridSize(DeviceProfile dp, Rect outRect) {
    public final void calculateGridSize(DeviceProfile dp, Context context, Rect outRect) {
        Rect insets = dp.getInsets();
        int topMargin = dp.overviewTaskThumbnailTopMarginPx;
        int bottomMargin = dp.getOverviewActionsClaimedSpace();
        if (dp.isTaskbarPresent && Flags.enableGridOnlyOverview()) {
            topMargin += context.getResources().getDimensionPixelSize(
                    R.dimen.overview_top_margin_grid_only);
            bottomMargin += context.getResources().getDimensionPixelSize(
                    R.dimen.overview_bottom_margin_grid_only);
        }
        int sideMargin = dp.overviewGridSideMargin;

        outRect.set(0, 0, dp.widthPx, dp.heightPx);
@@ -340,7 +346,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        Resources res = context.getResources();
        Rect potentialTaskRect = new Rect();
        if (Flags.enableGridOnlyOverview()) {
            calculateGridSize(dp, potentialTaskRect);
            calculateGridSize(dp, context, potentialTaskRect);
        } else {
            calculateFocusTaskSize(context, dp, potentialTaskRect);
        }
+1 −1
Original line number Diff line number Diff line
@@ -2064,7 +2064,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                dp.widthPx - mInsets.right - mTempRect.right,
                dp.heightPx - mInsets.bottom - mTempRect.bottom);

        mSizeStrategy.calculateGridSize(mActivity.getDeviceProfile(),
        mSizeStrategy.calculateGridSize(mActivity.getDeviceProfile(), mActivity,
                mLastComputedGridSize);
        mSizeStrategy.calculateGridTaskSize(mActivity, mActivity.getDeviceProfile(),
                mLastComputedGridTaskSize, mOrientationHandler);
Loading