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

Commit 23c4fb81 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Track window rather than shelf when FeatureFlags.SWIPE_HOME = true" into ub-launcher3-master

parents c42ff814 68a716c5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,7 +41,8 @@ public class BackgroundAppState extends OverviewState {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return super.getVerticalProgress(launcher);
        }
        int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher.getDeviceProfile());
        int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher,
                launcher.getDeviceProfile());
        AllAppsTransitionController controller = launcher.getAllAppsController();
        float scrollRange = Math.max(controller.getShiftRange(), 1);
        float progressDelta = (transitionLength / scrollRange);
+2 −1
Original line number Diff line number Diff line
@@ -213,7 +213,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
            mCurrentAnimation = AnimatorPlaybackController.wrap(mPendingAnimation.anim, maxAccuracy,
                    onCancelRunnable);
            mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation);
            totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher.getDeviceProfile());
            totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher,
                    mLauncher.getDeviceProfile());
        } else {
            mCurrentAnimation = mLauncher.getStateManager()
                    .createAnimationToNewWorkspace(mToState, builder, maxAccuracy, this::clearState,
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
                int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right;
                return dp.hotseatBarSizePx + hotseatInset;
            } else {
                return LayoutUtils.getShelfTrackingDistance(dp);
                return LayoutUtils.getShelfTrackingDistance(context, dp);
            }
        }

+12 −4
Original line number Diff line number Diff line
@@ -21,14 +21,15 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;

import androidx.annotation.AnyThread;
import androidx.annotation.IntDef;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;

import java.lang.annotation.Retention;

import androidx.annotation.AnyThread;
import androidx.annotation.IntDef;

public class LayoutUtils {

    private static final int MULTI_WINDOW_STRATEGY_HALF_SCREEN = 1;
@@ -112,7 +113,14 @@ public class LayoutUtils {
                Math.round(x + outWidth), Math.round(y + outHeight));
    }

    public static int getShelfTrackingDistance(DeviceProfile dp) {
    public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
        if (FeatureFlags.SWIPE_HOME.get()) {
            // Track the bottom of the window rather than the top of the shelf.
            int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
            int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
                    R.dimen.task_card_vert_space);
            return shelfHeight + spaceBetweenShelfAndRecents;
        }
        // Start from a third of bottom inset to provide some shelf overlap.
        return dp.hotseatBarSizePx + dp.getInsets().bottom / 3 - dp.edgeMarginPx * 2;
    }
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ abstract class BaseFlags {
    public static final TogglableFlag ENABLE_QUICKSTEP_LIVE_TILE = new TogglableFlag(
            "ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview");

    public static final ToggleableGlobalSettingsFlag SWIPE_HOME
            = new ToggleableGlobalSettingsFlag("SWIPE_HOME", false,
            "[WIP] Swiping up on the nav bar goes home. Swipe and hold goes to recent apps.");

    public static void initialize(Context context) {
        // Avoid the disk read for user builds
        if (Utilities.IS_DEBUG_DEVICE) {