diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-03-14 12:30:11 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-03-15 17:29:43 -0700 |
commit | 0b0847b272a37ed115504956be5ce44a96b5784c (patch) | |
tree | 03014c8d93aca5eadcdb1838808a3a035f41619a /src/com/android/launcher3/AbstractFloatingView.java | |
parent | 39b5534b96a889393b3bafd84dda6333ea8eb157 (diff) | |
download | android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.tar.gz android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.tar.bz2 android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.zip |
Fixing taskMenu and taskView clicks in fallback activity
> Extracting common methods from Launcher & DragLauncher to base classes
> Remoting some dependencies on Launcher and using the base class instead
Change-Id: I121cacf8a14190b4703cda60bdeb4f79eee69ded
Diffstat (limited to 'src/com/android/launcher3/AbstractFloatingView.java')
-rw-r--r-- | src/com/android/launcher3/AbstractFloatingView.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index fc5ce8f2b..f34cf0dc5 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -24,9 +24,9 @@ import android.view.MotionEvent; import android.view.View; import android.widget.LinearLayout; -import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.util.TouchController; +import com.android.launcher3.views.BaseDragLayer; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -92,7 +92,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch public final void close(boolean animate) { animate &= !Utilities.isPowerSaverOn(getContext()); handleClose(animate); - Launcher.getLauncher(getContext()).getUserEventDispatcher() + BaseActivity.fromContext(getContext()).getUserEventDispatcher() .resetElapsedContainerMillis("container closed"); } @@ -120,8 +120,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch } protected static <T extends AbstractFloatingView> T getOpenView( - Launcher launcher, @FloatingViewType int type) { - DragLayer dragLayer = launcher.getDragLayer(); + BaseDraggingActivity activity, @FloatingViewType int type) { + BaseDragLayer dragLayer = activity.getDragLayer(); // Iterate in reverse order. AbstractFloatingView is added later to the dragLayer, // and will be one of the last views. for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) { @@ -136,16 +136,17 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch return null; } - public static void closeOpenContainer(Launcher launcher, @FloatingViewType int type) { - AbstractFloatingView view = getOpenView(launcher, type); + public static void closeOpenContainer(BaseDraggingActivity activity, + @FloatingViewType int type) { + AbstractFloatingView view = getOpenView(activity, type); if (view != null) { view.close(true); } } - public static void closeOpenViews(Launcher launcher, boolean animate, + public static void closeOpenViews(BaseDraggingActivity activity, boolean animate, @FloatingViewType int type) { - DragLayer dragLayer = launcher.getDragLayer(); + BaseDragLayer dragLayer = activity.getDragLayer(); // Iterate in reverse order. AbstractFloatingView is added later to the dragLayer, // and will be one of the last views. for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) { @@ -159,16 +160,16 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch } } - public static void closeAllOpenViews(Launcher launcher, boolean animate) { - closeOpenViews(launcher, animate, TYPE_ALL); - launcher.finishAutoCancelActionMode(); + public static void closeAllOpenViews(BaseDraggingActivity activity, boolean animate) { + closeOpenViews(activity, animate, TYPE_ALL); + activity.finishAutoCancelActionMode(); } - public static void closeAllOpenViews(Launcher launcher) { - closeAllOpenViews(launcher, true); + public static void closeAllOpenViews(BaseDraggingActivity activity) { + closeAllOpenViews(activity, true); } - public static AbstractFloatingView getTopOpenView(Launcher launcher) { - return getOpenView(launcher, TYPE_ALL); + public static AbstractFloatingView getTopOpenView(BaseDraggingActivity activity) { + return getOpenView(activity, TYPE_ALL); } } |