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

Commit 9f502b77 authored by Alex Stetson's avatar Alex Stetson
Browse files

Decouple swipe distance from start threshold

Allow customization of swipe distance and start distance (from edge of
screen) to be independent.

Bug: 339266762
Test: manual
Flag: NONE
Change-Id: I92c78eabe2f52d7906c4400022a3ca33be7a3fb2
parent b8b71da0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@
    <!-- The default margin used in immersive mode to capture the start of a swipe gesture from the
         edge of the screen to show the system bars. -->
    <dimen name="system_gestures_start_threshold">24dp</dimen>
    <!-- The minimum swipe gesture distance for showing the system bars when in immersive mode. This
         swipe must be within the specified system_gestures_start_threshold area. -->
    <dimen name="system_gestures_distance_threshold">24dp</dimen>

    <!-- Height of the bottom navigation bar frame; this is different than navigation_bar_height
         where that is the height reported to all the other windows to resize themselves around the
+1 −0
Original line number Diff line number Diff line
@@ -1801,6 +1801,7 @@
  <java-symbol type="dimen" name="taskbar_frame_height" />
  <java-symbol type="dimen" name="status_bar_height" />
  <java-symbol type="dimen" name="display_cutout_touchable_region_size" />
  <java-symbol type="dimen" name="system_gestures_distance_threshold" />
  <java-symbol type="dimen" name="system_gestures_start_threshold" />
  <java-symbol type="dimen" name="quick_qs_offset_height" />
  <java-symbol type="drawable" name="ic_jog_dial_sound_off" />
+4 −4
Original line number Diff line number Diff line
@@ -98,10 +98,10 @@ constructor(context: Context, gestureDetector: GesturePointerEventDetector) : Co
            return
        }
        val r = mContext.resources
        val defaultThreshold = r.getDimensionPixelSize(R.dimen.system_gestures_start_threshold)
        mSwipeStartThreshold[defaultThreshold, defaultThreshold, defaultThreshold] =
            defaultThreshold
        mSwipeDistanceThreshold = defaultThreshold
        val startThreshold = r.getDimensionPixelSize(R.dimen.system_gestures_start_threshold)
        mSwipeStartThreshold[startThreshold, startThreshold, startThreshold] = startThreshold
        mSwipeDistanceThreshold =
            r.getDimensionPixelSize(R.dimen.system_gestures_distance_threshold)
        val display = DisplayManagerGlobal.getInstance().getRealDisplay(mContext.displayId)
        val displayCutout = display.cutout
        if (displayCutout != null) {
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ abstract class SwipeUpGestureHandler(
    private var monitoringCurrentTouch: Boolean = false

    private var swipeDistanceThreshold: Int = context.resources.getDimensionPixelSize(
        com.android.internal.R.dimen.system_gestures_start_threshold
        com.android.internal.R.dimen.system_gestures_distance_threshold
    )

    override fun onInputEvent(ev: InputEvent) {
+5 −4
Original line number Diff line number Diff line
@@ -107,11 +107,12 @@ class SystemGesturesPointerEventListener implements PointerEventListener {

    void onConfigurationChanged() {
        final Resources r = mContext.getResources();
        final int defaultThreshold = r.getDimensionPixelSize(
        final int startThreshold = r.getDimensionPixelSize(
                com.android.internal.R.dimen.system_gestures_start_threshold);
        mSwipeStartThreshold.set(defaultThreshold, defaultThreshold, defaultThreshold,
                defaultThreshold);
        mSwipeDistanceThreshold = defaultThreshold;
        mSwipeStartThreshold.set(startThreshold, startThreshold, startThreshold,
                startThreshold);
        mSwipeDistanceThreshold = r.getDimensionPixelSize(
                com.android.internal.R.dimen.system_gestures_distance_threshold);

        final Display display = DisplayManagerGlobal.getInstance()
                .getRealDisplay(Display.DEFAULT_DISPLAY);