mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Fix widget span
Need to take the horizontal margin of the view into consideration. Fix: 233302799 Test: manual Change-Id: I5f584977db85d5436b22c3701f586a5b079099ae
This commit is contained in:
@@ -198,7 +198,9 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
|
||||
/** Returns the number of cells that can fit horizontally in a given {@code content}. */
|
||||
protected int computeMaxHorizontalSpans(View content, int contentHorizontalPaddingPx) {
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
int availableWidth = content.getMeasuredWidth() - contentHorizontalPaddingPx;
|
||||
int availableWidth = content.getMeasuredWidth()
|
||||
- contentHorizontalPaddingPx
|
||||
- (2 * mContentHorizontalMarginInPx);
|
||||
Point cellSize = deviceProfile.getCellSize();
|
||||
if (cellSize.x > 0) {
|
||||
return availableWidth / cellSize.x;
|
||||
|
||||
Reference in New Issue
Block a user