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

Commit 8e83f311 authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Tune Overview size according to VisD" into sc-v2-dev

parents 338055c8 5fd9d491
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -14,12 +14,11 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- NOTE! don't add dimensions for margins / gravity to root view in this file, they need to be
     loaded at runtime. -->
<com.android.quickstep.views.GoOverviewActionsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom">

    <LinearLayout
        android:id="@+id/action_buttons"
+2 −3
Original line number Diff line number Diff line
@@ -14,11 +14,10 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- NOTE! don't add dimensions for margins / gravity to root view in this file, they need to be
     loaded at runtime. -->
<com.android.quickstep.views.OverviewActionsView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom">

    <LinearLayout
        android:id="@+id/action_buttons"
+12 −8
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

<resources>
    <dimen name="task_thumbnail_icon_size">48dp</dimen>
    <dimen name="task_thumbnail_icon_size_grid">40dp</dimen>
    <!-- For screens without rounded corners -->
    <dimen name="task_corner_radius_small">2dp</dimen>
    <!-- For Launchers that want to override the default dialog corner radius -->
@@ -31,18 +30,22 @@

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

    <!-- Overrideable in overlay that provides the Overview Actions. -->
    <dimen name="overview_actions_height">48dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture">28dp</dimen>
    <dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
    <dimen name="overview_actions_margin_gesture">28dp</dimen>
    <dimen name="overview_actions_top_margin_gesture_grid_portrait">19.37dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture_grid_portrait">22dp</dimen>
    <dimen name="overview_actions_top_margin_gesture_grid_landscape">19.1dp</dimen>
    <dimen name="overview_actions_bottom_margin_gesture_grid_landscape">10dp</dimen>
    <dimen name="overview_actions_margin_three_button">8dp</dimen>
    <dimen name="overview_actions_horizontal_margin">16dp</dimen>

    <dimen name="overview_grid_top_margin">77dp</dimen>
    <dimen name="overview_grid_bottom_margin">70dp</dimen>
    <dimen name="overview_grid_side_margin">54dp</dimen>
    <dimen name="overview_grid_row_spacing">42dp</dimen>
    <dimen name="overview_grid_focus_vertical_margin">40dp</dimen>
    <dimen name="overview_grid_side_margin">50dp</dimen>
    <dimen name="overview_grid_row_spacing_portrait">37.13dp</dimen>
    <dimen name="overview_grid_row_spacing_landscape">33.38dp</dimen>
    <dimen name="overview_grid_focus_vertical_margin">0dp</dimen>

    <!-- These speeds are in dp/s -->
    <dimen name="max_task_dismiss_drag_velocity">2.25dp</dimen>
@@ -51,6 +54,7 @@
    <dimen name="default_task_dismiss_drag_velocity_grid_focus_task">5dp</dimen>

    <dimen name="recents_page_spacing">16dp</dimen>
    <dimen name="recents_page_spacing_grid">36dp</dimen>
    <dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>

    <!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
+25 −25
Original line number Diff line number Diff line
@@ -210,14 +210,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            Rect gridRect = new Rect();
            calculateGridSize(context, dp, gridRect);

            int verticalMargin = Math.max(
                    res.getDimensionPixelSize(R.dimen.overview_grid_focus_vertical_margin),
                    res.getDimensionPixelSize(R.dimen.overview_actions_height));
            float taskHeight =
                    gridRect.height() - verticalMargin * 2 - dp.overviewTaskThumbnailTopMarginPx;

            PointF taskDimension = getTaskDimension(context, dp);
            float scale = taskHeight / taskDimension.y;
            float scale = gridRect.height() / taskDimension.y;
            int outWidth = Math.round(scale * taskDimension.x);
            int outHeight = Math.round(scale * taskDimension.y);

@@ -225,19 +219,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            Gravity.apply(gravity, outWidth, outHeight, gridRect, outRect);
        } else {
            int taskMargin = dp.overviewTaskMarginPx;
            int proactiveRowAndMargin;
            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;
            } else {
                proactiveRowAndMargin = res.getDimensionPixelSize(
                        R.dimen.overview_proactive_row_height)
                        + res.getDimensionPixelSize(R.dimen.overview_proactive_row_bottom_margin);
            }
            calculateTaskSizeInternal(context, dp,
                    dp.overviewTaskThumbnailTopMarginPx,
                    proactiveRowAndMargin + getOverviewActionsHeight(context, dp),
                    getProactiveRowAndMargin(context, dp) + getOverviewActionsHeight(context, dp),
                    res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
                    outRect);
        }
