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

Commit 91a4aca5 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Have backup TouchController of Taskbar All Apps AFV.

BaseDragLayer only lets the top AFV intercpet touch events, otherwise it
moves onto its TouchController instances. Taskbar AllApps still needs to
intercept touch events sometimes when an AFV above it cannot (e.g. a
snackbar). This CL adds a TouchController to TaskbarOverlayDragLayer
that delegates to TaskbarAllAppsSlideInView if it is open.

Test: Manual
Fix: 299165179
Flag: No
Change-Id: I9b73c55f698de5b60b463f91140a6717a7053cd3
parent 50fac00e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -161,6 +161,9 @@ public final class TaskbarAllAppsController {

        mSlideInView = (TaskbarAllAppsSlideInView) mOverlayContext.getLayoutInflater().inflate(
                R.layout.taskbar_all_apps_sheet, mOverlayContext.getDragLayer(), false);
        // Ensures All Apps gets touch events in case it is not the top floating view. Floating
        // views above it may not be able to intercept the touch, so All Apps should try to.
        mOverlayContext.getDragLayer().addTouchController(mSlideInView);
        mSlideInView.addOnCloseListener(() -> {
            mControllers.getSharedState().allAppsVisible = false;
            cleanUpOverlay();
@@ -195,6 +198,7 @@ public final class TaskbarAllAppsController {
            mSearchSessionController = null;
        }
        if (mOverlayContext != null) {
            mOverlayContext.getDragLayer().removeTouchController(mSlideInView);
            mOverlayContext.setSearchSessionController(null);
            mOverlayContext = null;
        }
+21 −4
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@@ -69,6 +70,7 @@ public class TaskbarOverlayDragLayer extends
            return true;
        }
    };
    private final List<TouchController> mTouchControllers = new ArrayList<>();

    TaskbarOverlayDragLayer(Context context) {
        super(context, null, 1);
@@ -93,10 +95,13 @@ public class TaskbarOverlayDragLayer extends

    @Override
    public void recreateControllers() {
        mControllers = mOnClickListeners.isEmpty()
                ? new TouchController[]{mActivity.getDragController()}
                : new TouchController[] {
                        mActivity.getDragController(), mClickListenerTouchController};
        List<TouchController> controllers = new ArrayList<>();
        controllers.add(mActivity.getDragController());
        controllers.addAll(mTouchControllers);
        if (!mOnClickListeners.isEmpty()) {
            controllers.add(mClickListenerTouchController);
        }
        mControllers = controllers.toArray(new TouchController[0]);
    }

    @Override
@@ -183,6 +188,18 @@ public class TaskbarOverlayDragLayer extends
        });
    }

    /** Adds a {@link TouchController} to this drag layer. */
    public void addTouchController(@NonNull TouchController touchController) {
        mTouchControllers.add(touchController);
        recreateControllers();
    }

    /** Removes a {@link TouchController} from this drag layer. */
    public void removeTouchController(@NonNull TouchController touchController) {
        mTouchControllers.remove(touchController);
        recreateControllers();
    }

    /**
     * Taskbar automatically stashes when opening all apps, but we don't report the insets as
     * changing to avoid moving the underlying app. But internally, the apps view should still