Add custom extra width to trigger LPNH
This is defined in dp from the edge of the nav handle. So if you set it to 48, you can invoke 48dp from the left or right of the handle (which is roughly the size of an average fingertip). You can also set it to a negative value to make the invocation region smaller. This applies to both navbar and stashed taskbar, and the minimum touch target is always 48dp. For reference, the navbar width is 108dp and taskbar is 220dp. Defaults to 0, i.e. you can only invoke within the visible navbar. Bug: 325118077 Flag: LEGACY CUSTOM_LPNH_THRESHOLDS DISABLED Test: Manual Change-Id: I904a484a99ac4af05de13573fac610b84fd7f0f1
This commit is contained in:
@@ -22,6 +22,7 @@ import static android.view.View.VISIBLE;
|
||||
|
||||
import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD;
|
||||
import static com.android.launcher3.LauncherPrefs.PRIVATE_SPACE_APPS;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_EXTRA_TOUCH_WIDTH_DP;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_DELAY;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_END_SCALE_PERCENT;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_ITERATIONS;
|
||||
@@ -359,6 +360,10 @@ public class DeveloperOptionsUI {
|
||||
"Slop multiplier (applied to edge slop, "
|
||||
+ "which is generally already 50% higher than touch slop)",
|
||||
25, 200, 100, LPNH_SLOP_PERCENTAGE));
|
||||
category.addPreference(createSeekBarPreference(
|
||||
"Extra width DP (how far outside the sides of the nav bar to trigger)",
|
||||
// Stashed taskbar is currently 220dp; -86 (x2) would result in 48dp touch area.
|
||||
-86, 100, 1, LPNH_EXTRA_TOUCH_WIDTH_DP));
|
||||
category.addPreference(createSeekBarPreference("LPNH timeout",
|
||||
100, 500, 1, LPNH_TIMEOUT_MS));
|
||||
}
|
||||
|
||||
+12
@@ -22,9 +22,11 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
@@ -39,6 +41,8 @@ import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
*/
|
||||
public class NavHandleLongPressInputConsumer extends DelegateInputConsumer {
|
||||
|
||||
private static final String TAG = "NavHandleLongPressIC";
|
||||
|
||||
private final NavHandleLongPressHandler mNavHandleLongPressHandler;
|
||||
private final float mNavHandleWidth;
|
||||
private final float mScreenWidth;
|
||||
@@ -175,6 +179,14 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer {
|
||||
|
||||
private boolean isInNavBarHorizontalArea(float x) {
|
||||
float areaFromMiddle = mNavHandleWidth / 2.0f;
|
||||
if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) {
|
||||
areaFromMiddle += Utilities.dpToPx(FeatureFlags.LPNH_EXTRA_TOUCH_WIDTH_DP.get());
|
||||
}
|
||||
int minAccessibleSize = Utilities.dpToPx(24); // Half of 48dp because this is per side.
|
||||
if (areaFromMiddle < minAccessibleSize) {
|
||||
Log.w(TAG, "Custom nav handle region is too small - resetting to 48dp");
|
||||
areaFromMiddle = minAccessibleSize;
|
||||
}
|
||||
float distFromMiddle = Math.abs(mScreenWidth / 2.0f - x);
|
||||
|
||||
return distFromMiddle < areaFromMiddle;
|
||||
|
||||
Reference in New Issue
Block a user