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

Commit 59969377 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing Launcher dependency from Folders

This allows opening/closing folders without a Launcher context

Bug: 187353581
Test: Manual
Change-Id: Id73a40445a23004eb554f0422d286aa0ff6b3c41
parent 7bce233f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            List<View> viewsToAnimate = new ArrayList<>();

            Workspace workspace = mLauncher.getWorkspace();
            workspace.getVisiblePages().forEach(
            workspace.forEachVisiblePage(
                    view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));

            viewsToAnimate.add(mLauncher.getHotseat());
+41 −0
Original line number Diff line number Diff line
@@ -16,12 +16,24 @@
package com.android.launcher3.taskbar;

import android.content.ContextWrapper;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.Nullable;

import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
import com.android.launcher3.R;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;

@@ -35,6 +47,7 @@ public class TaskbarActivityContext extends ContextWrapper implements ActivityCo
    private final DeviceProfile mDeviceProfile;
    private final LayoutInflater mLayoutInflater;
    private final TaskbarContainerView mTaskbarContainerView;
    private final MyDragController mDragController;

    public TaskbarActivityContext(BaseQuickstepLauncher launcher) {
        super(launcher);
@@ -47,6 +60,7 @@ public class TaskbarActivityContext extends ContextWrapper implements ActivityCo

        mTaskbarContainerView = (TaskbarContainerView) mLayoutInflater
                .inflate(R.layout.taskbar, null, false);
        mDragController = new MyDragController(this);
    }

    public TaskbarContainerView getTaskbarContainerView() {
@@ -72,4 +86,31 @@ public class TaskbarActivityContext extends ContextWrapper implements ActivityCo
    public Rect getFolderBoundingBox() {
        return mTaskbarContainerView.getFolderBoundingBox();
    }

    @Override
    public DragController getDragController() {
        return mDragController;
    }

    private static class MyDragController extends DragController<TaskbarActivityContext> {
        MyDragController(TaskbarActivityContext activity) {
            super(activity);
        }

        @Override
        protected DragView startDrag(@Nullable Drawable drawable, @Nullable View view,
                DraggableView originalView, int dragLayerX, int dragLayerY, DragSource source,
                ItemInfo dragInfo, Point dragOffset, Rect dragRegion, float initialDragViewScale,
                float dragViewScaleOnDrop, DragOptions options) {
            return null;
        }

        @Override
        protected void exitDrag() { }

        @Override
        protected DropTarget getDefaultDropTarget(int[] dropCoordinates) {
            return null;
        }
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -89,8 +89,7 @@ public class StaggeredWorkspaceAnim {
        int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2);

        // Add animation for all the visible workspace pages
        workspace.getVisiblePages()
                .forEach(page -> addAnimationForPage((CellLayout) page, totalRows));
        workspace.forEachVisiblePage(page -> addAnimationForPage((CellLayout) page, totalRows));

        boolean workspaceClipChildren = workspace.getClipChildren();
        boolean workspaceClipToPadding = workspace.getClipToPadding();
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ public abstract class BaseActivity extends Activity implements ActivityContext {

    private final ViewCache mViewCache = new ViewCache();

    @Override
    public ViewCache getViewCache() {
        return mViewCache;
    }
+4 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.launcher3;

import static com.android.launcher3.util.UiThreadHelper.hideKeyboardAsync;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -25,7 +27,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.UiThreadHelper;
import com.android.launcher3.views.ActivityContext;


/**
@@ -99,7 +101,7 @@ public class ExtendedEditText extends EditText {
    }

    public void hideKeyboard() {
        UiThreadHelper.hideKeyboardAsync(Launcher.getLauncher(getContext()), getWindowToken());
        hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getWindowToken());
    }

    private boolean showSoftInput() {
Loading