@@ -79,6 +79,7 @@ import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||
import com.patrykmichalik.opto.core.PreferenceExtensionsKt;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -2343,6 +2344,11 @@ public class CellLayout extends ViewGroup {
|
||||
if (cellX < 0 || cellY < 0) return false;
|
||||
|
||||
mIntersectingViews.clear();
|
||||
if (PreferenceExtensionsKt.firstBlocking(mPreferenceManager2.getAllowWidgetOverlap())) {
|
||||
// let's pretend no intersections exist
|
||||
solution.intersectingViews = new ArrayList<>(mIntersectingViews);
|
||||
return true;
|
||||
}
|
||||
mOccupiedRect.set(cellX, cellY, cellX + spanX, cellY + spanY);
|
||||
|
||||
// Mark the desired location of the view currently being dragged.
|
||||
@@ -2739,7 +2745,7 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
public boolean isOccupied(int x, int y) {
|
||||
if (x < mCountX && y < mCountY) {
|
||||
return mOccupied.cells[x][y];
|
||||
return mOccupied.cells[x][y] && !PreferenceExtensionsKt.firstBlocking(mPreferenceManager2.getAllowWidgetOverlap());
|
||||
} else {
|
||||
throw new RuntimeException("Position exceeds the bound of this CellLayout");
|
||||
}
|
||||
@@ -2857,6 +2863,6 @@ public class CellLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
public boolean isRegionVacant(int x, int y, int spanX, int spanY) {
|
||||
return mOccupied.isRegionVacant(x, y, spanX, spanY);
|
||||
return mOccupied.isRegionVacant(x, y, spanX, spanY) || PreferenceExtensionsKt.firstBlocking(mPreferenceManager2.getAllowWidgetOverlap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.widget.NavigableAppWidgetHostView;
|
||||
import com.patrykmichalik.opto.core.PreferenceExtensionsKt;
|
||||
|
||||
import app.lawnchair.preferences2.PreferenceManager2;
|
||||
|
||||
public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.FolderIconParent {
|
||||
static final String TAG = "ShortcutAndWidgetContainer";
|
||||
@@ -62,11 +65,23 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
private final ActivityContext mActivity;
|
||||
private boolean mInvertIfRtl = false;
|
||||
|
||||
private final PreferenceManager2 mPreferenceManager2;
|
||||
|
||||
public ShortcutAndWidgetContainer(Context context, @ContainerType int containerType) {
|
||||
super(context);
|
||||
mActivity = ActivityContext.lookupContext(context);
|
||||
mWallpaperManager = WallpaperManager.getInstance(context);
|
||||
mContainerType = containerType;
|
||||
mPreferenceManager2 = PreferenceManager2.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
boolean mAllowWidgetOverlap = PreferenceExtensionsKt.firstBlocking(mPreferenceManager2.getAllowWidgetOverlap());
|
||||
setClipChildren(!mAllowWidgetOverlap);
|
||||
setClipToPadding(!mAllowWidgetOverlap);
|
||||
setClipToOutline(!mAllowWidgetOverlap);
|
||||
}
|
||||
|
||||
public void setCellDimensions(int cellWidth, int cellHeight, int countX, int countY,
|
||||
|
||||
Reference in New Issue
Block a user