mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Fix the way Home computes the cell span of widgets.
This was causing problem on some WVGA devices. Change-Id: Ic02c0c70fabad7e9c4a7425d6a98cceb7803538f
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.launcher2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
@@ -685,13 +686,15 @@ public class CellLayout extends ViewGroup {
|
||||
public int[] rectToCell(int width, int height) {
|
||||
// Always assume we're working with the smallest span to make sure we
|
||||
// reserve enough space in both orientations.
|
||||
int actualWidth = mCellWidth + mWidthGap;
|
||||
int actualHeight = mCellHeight + mHeightGap;
|
||||
final Resources resources = getResources();
|
||||
int actualWidth = resources.getDimensionPixelSize(R.dimen.workspace_cell_width);
|
||||
int actualHeight = resources.getDimensionPixelSize(R.dimen.workspace_cell_height);
|
||||
int smallerSize = Math.min(actualWidth, actualHeight);
|
||||
|
||||
|
||||
// Always round up to next largest cell
|
||||
int spanX = (width + smallerSize) / smallerSize;
|
||||
int spanY = (height + smallerSize) / smallerSize;
|
||||
|
||||
return new int[] { spanX, spanY };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user