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

Commit f29dc7c5 authored by randypfohl's avatar randypfohl
Browse files

abstracting fallback views to support container instead of activity

Test: Built and tested locally

Flag: NONE just abstracting in this cl

Bug:292269949

Change-Id: I0ce5efb4f193211216430f373605107c87de2c1a
parent f0123c91
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
    public TaskbarDragLayer(@NonNull Context context, @Nullable AttributeSet attrs,
            int defStyleAttr, int defStyleRes) {
        super(context, attrs, 1 /* alphaChannelCount */);
        mBackgroundRenderer = new TaskbarBackgroundRenderer(mActivity);
        mBackgroundRenderer = new TaskbarBackgroundRenderer(mContainer);

        mTaskbarBackgroundAlpha = new MultiPropertyFactory<>(this, BG_ALPHA, INDEX_COUNT,
                (a, b) -> a * b, 1f);
@@ -109,7 +109,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {

    public void init(TaskbarDragLayerController.TaskbarDragLayerCallbacks callbacks) {
        mControllerCallbacks = callbacks;
        mBackgroundRenderer.updateStashedHandleWidth(mActivity, getResources());
        mBackgroundRenderer.updateStashedHandleWidth(mContainer, getResources());
        recreateControllers();
    }

@@ -275,7 +275,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) {
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer);
            if (topView != null && topView.canHandleBack()) {
                topView.onBackInvoked();
                // Handled by the floating view.
+7 −7
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class TaskbarOverlayDragLayer extends
    @Override
    public void recreateControllers() {
        List<TouchController> controllers = new ArrayList<>();
        controllers.add(mActivity.getDragController());
        controllers.add(mContainer.getDragController());
        controllers.addAll(mTouchControllers);
        mControllers = controllers.toArray(new TouchController[0]);
    }
@@ -87,7 +87,7 @@ public class TaskbarOverlayDragLayer extends
    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) {
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer);
            if (topView != null && topView.canHandleBack()) {
                topView.onBackInvoked();
                return true;
@@ -96,7 +96,7 @@ public class TaskbarOverlayDragLayer extends
                && event.getKeyCode() == KeyEvent.KEYCODE_ESCAPE && event.hasNoModifiers()) {
            // Ignore escape if pressed in conjunction with any modifier keys. Close each
            // floating view one at a time for each key press.
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
            AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer);
            if (topView != null) {
                topView.close(/* animate= */ true);
                return true;
@@ -107,7 +107,7 @@ public class TaskbarOverlayDragLayer extends

    @Override
    public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) {
        if (mActivity.isAnySystemDragInProgress()) {
        if (mContainer.isAnySystemDragInProgress()) {
            inoutInfo.touchableRegion.setEmpty();
            inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
        }
@@ -123,7 +123,7 @@ public class TaskbarOverlayDragLayer extends
    @Override
    public void onViewRemoved(View child) {
        super.onViewRemoved(child);
        mActivity.getOverlayController().maybeCloseWindow();
        mContainer.getOverlayController().maybeCloseWindow();
    }

    /** Adds a {@link TouchController} to this drag layer. */
@@ -147,14 +147,14 @@ public class TaskbarOverlayDragLayer extends
     * 2) Sets tappableInsets bottom inset to 0.
     */
    private WindowInsets updateInsetsDueToStashing(WindowInsets oldInsets) {
        if (!DisplayController.isTransientTaskbar(mActivity)) {
        if (!DisplayController.isTransientTaskbar(mContainer)) {
            return oldInsets;
        }
        WindowInsets.Builder updatedInsetsBuilder = new WindowInsets.Builder(oldInsets);

        Insets oldNavInsets = oldInsets.getInsets(WindowInsets.Type.navigationBars());
        Insets newNavInsets = Insets.of(oldNavInsets.left, oldNavInsets.top, oldNavInsets.right,
                mActivity.getStashedTaskbarHeight());
                mContainer.getStashedTaskbarHeight());
        updatedInsetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets);

        Insets oldTappableInsets = oldInsets.getInsets(WindowInsets.Type.tappableElement());
+0 −8
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.animation.AnimatorSet;
import android.view.MotionEvent;

import androidx.annotation.Nullable;
import androidx.annotation.UiThread;

import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
@@ -124,13 +123,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        return activity != null && activity.isStarted();
    }

    @UiThread
    @Nullable
    public abstract <T extends RecentsView> T getVisibleRecentsView();

    @UiThread
    public abstract boolean switchToRecentsIfVisible(Animator.AnimatorListener animatorListener);

    public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
        TaskbarUIController controller = getTaskbarController();
        boolean isEventOverBubbleBarStashHandle =
+11 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.view.RemoteAnimationTarget;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.annotation.UiThread;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Flags;
@@ -59,8 +60,16 @@ import java.util.function.Predicate;
public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_TYPE>,
        CONTAINER_TYPE extends RecentsViewContainer> {


    public boolean rotationSupportedByActivity = false;

    @UiThread
    @Nullable
    public abstract <T extends RecentsView<?,?>> T getVisibleRecentsView();

    @UiThread
    public abstract boolean switchToRecentsIfVisible(Animator.AnimatorListener animatorListener);

    @Nullable
    public abstract CONTAINER_TYPE getCreatedContainer();

@@ -126,6 +135,8 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
        return false;
    }

    abstract void runOnInitBackgroundStateUI(Runnable callback);

    @Nullable
    public DesktopVisibilityController getDesktopVisibilityController() {
        CONTAINER_TYPE container = getCreatedContainer();
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ import java.util.function.Consumer;
 * Handles the navigation gestures when a 3rd party launcher is the default home activity.
 */
public class FallbackSwipeHandler extends
        AbsSwipeUpHandler<RecentsActivity, FallbackRecentsView, RecentsState> {
        AbsSwipeUpHandler<RecentsActivity, FallbackRecentsView<RecentsActivity>, RecentsState> {

    private static final String TAG = "FallbackSwipeHandler";

Loading