Merge "Ensuring that we offset cell items by their destination cell padding. (Bug 10881814)" into jb-ub-now-indigo-rose
This commit is contained in:
@@ -115,7 +115,6 @@ public class CellLayout extends ViewGroup {
|
|||||||
|
|
||||||
// If we're actively dragging something over this screen, mIsDragOverlapping is true
|
// If we're actively dragging something over this screen, mIsDragOverlapping is true
|
||||||
private boolean mIsDragOverlapping = false;
|
private boolean mIsDragOverlapping = false;
|
||||||
private final Point mDragCenter = new Point();
|
|
||||||
boolean mUseActiveGlowBackground = false;
|
boolean mUseActiveGlowBackground = false;
|
||||||
|
|
||||||
// These arrays are used to implement the drag visualization on x-large screens.
|
// These arrays are used to implement the drag visualization on x-large screens.
|
||||||
@@ -1204,12 +1203,6 @@ public class CellLayout extends ViewGroup {
|
|||||||
final int oldDragCellX = mDragCell[0];
|
final int oldDragCellX = mDragCell[0];
|
||||||
final int oldDragCellY = mDragCell[1];
|
final int oldDragCellY = mDragCell[1];
|
||||||
|
|
||||||
if (v != null && dragOffset == null) {
|
|
||||||
mDragCenter.set(originX + (v.getWidth() / 2), originY + (v.getHeight() / 2));
|
|
||||||
} else {
|
|
||||||
mDragCenter.set(originX, originY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dragOutline == null && v == null) {
|
if (dragOutline == null && v == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1224,11 +1217,6 @@ public class CellLayout extends ViewGroup {
|
|||||||
int left = topLeft[0];
|
int left = topLeft[0];
|
||||||
int top = topLeft[1];
|
int top = topLeft[1];
|
||||||
|
|
||||||
// Offset icons by their padding
|
|
||||||
if (v instanceof BubbleTextView) {
|
|
||||||
top += v.getPaddingTop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v != null && dragOffset == null) {
|
if (v != null && dragOffset == null) {
|
||||||
// When drawing the drag outline, it did not account for margin offsets
|
// When drawing the drag outline, it did not account for margin offsets
|
||||||
// added by the view's parent.
|
// added by the view's parent.
|
||||||
@@ -1249,7 +1237,9 @@ public class CellLayout extends ViewGroup {
|
|||||||
// outline offset
|
// outline offset
|
||||||
left += dragOffset.x + ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
|
left += dragOffset.x + ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
|
||||||
- dragRegion.width()) / 2;
|
- dragRegion.width()) / 2;
|
||||||
top += dragOffset.y;
|
int cHeight = getShortcutsAndWidgets().getCellContentHeight();
|
||||||
|
int cellPaddingY = (int) Math.max(0, ((mCellHeight - cHeight) / 2f));
|
||||||
|
top += dragOffset.y + cellPaddingY;
|
||||||
} else {
|
} else {
|
||||||
// Center the drag outline in the cell
|
// Center the drag outline in the cell
|
||||||
left += ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
|
left += ((mCellWidth * spanX) + ((spanX - 1) * mWidthGap)
|
||||||
|
|||||||
@@ -123,6 +123,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
|
|||||||
mIsHotseatLayout = isHotseat;
|
mIsHotseatLayout = isHotseat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getCellContentHeight() {
|
||||||
|
final LauncherAppState app = LauncherAppState.getInstance();
|
||||||
|
final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
|
return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
|
||||||
|
grid.hotseatCellHeightPx : grid.cellHeightPx);
|
||||||
|
}
|
||||||
|
|
||||||
public void measureChild(View child) {
|
public void measureChild(View child) {
|
||||||
final LauncherAppState app = LauncherAppState.getInstance();
|
final LauncherAppState app = LauncherAppState.getInstance();
|
||||||
final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||||
@@ -137,7 +144,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
|
|||||||
// Widgets have their own padding, so skip
|
// Widgets have their own padding, so skip
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, center the icon
|
// Otherwise, center the icon
|
||||||
int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
|
int cHeight = getCellContentHeight();
|
||||||
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
|
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
|
||||||
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
|
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
|
||||||
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
|
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user