Fixed broken widget overlap (#3792)

- Due to the faulty merged of A13
This commit is contained in:
John Andrew Camu authored and GitHub committed 2023-11-30 06:12:12 +08:00
1 parent c58df33042
commit d60bced322
2 files changed
+23 -2

No files matched your search

+8 -2
View File
@@ -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());
}
}