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

Commit 6639a5df authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Updating the scrim and landscpae ui

> Instead of views, using a custom class to draw the color scrims
> All-apps has full screen UI
> Quickstep does not have search box in landscape

Bug: 73085356
Change-Id: I360a78a2ade0134daad29fe712796cd39a381fbb
parent 43936eb0
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
    <dimen name="task_corner_radius">2dp</dimen>
    <dimen name="task_fade_length">20dp</dimen>
    <dimen name="recents_page_spacing">10dp</dimen>
    <dimen name="recents_page_fade_length">100dp</dimen>

    <!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
             loading full resolution screenshots. -->
@@ -34,9 +35,6 @@

    <dimen name="workspace_overview_offset_x">-24dp</dimen>

    <!-- TODO: This can be calculated using other resource values -->
    <dimen name="all_apps_search_box_full_height">90dp</dimen>

    <!-- Launcher app transition -->
    <dimen name="content_trans_y">25dp</dimen>
    <dimen name="workspace_trans_y">80dp</dimen>
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
 */
public class AllAppsState extends LauncherState {

    private static final int STATE_FLAGS = FLAG_DISABLE_ACCESSIBILITY;
    private static final int STATE_FLAGS = FLAG_DISABLE_ACCESSIBILITY
            | FLAG_SHOW_SCRIM | FLAG_ALL_APPS_SCRIM;

    private static final PageAlphaProvider PAGE_ALPHA_PROVIDER = new PageAlphaProvider(DEACCEL_2) {
        @Override
+5 −11
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.graphics.GradientView;
import com.android.launcher3.graphics.ColorScrim;
import com.android.launcher3.widget.WidgetsFullSheet;

/**
@@ -54,7 +54,7 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
    private final Launcher mLauncher;
    private final PointF mTouchPoint = new PointF();

    private final GradientView mGradientView;
    private final ColorScrim mScrim;

    protected Animator mOpenCloseAnimator;

@@ -75,11 +75,7 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
        });

        mLauncher = Launcher.getLauncher(context);

        mGradientView = (GradientView) mLauncher.getLayoutInflater().inflate(
                R.layout.widgets_bottom_sheet_scrim, mLauncher.getDragLayer(), false);
        mGradientView.setProgress(1, false);
        mGradientView.setAlpha(0);
        mScrim = ColorScrim.createExtractedColorScrim(this);
    }

    @Override
@@ -149,7 +145,7 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
        fadeOut.setInterpolator(Interpolators.DEACCEL);
        closeAnim.play(fadeOut);

        Animator gradientAlpha = ObjectAnimator.ofFloat(mGradientView, ALPHA, 0);
        Animator gradientAlpha = ObjectAnimator.ofFloat(mScrim, ColorScrim.PROGRESS, 0);
        gradientAlpha.setInterpolator(Interpolators.DEACCEL);
        closeAnim.play(gradientAlpha);

@@ -177,7 +173,6 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
        }
        mIsOpen = false;
        mLauncher.getDragLayer().removeView(this);
        mLauncher.getDragLayer().removeView(mGradientView);
    }

    @Override
@@ -213,7 +208,7 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
                .createRevealAnimator(this, false);
        openAnim.play(revealAnim);

        Animator gradientAlpha = ObjectAnimator.ofFloat(mGradientView, ALPHA, 1);
        Animator gradientAlpha = ObjectAnimator.ofFloat(mScrim, ColorScrim.PROGRESS, 1);
        gradientAlpha.setInterpolator(Interpolators.ACCEL);
        openAnim.play(gradientAlpha);

@@ -269,7 +264,6 @@ public class OptionsPopupView extends AbstractFloatingView implements OnClickLis
        lp.y = Utilities.boundToRange((int) (y - height / 2), insets.top + margin,
                maxHeight - insets.bottom - height - margin);

        launcher.getDragLayer().addView(view.mGradientView);
        launcher.getDragLayer().addView(view);
        view.animateOpen();
    }
+1 −19
Original line number Diff line number Diff line
@@ -18,11 +18,9 @@ package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -36,7 +34,7 @@ import com.android.quickstep.RecentsView;
public class OverviewState extends LauncherState {

    private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED
            | FLAG_DISABLE_RESTORE;
            | FLAG_DISABLE_RESTORE | FLAG_PAGE_BACKGROUNDS;

    public OverviewState(int id) {
        super(id, ContainerType.TASKSWITCHER, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
@@ -71,11 +69,6 @@ public class OverviewState extends LauncherState {
        rv.setOverviewStateEnabled(false);
    }

    @Override
    public float getVerticalProgress(Launcher launcher) {
        return getVerticalProgress(launcher.getDeviceProfile(), launcher);
    }

    @Override
    public View getFinalFocus(Launcher launcher) {
        return launcher.getOverviewPanel();
@@ -118,15 +111,4 @@ public class OverviewState extends LauncherState {

        return new float[] {scale, translationX, translationY};
    }

    public static float getVerticalProgress(DeviceProfile grid, Context context) {
        if (!grid.isVerticalBarLayout()) {
            return 1f;
        }

        float total = grid.heightPx;
        float searchHeight = total - grid.availableHeightPx +
                context.getResources().getDimension(R.dimen.all_apps_search_box_full_height);
        return 1 - (searchHeight / total);
    }
}
+7 −4
Original line number Diff line number Diff line
@@ -383,11 +383,14 @@ public class RecentsView extends PagedView implements Insettable, OnSharedPrefer

        float overviewHeight, overviewWidth;
        if (profile.isVerticalBarLayout()) {
            float scrimLength = context.getResources()
                    .getDimension(R.dimen.recents_page_fade_length);
            float maxPadding = Math.max(padding.left, padding.right);

            // Use the same padding on both sides for symmetry.
            float availableWidth = taskWidth - 2 * Math.max(padding.left, padding.right);
            float availableHeight = profile.availableHeightPx - padding.top
                    - sTempStableInsets.top - Math.max(padding.bottom,
                    profile.heightPx * (1 - OverviewState.getVerticalProgress(profile, context)));
            float availableWidth = taskWidth - 2 * Math.max(maxPadding, scrimLength);
            float availableHeight = profile.availableHeightPx - padding.top - padding.bottom
                    - sTempStableInsets.top;
            float scaledRatio = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
            overviewHeight = taskHeight * scaledRatio;
            overviewWidth = taskWidth * scaledRatio;
Loading