mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Predictive back: widget to all apps
This CL adds a layer of OnBackPressedHanlderRouter to Launcher: 1. 4 OnBackPressedHandler(s) are added in such order: auto cancel action mode handler, drag handler, view handler and state handler 2. first handler who can handle back will handle the entire back gesture 3. Let WidgetsFullSheet to handle widget to all apps transition Bug: b/260956481 Test: manual Change-Id: Idbce3dcec746226dd68aaabaddc8fe01334e9673
This commit is contained in:
@@ -46,7 +46,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
/**
|
||||
* Base class for a View which shows a floating UI on top of the launcher UI.
|
||||
*/
|
||||
public abstract class AbstractFloatingView extends LinearLayout implements TouchController {
|
||||
public abstract class AbstractFloatingView extends LinearLayout implements TouchController,
|
||||
OnBackPressedHandler {
|
||||
|
||||
@IntDef(flag = true, value = {
|
||||
TYPE_FOLDER,
|
||||
@@ -165,12 +166,16 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
|
||||
protected abstract boolean isOfType(@FloatingViewType int type);
|
||||
|
||||
/** @return Whether the back is consumed. If false, Launcher will handle the back as well. */
|
||||
public boolean onBackPressed() {
|
||||
close(true);
|
||||
/** Return true if this view can consume back press. */
|
||||
public boolean canHandleBack() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackInvoked() {
|
||||
close(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onControllerTouchEvent(MotionEvent ev) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user