@@ -299,13 +283,14 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
     */
    public final void calculateGridSize(Context context, DeviceProfile dp, Rect outRect) {
        Resources res = context.getResources();
        int topMargin = res.getDimensionPixelSize(R.dimen.overview_grid_top_margin);
        int bottomMargin = res.getDimensionPixelSize(R.dimen.overview_grid_bottom_margin);
        Rect insets = dp.getInsets();
        int topMargin = dp.overviewTaskThumbnailTopMarginPx;
        int bottomMargin =
                getProactiveRowAndMargin(context, dp) + getOverviewActionsHeight(context, dp);
        int sideMargin = res.getDimensionPixelSize(R.dimen.overview_grid_side_margin);

        Rect insets = dp.getInsets();
        outRect.set(0, 0, dp.widthPx, dp.heightPx);
        outRect.inset(Math.max(insets.left, sideMargin), Math.max(insets.top, topMargin),
        outRect.inset(Math.max(insets.left, sideMargin), insets.top + topMargin,
                Math.max(insets.right, sideMargin), Math.max(insets.bottom, bottomMargin));
    }

@@ -318,8 +303,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        Rect gridRect = new Rect();
        calculateGridSize(context, dp, gridRect);

        int rowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing);
        float rowHeight = (gridRect.height() - rowSpacing) / 2f;
        float rowHeight =
                (gridRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
                        / 2f;

        PointF taskDimension = getTaskDimension(context, dp);
        float scale = (rowHeight - dp.overviewTaskThumbnailTopMarginPx) / taskDimension.y;
@@ -328,7 +314,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T

        int gravity = Gravity.TOP;
        gravity |= orientedState.getRecentsRtlSetting(res) ? Gravity.RIGHT : Gravity.LEFT;
        gridRect.inset(0, dp.overviewTaskThumbnailTopMarginPx, 0, 0);
        Gravity.apply(gravity, outWidth, outHeight, gridRect, outRect);
    }

@@ -344,6 +329,21 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
                outRect);
    }

    private int getProactiveRowAndMargin(Context context, DeviceProfile dp) {
        Resources res = context.getResources();
        int proactiveRowAndMargin;
        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;
        } else {
            proactiveRowAndMargin = res.getDimensionPixelSize(
                    R.dimen.overview_proactive_row_height)
                    + res.getDimensionPixelSize(R.dimen.overview_proactive_row_bottom_margin);
        }
        return proactiveRowAndMargin;
    }

    /** Gets the space that the overview actions will take, including bottom margin. */
    private int getOverviewActionsHeight(Context context, DeviceProfile dp) {
        Resources res = context.getResources();
+2 −30
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.quickstep.views;

import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SHARE;

import android.content.Context;
@@ -33,7 +32,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.SysUINavigationMode;
@@ -90,9 +88,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo

    protected T mCallbacks;

    private float mModalness;
    private float mModalTransformY;

    protected DeviceProfile mDp;

    public OverviewActionsView(Context context) {
@@ -225,29 +220,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
        requestLayout();
    }

    /**
     * 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.
     */
    public void setTaskModalness(float modalness) {
        mModalness = modalness;
        applyTranslationY();
    }

    public void setModalTransformY(float modalTransformY) {
        mModalTransformY = modalTransformY;
        applyTranslationY();
    }

    private void applyTranslationY() {
        setTranslationY(getModalTrans(mModalTransformY));
    }

    private float getModalTrans(float endTranslation) {
        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) {
@@ -260,7 +232,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
            return dp.overviewActionsMarginThreeButtonPx;
        }

        return dp.overviewActionsMarginGesturePx;
        return dp.overviewActionsTopMarginGesturePx;
    }

    /** Get the bottom margin associated with the action buttons in Overview. */
@@ -276,6 +248,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
            return dp.overviewActionsMarginThreeButtonPx + inset;
        }

        return dp.overviewActionsMarginGesturePx + inset;
        return dp.overviewActionsBottomMarginGesturePx + inset;
    }
}
Loading