Swipe up on nav bar to go home from -1 and widgets
More specifically, any window (e.g. qsb search) or AbstractFloatingView.
NavBarToHomeTouchController now implements TouchController directly instead
of AbstractStateChangeTouchController, as it not only dealing with
launcher states. This makes it easier to override intercept logic to
handle cases like not having window focus, for example.
AbstractFloatingViews can createHintCloseAnim() to play an animation
hinting that it is about to be closed by swiping up. Widgets sheets use
this to pull back similar to the all apps transition to home.
Bug: 129976669
Change-Id: Ie157b978d9f1ee36d5fd32cea72ec02ce40878c0
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 599a353..e7d7a69 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -19,9 +19,11 @@
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
+
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
+import android.animation.Animator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
@@ -30,7 +32,11 @@
import android.view.View;
import android.widget.LinearLayout;
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
@@ -38,8 +44,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import androidx.annotation.IntDef;
-
/**
* Base class for a View which shows a floating UI on top of the launcher UI.
*/
@@ -124,8 +128,20 @@
protected abstract void handleClose(boolean animate);
+ /**
+ * Creates a user-controlled animation to hint that the view will be closed if completed.
+ * @param distanceToMove The max distance that elements should move from their starting point.
+ */
+ public @Nullable Animator createHintCloseAnim(float distanceToMove) {
+ return null;
+ }
+
public abstract void logActionCommand(int command);
+ public int getLogContainerType() {
+ return ContainerType.DEFAULT_CONTAINERTYPE;
+ }
+
public final boolean isOpen() {
return mIsOpen;
}