Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6f64a44 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Listen for hover events over stashed taskbar." into udc-dev

parents 64ee67c6 c5882bcd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -292,6 +292,8 @@
    <dimen name="taskbar_stashed_small_screen">108dp</dimen>
    <dimen name="taskbar_unstash_input_area">316dp</dimen>
    <dimen name="taskbar_stashed_handle_height">4dp</dimen>
    <dimen name="taskbar_stashed_screen_edge_hover_deadzone_height">10dp</dimen>
    <dimen name="taskbar_stashed_below_hover_deadzone_height">1dp</dimen>
    <dimen name="taskbar_edu_horizontal_margin">112dp</dimen>
    <dimen name="taskbar_nav_buttons_width_kids">88dp</dimen>
    <dimen name="taskbar_nav_buttons_height_kids">40dp</dimen>
+26 −1
Original line number Diff line number Diff line
@@ -928,6 +928,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        }
    }

    /**
     * Returns whether the taskbar is currently visually stashed.
     */
    public boolean isTaskbarStashed() {
        return mControllers.taskbarStashController.isStashed();
    }

    /**
     * Called when we detect a long press in the nav region before passing the gesture slop.
     * @return Whether taskbar handled the long press, and thus should cancel the gesture.
@@ -972,10 +979,23 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    /**
     * Called when we detect a motion down or up/cancel in the nav region while stashed.
     *
     * @param animateForward Whether to animate towards the unstashed hint state or back to stashed.
     */
    public void startTaskbarUnstashHint(boolean animateForward) {
        mControllers.taskbarStashController.startUnstashHint(animateForward);
        // TODO(b/270395798): Clean up forceUnstash after removing long-press unstashing code.
        startTaskbarUnstashHint(animateForward, /* forceUnstash = */ false);
    }

    /**
     * Called when we detect a motion down or up/cancel in the nav region while stashed.
     *
     * @param animateForward Whether to animate towards the unstashed hint state or back to stashed.
     * @param forceUnstash Whether we force the unstash hint.
     */
    public void startTaskbarUnstashHint(boolean animateForward, boolean forceUnstash) {
        // TODO(b/270395798): Clean up forceUnstash after removing long-press unstashing code.
        mControllers.taskbarStashController.startUnstashHint(animateForward, forceUnstash);
    }

    /**
@@ -1123,4 +1143,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
    public int getTaskbarAllAppsScroll() {
        return mControllers.taskbarAllAppsController.getTaskbarAllAppsScroll();
    }

    @VisibleForTesting
    public float getStashedTaskbarScale() {
        return mControllers.stashedHandleViewController.getStashedHandleHintScale().value;
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -856,15 +856,18 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    /**
     * Creates and starts a partial unstash animation, hinting at the new state that will trigger
     * when long press is detected.
     *
     * @param animateForward Whether we are going towards the new unstashed state or returning to
     *                       the stashed state.
     * @param forceUnstash Whether we force the unstash hint to animate.
     */
    public void startUnstashHint(boolean animateForward) {
    protected void startUnstashHint(boolean animateForward, boolean forceUnstash) {
        if (!isStashed()) {
            // Already unstashed, no need to hint in that direction.
            return;
        }
        if (!canCurrentlyManuallyUnstash()) {
        // TODO(b/270395798): Clean up after removing long-press unstashing code path.
        if (!canCurrentlyManuallyUnstash() && !forceUnstash) {
            // If any other flags are causing us to be stashed, long press won't cause us to
            // unstash, so don't hint that it will.
            return;
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_NEGATIVE
import com.android.launcher3.touch.SingleAxisSwipeDetector.VERTICAL
import com.android.launcher3.util.DisplayController
import com.android.launcher3.util.TouchController
import com.android.quickstep.inputconsumers.TaskbarStashInputConsumer
import com.android.quickstep.inputconsumers.TaskbarUnstashInputConsumer

/**
 * A helper [TouchController] for [TaskbarDragLayerController], specifically to handle touch events
@@ -34,7 +34,7 @@ import com.android.quickstep.inputconsumers.TaskbarStashInputConsumer
 *   or [MotionEvent.ACTION_OUTSIDE].
 * - Touches inside Transient Taskbar bounds will stash if it is detected as a swipe down gesture.
 *
 * Note: touches to *unstash* Taskbar are handled by [TaskbarStashInputConsumer].
 * Note: touches to *unstash* Taskbar are handled by [TaskbarUnstashInputConsumer].
 */
class TaskbarStashViaTouchController(val controllers: TaskbarControllers) : TouchController {

+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ public interface InputConsumer {
    int TYPE_ONE_HANDED = 1 << 11;
    int TYPE_TASKBAR_STASH = 1 << 12;
    int TYPE_STATUS_BAR = 1 << 13;
    int TYPE_CURSOR_HOVER = 1 << 14;

    String[] NAMES = new String[] {
           "TYPE_NO_OP",                    // 0
@@ -57,6 +58,7 @@ public interface InputConsumer {
            "TYPE_ONE_HANDED",              // 11
            "TYPE_TASKBAR_STASH",           // 12
            "TYPE_STATUS_BAR",              // 13
            "TYPE_CURSOR_HOVER",            // 14
    };

    InputConsumer NO_OP = () -> TYPE_NO_OP;
Loading