Loading quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressHandler.java +11 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.quickstep.inputconsumers; import android.content.Context; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.util.ResourceBasedOverride; Loading @@ -33,12 +35,15 @@ public class NavHandleLongPressHandler implements ResourceBasedOverride { } /** * Called when nav handle is long pressed. * * @return if the long press was consumed, meaning other input consumers should receive a * cancel event * Called when nav handle is long pressed to get the Runnable that should be executed by the * caller to invoke long press behavior. If null is returned that means long press couldn't be * handled. * <p> * A Runnable is returned here to ensure the InputConsumer can call * {@link android.view.InputMonitor#pilferPointers()} before invoking the long press behavior * since pilfering can break the long press behavior. */ public boolean onLongPress() { return false; public @Nullable Runnable getLongPressRunnable() { return null; } } quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +6 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { public NavHandleLongPressInputConsumer(Context context, InputConsumer delegate, InputMonitorCompat inputMonitor) { super(delegate, inputMonitor); mNavHandleWidth = context.getResources() .getDimensionPixelSize(R.dimen.navigation_home_handle_width); mNavHandleWidth = context.getResources().getDimensionPixelSize( R.dimen.navigation_home_handle_width); mScreenWidth = DisplayController.INSTANCE.get(context).getInfo().currentSize.x; mNavHandleLongPressHandler = NavHandleLongPressHandler.newInstance(context); Loading @@ -48,8 +48,11 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { @Override public void onLongPress(MotionEvent motionEvent) { if (isInArea(motionEvent.getRawX())) { if (mNavHandleLongPressHandler.onLongPress()) { Runnable longPressRunnable = mNavHandleLongPressHandler.getLongPressRunnable(); if (longPressRunnable != null) { setActive(motionEvent); longPressRunnable.run(); } } } Loading Loading
quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressHandler.java +11 −6 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.quickstep.inputconsumers; import android.content.Context; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.util.ResourceBasedOverride; Loading @@ -33,12 +35,15 @@ public class NavHandleLongPressHandler implements ResourceBasedOverride { } /** * Called when nav handle is long pressed. * * @return if the long press was consumed, meaning other input consumers should receive a * cancel event * Called when nav handle is long pressed to get the Runnable that should be executed by the * caller to invoke long press behavior. If null is returned that means long press couldn't be * handled. * <p> * A Runnable is returned here to ensure the InputConsumer can call * {@link android.view.InputMonitor#pilferPointers()} before invoking the long press behavior * since pilfering can break the long press behavior. */ public boolean onLongPress() { return false; public @Nullable Runnable getLongPressRunnable() { return null; } }
quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +6 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { public NavHandleLongPressInputConsumer(Context context, InputConsumer delegate, InputMonitorCompat inputMonitor) { super(delegate, inputMonitor); mNavHandleWidth = context.getResources() .getDimensionPixelSize(R.dimen.navigation_home_handle_width); mNavHandleWidth = context.getResources().getDimensionPixelSize( R.dimen.navigation_home_handle_width); mScreenWidth = DisplayController.INSTANCE.get(context).getInfo().currentSize.x; mNavHandleLongPressHandler = NavHandleLongPressHandler.newInstance(context); Loading @@ -48,8 +48,11 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { @Override public void onLongPress(MotionEvent motionEvent) { if (isInArea(motionEvent.getRawX())) { if (mNavHandleLongPressHandler.onLongPress()) { Runnable longPressRunnable = mNavHandleLongPressHandler.getLongPressRunnable(); if (longPressRunnable != null) { setActive(motionEvent); longPressRunnable.run(); } } } Loading