Skip to content
This repository was archived by the owner on May 10, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.stario.launcher.R;
import com.stario.launcher.sheet.SheetsFocusController;
import com.stario.launcher.themes.ThemedActivity;
import com.stario.launcher.ui.Measurements;
import com.stario.launcher.ui.common.glance.GlanceConstraintLayout;
import com.stario.launcher.ui.common.grid.DraggableGridItem;
import com.stario.launcher.ui.common.grid.DynamicGridLayout;
Expand Down Expand Up @@ -74,6 +75,7 @@ public void attach(DynamicGridLayout container) {
DynamicGridLayout.ItemLayoutData defaultLayoutData =
new DynamicGridLayout.ItemLayoutData(GLANCE_TAG, 0, 0, 3, 1);
defaultLayoutData.minColSpan = 3;
defaultLayoutData.minWidth = Measurements.dpToPx(330);
defaultLayoutData.maxColSpan = 4;
defaultLayoutData.maxRowSpan = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,8 @@ public PinnedAppsGroupDialog(@NonNull ThemedActivity activity, TransitionListene

this.categoryChangeListener = new Category.CategoryItemListener() {
private void update() {
if (recycler != null) {
recycler.post(() -> {
if (isShowing()) {
adapter.updateDataSnapshot(category, skip);
manager.setSpanCount(invalidateRecycler());
}
});
if (isShowing()) {
dismiss();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,32 @@ public class DraggableGridItem extends FrameLayout {
private float visualHeight;
private float visualWidth;
private float borderAlpha;

public String itemId;
public int minColSpan;
public int minRowSpan;
public int minWidth;
public int maxColSpan;
public int maxWidth;
public int minRowSpan;
public int minHeight;
public int maxRowSpan;
public int maxHeight;

public DraggableGridItem(Context context) {
super(context);

this.isVisualResizeEnabled = false;
this.isResizingActive = false;

this.borderAlpha = 0;
this.minColSpan = 1;
this.minRowSpan = 1;
this.minWidth = -1;
this.maxColSpan = -1;
this.maxWidth = -1;
this.minRowSpan = 1;
this.minHeight = -1;
this.maxRowSpan = -1;
this.maxHeight = -1;

if (!(context instanceof ThemedActivity)) {
throw new RuntimeException("Parent activity is not of type ThemedActivity.");
Expand Down Expand Up @@ -282,6 +292,36 @@ protected void dispatchDraw(@NonNull Canvas canvas) {
private boolean canResizeWidth() {
DynamicGridLayout parent = (DynamicGridLayout) getParent();

int minComputedWidth;
if (minWidth > 0) {
if (minColSpan > 0) {
minComputedWidth = Math.max(minWidth, minColSpan * parent.getCellWidth());
} else {
minComputedWidth = minWidth;
}
} else if (minColSpan > 0) {
minComputedWidth = minColSpan * parent.getCellWidth();
} else {
minComputedWidth = 0;
}

int maxComputedWidth;
if (maxWidth > 0) {
if (maxColSpan > 0) {
maxComputedWidth = Math.min(maxWidth, maxColSpan * parent.getCellWidth());
} else {
maxComputedWidth = maxWidth;
}
} else if (maxColSpan > 0) {
maxComputedWidth = maxColSpan * parent.getCellWidth();
} else {
maxComputedWidth = parent.getWidth();
}

if (maxComputedWidth - minComputedWidth < parent.getCellWidth()) {
return false;
}

if (maxColSpan > 0) {
return Math.min(maxColSpan, parent.getColumnCount()) > minColSpan;
}
Expand All @@ -292,6 +332,36 @@ private boolean canResizeWidth() {
private boolean canResizeHeight() {
DynamicGridLayout parent = (DynamicGridLayout) getParent();

int minComputedHeight;
if (minHeight > 0) {
if (minRowSpan > 0) {
minComputedHeight = Math.max(minHeight, minRowSpan * parent.getCellHeight());
} else {
minComputedHeight = minHeight;
}
} else if (minRowSpan > 0) {
minComputedHeight = minRowSpan * parent.getCellHeight();
} else {
minComputedHeight = 0;
}

int maxComputedHeight;
if (maxHeight > 0) {
if (maxRowSpan > 0) {
maxComputedHeight = Math.min(maxHeight, maxRowSpan * parent.getCellHeight());
} else {
maxComputedHeight = maxHeight;
}
} else if (maxRowSpan > 0) {
maxComputedHeight = maxRowSpan * parent.getCellHeight();
} else {
maxComputedHeight = parent.getHeight();
}

if (maxComputedHeight - minComputedHeight < parent.getCellHeight()) {
return false;
}

if (maxRowSpan > 0) {
return Math.min(maxRowSpan, parent.getRowCount()) > minRowSpan;
}
Expand Down
Loading
Loading