mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Merge "Fixes search feature invocation issue" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7d793ecdda
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user