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

Commit 59a38e67 authored by Tony Wickham's avatar Tony Wickham Committed by Tony
Browse files

Flatten recents (remove curve effect)

- Workspace card scales down to be same width as other cards, which
  leaves a gap at the bottom due to difference in aspect ratio. This
  can be changed in the future, but deferring for now.
- Workspace card no longer offsets when scrolling.
- Cards no longer scale and translate, but still have a bit of dimming
  when on the edges, so the center card has the most focus.

A lot of code can be cleaned up. Added TODO's now, will cleanup in
followup CL

Bug: 70179222
Change-Id: I2332aab10e2549a455f773e053ed8b48677c3110
parent 016d7e93
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@
    <dimen name="quickstep_fling_threshold_velocity">500dp</dimen>
    <dimen name="quickstep_fling_min_velocity">250dp</dimen>

    <dimen name="workspace_overview_offset_x">-24dp</dimen>
    <!-- TODO: can remove -->
    <dimen name="workspace_overview_offset_x">0dp</dimen>

    <!-- Launcher app transition -->
    <dimen name="content_trans_y">25dp</dimen>
+1 −2
Original line number Diff line number Diff line
@@ -98,9 +98,8 @@ public class OverviewState extends LauncherState {
            Rect pageRect) {
        Workspace ws = launcher.getWorkspace();
        float childWidth = ws.getNormalChildWidth();
        float childHeight = ws.getNormalChildHeight();

        float scale = pageRect.height() / childHeight;
        float scale = pageRect.width() / childWidth;
        Rect insets = launcher.getDragLayer().getInsets();

        float halfHeight = ws.getExpectedHeight() / 2;
+7 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public class WorkspaceCard extends View implements PageCallbacks, OnClickListene
        super.onLayout(changed, left, top, right, bottom);

        // Initiate data
        // TODO: can remove most of this as workspace card is no longer scrolling
        mLinearInterpolationForPage2 = RecentsView.getScaledDownPageRect(
                mLauncher.getDeviceProfile(), mLauncher, mTempRect);

@@ -98,11 +99,17 @@ public class WorkspaceCard extends View implements PageCallbacks, OnClickListene
    }

    public void setWorkspaceScrollingEnabled(boolean isEnabled) {
        // TODO can remove
        mIsWorkspaceScrollingEnabled = isEnabled;
    }

    @Override
    public int onPageScroll(ScrollState scrollState) {
        // TODO: can remove
        if (true) {
            return SCROLL_TYPE_WORKSPACE;
        }

        float factor = scrollState.linearInterpolation;
        float translateX = scrollState.distanceFromScreenCenter;
        if (mIsWorkspaceScrollingEnabled) {
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.quickstep;

import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.quickstep.TaskView.CURVE_FACTOR;
import static com.android.quickstep.TaskView.CURVE_INTERPOLATOR;

@@ -52,7 +51,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.uioverrides.OverviewState;
import com.android.launcher3.uioverrides.RecentsViewStateController;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
@@ -637,6 +635,7 @@ public class RecentsView extends PagedView implements Insettable, OnSharedPrefer
        canvas.restoreToCount(saveCount);
    }

    // TODO: can remove
    public interface PageCallbacks {

        /**
+6 −4
Original line number Diff line number Diff line
@@ -47,17 +47,19 @@ import java.util.function.Consumer;
 */
public class TaskView extends FrameLayout implements TaskCallbacks, PageCallbacks {

    // TODO: can remove
    /** Designates how "curvy" the carousel is from 0 to 1, where 0 is a straight line. */
    public static final float CURVE_FACTOR = 0.25f;
    /** A circular curve of x from 0 to 1, where 0 is the center of the screen and 1 is the edge. */
    public static final float CURVE_FACTOR = 0;

    /** A curve of x from 0 to 1, where 0 is the center of the screen and 1 is the edge. */
    public static final TimeInterpolator CURVE_INTERPOLATOR
            = x -> (float) (1 - Math.sqrt(1 - Math.pow(x, 2)));
            = x -> (float) -Math.cos(x * Math.PI) / 2f + .5f;

    /**
     * The alpha of a black scrim on a page in the carousel as it leaves the screen.
     * In the resting position of the carousel, the adjacent pages have about half this scrim.
     */
    private static final float MAX_PAGE_SCRIM_ALPHA = 0.8f;
    private static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;

    private static final long SCALE_ICON_DURATION = 120;