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

Commit 22ed03ee authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Excluding corner radius from quick switch gesture." into sc-dev

parents 8c0f8fba 7d3f73c8
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -177,33 +177,34 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                    final int startY;
                    final int startY;
                    final int endX;
                    final int endX;
                    final int endY;
                    final int endY;
                    final int cornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
                    if (toRight) {
                    if (toRight) {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                            // Swipe from the bottom left to the bottom right of the screen.
                            // Swipe from the bottom left to the bottom right of the screen.
                            startX = 0;
                            startX = cornerRadius;
                            startY = getSwipeStartY();
                            startY = getSwipeStartY();
                            endX = mLauncher.getDevice().getDisplayWidth();
                            endX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                            endY = startY;
                            endY = startY;
                        } else {
                        } else {
                            // Swipe from the bottom right to the top right of the screen.
                            // Swipe from the bottom right to the top right of the screen.
                            startX = getSwipeStartX();
                            startX = getSwipeStartX();
                            startY = mLauncher.getRealDisplaySize().y - 1;
                            startY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                            endX = startX;
                            endX = startX;
                            endY = 0;
                            endY = cornerRadius;
                        }
                        }
                    } else {
                    } else {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                            // Swipe from the bottom right to the bottom left of the screen.
                            // Swipe from the bottom right to the bottom left of the screen.
                            startX = mLauncher.getDevice().getDisplayWidth();
                            startX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                            startY = getSwipeStartY();
                            startY = getSwipeStartY();
                            endX = 0;
                            endX = cornerRadius;
                            endY = startY;
                            endY = startY;
                        } else {
                        } else {
                            // Swipe from the bottom left to the top left of the screen.
                            // Swipe from the bottom left to the top left of the screen.
                            startX = getSwipeStartX();
                            startX = getSwipeStartX();
                            startY = 0;
                            startY = cornerRadius;
                            endX = startX;
                            endX = startX;
                            endY = mLauncher.getRealDisplaySize().y - 1;
                            endY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                        }
                        }
                    }
                    }


+29 −0
Original line number Original line Diff line number Diff line
@@ -1450,4 +1450,33 @@ public final class LauncherInstrumentation {
            return null;
            return null;
        }
        }
    }
    }

    float getWindowCornerRadius() {
        final Resources resources = getResources();
        if (!supportsRoundedCornersOnWindows(resources)) {
            return 0f;
        }

        // Radius that should be used in case top or bottom aren't defined.
        float defaultRadius = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);

        float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
        if (topRadius == 0f) {
            topRadius = defaultRadius;
        }
        float bottomRadius = ResourceUtils.getDimenByName(
                "rounded_corner_radius_bottom", resources, 0);
        if (bottomRadius == 0f) {
            bottomRadius = defaultRadius;
        }

        // Always use the smallest radius to make sure the rounded corners will
        // completely cover the display.
        return Math.min(topRadius, bottomRadius);
    }

    private static boolean supportsRoundedCornersOnWindows(Resources resources) {
        return ResourceUtils.getBoolByName(
                "config_supportsRoundedCornersOnWindows", resources, false);
    }
}
}
 No newline at end of file
+1 −31
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORD


import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.assertTrue;


import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.SystemClock;
import android.os.SystemClock;
@@ -61,34 +60,6 @@ public final class Workspace extends Home {
        mHotseat = launcher.waitForLauncherObject("hotseat");
        mHotseat = launcher.waitForLauncherObject("hotseat");
    }
    }


    private static boolean supportsRoundedCornersOnWindows(Resources resources) {
        return ResourceUtils.getBoolByName(
                "config_supportsRoundedCornersOnWindows", resources, false);
    }

    private static float getWindowCornerRadius(Resources resources) {
        if (!supportsRoundedCornersOnWindows(resources)) {
            return 0f;
        }

        // Radius that should be used in case top or bottom aren't defined.
        float defaultRadius = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);

        float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
        if (topRadius == 0f) {
            topRadius = defaultRadius;
        }
        float bottomRadius = ResourceUtils.getDimenByName(
                "rounded_corner_radius_bottom", resources, 0);
        if (bottomRadius == 0f) {
            bottomRadius = defaultRadius;
        }

        // Always use the smallest radius to make sure the rounded corners will
        // completely cover the display.
        return Math.min(topRadius, bottomRadius);
    }

    /**
    /**
     * Swipes up to All Apps.
     * Swipes up to All Apps.
     *
     *
@@ -103,8 +74,7 @@ public final class Workspace extends Home {
            final int deviceHeight = mLauncher.getDevice().getDisplayHeight();
            final int deviceHeight = mLauncher.getDevice().getDisplayHeight();
            final int bottomGestureMargin = ResourceUtils.getNavbarSize(
            final int bottomGestureMargin = ResourceUtils.getNavbarSize(
                    ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources());
                    ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources());
            final int windowCornerRadius = (int) Math.ceil(getWindowCornerRadius(
            final int windowCornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
                    mLauncher.getResources()));
            final int startY = deviceHeight - Math.max(bottomGestureMargin, windowCornerRadius) - 1;
            final int startY = deviceHeight - Math.max(bottomGestureMargin, windowCornerRadius) - 1;
            final int swipeHeight = mLauncher.getTestInfo(
            final int swipeHeight = mLauncher.getTestInfo(
                    TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT).
                    TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT).