Merge "Change the access of cellX/Y of CellLayoutLayoutParams to private" into tm-qpr-dev am: 519714449f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20838734 Change-Id: Id6707d575fecfeae28b704fd8701c82f4288a9f2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -124,7 +124,7 @@ public class StaggeredWorkspaceAnim {
|
|||||||
for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) {
|
for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) {
|
||||||
View child = hotseatIcons.getChildAt(i);
|
View child = hotseatIcons.getChildAt(i);
|
||||||
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
||||||
addStaggeredAnimationForView(child, lp.cellY + 1, totalRows, duration);
|
addStaggeredAnimationForView(child, lp.getCellY() + 1, totalRows, duration);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final int hotseatRow, qsbRow;
|
final int hotseatRow, qsbRow;
|
||||||
@@ -194,7 +194,7 @@ public class StaggeredWorkspaceAnim {
|
|||||||
for (int i = itemsContainer.getChildCount() - 1; i >= 0; i--) {
|
for (int i = itemsContainer.getChildCount() - 1; i >= 0; i--) {
|
||||||
View child = itemsContainer.getChildAt(i);
|
View child = itemsContainer.getChildAt(i);
|
||||||
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
||||||
addStaggeredAnimationForView(child, lp.cellY + lp.cellVSpan, totalRows, duration);
|
addStaggeredAnimationForView(child, lp.getCellY() + lp.cellVSpan, totalRows, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimators.addListener(new AnimatorListenerAdapter() {
|
mAnimators.addListener(new AnimatorListenerAdapter() {
|
||||||
|
|||||||
@@ -268,8 +268,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
|
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mWidgetView.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mWidgetView.getLayoutParams();
|
||||||
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
|
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
|
||||||
lp.cellX = lp.tmpCellX = widgetInfo.cellX;
|
lp.setCellX(widgetInfo.cellX);
|
||||||
lp.cellY = lp.tmpCellY = widgetInfo.cellY;
|
lp.setTmpCellX(widgetInfo.cellX);
|
||||||
|
lp.setCellY(widgetInfo.cellY);
|
||||||
|
lp.setTmpCellY(widgetInfo.cellY);
|
||||||
lp.cellHSpan = widgetInfo.spanX;
|
lp.cellHSpan = widgetInfo.spanX;
|
||||||
lp.cellVSpan = widgetInfo.spanY;
|
lp.cellVSpan = widgetInfo.spanY;
|
||||||
lp.isLockedToGrid = true;
|
lp.isLockedToGrid = true;
|
||||||
@@ -425,8 +427,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
|
|
||||||
int spanX = lp.cellHSpan;
|
int spanX = lp.cellHSpan;
|
||||||
int spanY = lp.cellVSpan;
|
int spanY = lp.cellVSpan;
|
||||||
int cellX = lp.useTmpCoords ? lp.tmpCellX : lp.cellX;
|
int cellX = lp.useTmpCoords ? lp.getTmpCellX() : lp.getCellX();
|
||||||
int cellY = lp.useTmpCoords ? lp.tmpCellY : lp.cellY;
|
int cellY = lp.useTmpCoords ? lp.getTmpCellY() : lp.getCellY();
|
||||||
|
|
||||||
// For each border, we bound the resizing based on the minimum width, and the maximum
|
// For each border, we bound the resizing based on the minimum width, and the maximum
|
||||||
// expandability.
|
// expandability.
|
||||||
@@ -467,8 +469,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
mLauncher.getString(R.string.widget_resized, spanX, spanY));
|
mLauncher.getString(R.string.widget_resized, spanX, spanY));
|
||||||
}
|
}
|
||||||
|
|
||||||
lp.tmpCellX = cellX;
|
lp.setTmpCellX(cellX);
|
||||||
lp.tmpCellY = cellY;
|
lp.setTmpCellY(cellY);
|
||||||
lp.cellHSpan = spanX;
|
lp.cellHSpan = spanX;
|
||||||
lp.cellVSpan = spanY;
|
lp.cellVSpan = spanY;
|
||||||
mRunningVInc += vSpanDelta;
|
mRunningVInc += vSpanDelta;
|
||||||
|
|||||||
@@ -623,8 +623,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (alpha <= 0) continue;
|
if (alpha <= 0) continue;
|
||||||
|
|
||||||
mVisualizeGridPaint.setAlpha(255);
|
mVisualizeGridPaint.setAlpha(255);
|
||||||
int x = mDragOutlines[i].cellX;
|
int x = mDragOutlines[i].getCellX();
|
||||||
int y = mDragOutlines[i].cellY;
|
int y = mDragOutlines[i].getCellY();
|
||||||
int spanX = mDragOutlines[i].cellHSpan;
|
int spanX = mDragOutlines[i].cellHSpan;
|
||||||
int spanY = mDragOutlines[i].cellVSpan;
|
int spanY = mDragOutlines[i].cellVSpan;
|
||||||
|
|
||||||
@@ -764,7 +764,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
|
|
||||||
// Generate an id for each view, this assumes we have at most 256x256 cells
|
// Generate an id for each view, this assumes we have at most 256x256 cells
|
||||||
// per workspace screen
|
// per workspace screen
|
||||||
if (lp.cellX >= 0 && lp.cellX <= mCountX - 1 && lp.cellY >= 0 && lp.cellY <= mCountY - 1) {
|
if (lp.getCellX() >= 0 && lp.getCellX() <= mCountX - 1
|
||||||
|
&& lp.getCellY() >= 0 && lp.getCellY() <= mCountY - 1) {
|
||||||
// If the horizontal or vertical span is set to -1, it is taken to
|
// If the horizontal or vertical span is set to -1, it is taken to
|
||||||
// mean that it spans the extent of the CellLayout
|
// mean that it spans the extent of the CellLayout
|
||||||
if (lp.cellHSpan < 0) lp.cellHSpan = mCountX;
|
if (lp.cellHSpan < 0) lp.cellHSpan = mCountX;
|
||||||
@@ -1072,7 +1073,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
|
|
||||||
if (adjustOccupied) {
|
if (adjustOccupied) {
|
||||||
GridOccupancy occupied = permanent ? mOccupied : mTmpOccupied;
|
GridOccupancy occupied = permanent ? mOccupied : mTmpOccupied;
|
||||||
occupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, false);
|
occupied.markCells(lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan, false);
|
||||||
occupied.markCells(cellX, cellY, lp.cellHSpan, lp.cellVSpan, true);
|
occupied.markCells(cellX, cellY, lp.cellHSpan, lp.cellVSpan, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,11 +1084,11 @@ public class CellLayout extends ViewGroup {
|
|||||||
final int oldY = lp.y;
|
final int oldY = lp.y;
|
||||||
lp.isLockedToGrid = true;
|
lp.isLockedToGrid = true;
|
||||||
if (permanent) {
|
if (permanent) {
|
||||||
lp.cellX = info.cellX = cellX;
|
lp.setCellX(info.cellX = cellX);
|
||||||
lp.cellY = info.cellY = cellY;
|
lp.setCellY(info.cellY = cellY);
|
||||||
} else {
|
} else {
|
||||||
lp.tmpCellX = cellX;
|
lp.setTmpCellX(cellX);
|
||||||
lp.tmpCellY = cellY;
|
lp.setTmpCellY(cellY);
|
||||||
}
|
}
|
||||||
clc.setupLp(child);
|
clc.setupLp(child);
|
||||||
final int newX = lp.x;
|
final int newX = lp.x;
|
||||||
@@ -1167,8 +1168,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
mDragOutlineCurrent = (oldIndex + 1) % mDragOutlines.length;
|
mDragOutlineCurrent = (oldIndex + 1) % mDragOutlines.length;
|
||||||
|
|
||||||
CellLayoutLayoutParams cell = mDragOutlines[mDragOutlineCurrent];
|
CellLayoutLayoutParams cell = mDragOutlines[mDragOutlineCurrent];
|
||||||
cell.cellX = cellX;
|
cell.setCellX(cellX);
|
||||||
cell.cellY = cellY;
|
cell.setCellY(cellY);
|
||||||
cell.cellHSpan = spanX;
|
cell.cellHSpan = spanX;
|
||||||
cell.cellVSpan = spanY;
|
cell.cellVSpan = spanY;
|
||||||
|
|
||||||
@@ -1385,8 +1386,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
CellAndSpan c = solution.map.get(child);
|
CellAndSpan c = solution.map.get(child);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
lp.tmpCellX = c.cellX;
|
lp.setTmpCellX(c.cellX);
|
||||||
lp.tmpCellY = c.cellY;
|
lp.setTmpCellY(c.cellY);
|
||||||
lp.cellHSpan = c.spanX;
|
lp.cellHSpan = c.spanX;
|
||||||
lp.cellVSpan = c.spanY;
|
lp.cellVSpan = c.spanY;
|
||||||
mTmpOccupied.markCells(c, true);
|
mTmpOccupied.markCells(c, true);
|
||||||
@@ -1433,7 +1434,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
if (c != null && !skip && (child instanceof Reorderable)) {
|
if (c != null && !skip && (child instanceof Reorderable)) {
|
||||||
ReorderPreviewAnimation rha = new ReorderPreviewAnimation((Reorderable) child,
|
ReorderPreviewAnimation rha = new ReorderPreviewAnimation((Reorderable) child,
|
||||||
mode, lp.cellX, lp.cellY, c.cellX, c.cellY, c.spanX, c.spanY);
|
mode, lp.getCellX(), lp.getCellY(), c.cellX, c.cellY, c.spanX, c.spanY);
|
||||||
rha.animate();
|
rha.animate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1626,12 +1627,14 @@ public class CellLayout extends ViewGroup {
|
|||||||
// We do a null check here because the item info can be null in the case of the
|
// We do a null check here because the item info can be null in the case of the
|
||||||
// AllApps button in the hotseat.
|
// AllApps button in the hotseat.
|
||||||
if (info != null && child != dragView) {
|
if (info != null && child != dragView) {
|
||||||
final boolean requiresDbUpdate = (info.cellX != lp.tmpCellX
|
final boolean requiresDbUpdate = (info.cellX != lp.getTmpCellX()
|
||||||
|| info.cellY != lp.tmpCellY || info.spanX != lp.cellHSpan
|
|| info.cellY != lp.getTmpCellY() || info.spanX != lp.cellHSpan
|
||||||
|| info.spanY != lp.cellVSpan);
|
|| info.spanY != lp.cellVSpan);
|
||||||
|
|
||||||
info.cellX = lp.cellX = lp.tmpCellX;
|
lp.setCellX(lp.getTmpCellX());
|
||||||
info.cellY = lp.cellY = lp.tmpCellY;
|
info.cellX = lp.getTmpCellX();
|
||||||
|
info.cellY = lp.getTmpCellY();
|
||||||
|
lp.setCellY(lp.getTmpCellY());
|
||||||
info.spanX = lp.cellHSpan;
|
info.spanX = lp.cellHSpan;
|
||||||
info.spanY = lp.cellVSpan;
|
info.spanY = lp.cellVSpan;
|
||||||
|
|
||||||
@@ -1697,7 +1700,8 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (child == dragView) continue;
|
if (child == dragView) continue;
|
||||||
CellLayoutLayoutParams
|
CellLayoutLayoutParams
|
||||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
r1.set(lp.cellX, lp.cellY, lp.cellX + lp.cellHSpan, lp.cellY + lp.cellVSpan);
|
r1.set(lp.getCellX(), lp.getCellY(), lp.getCellX() + lp.cellHSpan,
|
||||||
|
lp.getCellY() + lp.cellVSpan);
|
||||||
if (Rect.intersects(r0, r1)) {
|
if (Rect.intersects(r0, r1)) {
|
||||||
mIntersectingViews.add(child);
|
mIntersectingViews.add(child);
|
||||||
if (boundingRect != null) {
|
if (boundingRect != null) {
|
||||||
@@ -1723,11 +1727,11 @@ public class CellLayout extends ViewGroup {
|
|||||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||||
CellLayoutLayoutParams
|
CellLayoutLayoutParams
|
||||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
if (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY) {
|
if (lp.getTmpCellX() != lp.getCellX() || lp.getTmpCellY() != lp.getCellY()) {
|
||||||
lp.tmpCellX = lp.cellX;
|
lp.setTmpCellX(lp.getCellX());
|
||||||
lp.tmpCellY = lp.cellY;
|
lp.setTmpCellY(lp.getCellY());
|
||||||
animateChildToPosition(child, lp.cellX, lp.cellY, REORDER_ANIMATION_DURATION,
|
animateChildToPosition(child, lp.getCellX(), lp.getCellY(),
|
||||||
0, false, false);
|
REORDER_ANIMATION_DURATION, 0, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setItemPlacementDirty(false);
|
setItemPlacementDirty(false);
|
||||||
@@ -2449,9 +2453,9 @@ public class CellLayout extends ViewGroup {
|
|||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
CellAndSpan c;
|
CellAndSpan c;
|
||||||
if (temp) {
|
if (temp) {
|
||||||
c = new CellAndSpan(lp.tmpCellX, lp.tmpCellY, lp.cellHSpan, lp.cellVSpan);
|
c = new CellAndSpan(lp.getTmpCellX(), lp.getTmpCellY(), lp.cellHSpan, lp.cellVSpan);
|
||||||
} else {
|
} else {
|
||||||
c = new CellAndSpan(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan);
|
c = new CellAndSpan(lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan);
|
||||||
}
|
}
|
||||||
solution.add(child, c);
|
solution.add(child, c);
|
||||||
}
|
}
|
||||||
@@ -2794,7 +2798,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
||||||
CellLayoutLayoutParams
|
CellLayoutLayoutParams
|
||||||
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
||||||
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, true);
|
mOccupied.markCells(lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markCellsAsUnoccupiedForView(View view) {
|
public void markCellsAsUnoccupiedForView(View view) {
|
||||||
@@ -2807,7 +2811,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
||||||
CellLayoutLayoutParams
|
CellLayoutLayoutParams
|
||||||
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
||||||
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, false);
|
mOccupied.markCells(lp.getCellX(), lp.getCellY(), lp.cellHSpan, lp.cellVSpan, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDesiredWidth() {
|
public int getDesiredWidth() {
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
|||||||
View child = getChildAt(i);
|
View child = getChildAt(i);
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
if ((lp.cellX <= cellX) && (cellX < lp.cellX + lp.cellHSpan)
|
if ((lp.getCellX() <= cellX) && (cellX < lp.getCellX() + lp.cellHSpan)
|
||||||
&& (lp.cellY <= cellY) && (cellY < lp.cellY + lp.cellVSpan)) {
|
&& (lp.getCellY() <= cellY) && (cellY < lp.getCellY() + lp.cellVSpan)) {
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
|||||||
lp.canReorder = false;
|
lp.canReorder = false;
|
||||||
if (mContainerType == HOTSEAT) {
|
if (mContainerType == HOTSEAT) {
|
||||||
CellLayout cl = (CellLayout) getParent();
|
CellLayout cl = (CellLayout) getParent();
|
||||||
cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
|
cl.setFolderLeaveBehindCell(lp.getCellX(), lp.getCellY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1757,7 +1757,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
boolean willCreateUserFolder(ItemInfo info, View dropOverView, boolean considerTimeout) {
|
boolean willCreateUserFolder(ItemInfo info, View dropOverView, boolean considerTimeout) {
|
||||||
if (dropOverView != null) {
|
if (dropOverView != null) {
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
||||||
if (lp.useTmpCoords && (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY)) {
|
if (lp.useTmpCoords && (lp.getTmpCellX() != lp.getCellX()
|
||||||
|
|| lp.getTmpCellY() != lp.getCellY())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1792,7 +1793,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
boolean willAddToExistingUserFolder(ItemInfo dragInfo, View dropOverView) {
|
boolean willAddToExistingUserFolder(ItemInfo dragInfo, View dropOverView) {
|
||||||
if (dropOverView != null) {
|
if (dropOverView != null) {
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
||||||
if (lp.useTmpCoords && (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY)) {
|
if (lp.useTmpCoords && (lp.getTmpCellX() != lp.getCellX()
|
||||||
|
|| lp.getTmpCellY() != lp.getCellY())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2009,8 +2011,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
|
|
||||||
// update the item's position after drop
|
// update the item's position after drop
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
||||||
lp.cellX = lp.tmpCellX = mTargetCell[0];
|
lp.setTmpCellX(mTargetCell[0]);
|
||||||
lp.cellY = lp.tmpCellY = mTargetCell[1];
|
lp.setCellX(mTargetCell[0]);
|
||||||
|
lp.setTmpCellY(mTargetCell[1]);
|
||||||
|
lp.setCellY(mTargetCell[1]);
|
||||||
lp.cellHSpan = item.spanX;
|
lp.cellHSpan = item.spanX;
|
||||||
lp.cellVSpan = item.spanY;
|
lp.cellVSpan = item.spanY;
|
||||||
lp.isLockedToGrid = true;
|
lp.isLockedToGrid = true;
|
||||||
@@ -2024,7 +2028,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
(LauncherAppWidgetHostView) cell, dropTargetLayout);
|
(LauncherAppWidgetHostView) cell, dropTargetLayout);
|
||||||
}
|
}
|
||||||
mLauncher.getModelWriter().modifyItemInDatabase(info, container, screenId,
|
mLauncher.getModelWriter().modifyItemInDatabase(info, container, screenId,
|
||||||
lp.cellX, lp.cellY, item.spanX, item.spanY);
|
lp.getCellX(), lp.getCellY(), item.spanX, item.spanY);
|
||||||
} else {
|
} else {
|
||||||
if (!returnToOriginalCellToPreventShuffling) {
|
if (!returnToOriginalCellToPreventShuffling) {
|
||||||
onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId);
|
onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId);
|
||||||
@@ -2035,8 +2039,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
|
|
||||||
// If we can't find a drop location, we return the item to its original position
|
// If we can't find a drop location, we return the item to its original position
|
||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
||||||
mTargetCell[0] = lp.cellX;
|
mTargetCell[0] = lp.getCellX();
|
||||||
mTargetCell[1] = lp.cellY;
|
mTargetCell[1] = lp.getCellY();
|
||||||
CellLayout layout = (CellLayout) cell.getParent().getParent();
|
CellLayout layout = (CellLayout) cell.getParent().getParent();
|
||||||
layout.markCellsAsOccupiedForView(cell);
|
layout.markCellsAsOccupiedForView(cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ public interface WorkspaceLayoutManager {
|
|||||||
lp = new CellLayoutLayoutParams(x, y, spanX, spanY, screenId);
|
lp = new CellLayoutLayoutParams(x, y, spanX, spanY, screenId);
|
||||||
} else {
|
} else {
|
||||||
lp = (CellLayoutLayoutParams) genericLp;
|
lp = (CellLayoutLayoutParams) genericLp;
|
||||||
lp.cellX = x;
|
lp.setCellX(x);
|
||||||
lp.cellY = y;
|
lp.setCellY(y);
|
||||||
lp.cellHSpan = spanX;
|
lp.cellHSpan = spanX;
|
||||||
lp.cellVSpan = spanY;
|
lp.cellVSpan = spanY;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,8 @@ public interface WorkspaceLayoutManager {
|
|||||||
// TODO: This branch occurs when the workspace is adding views
|
// TODO: This branch occurs when the workspace is adding views
|
||||||
// outside of the defined grid
|
// outside of the defined grid
|
||||||
// maybe we should be deleting these items from the LauncherModel?
|
// maybe we should be deleting these items from the LauncherModel?
|
||||||
Log.e(TAG, "Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout");
|
Log.e(TAG, "Failed to add to item at (" + lp.getCellX() + "," + lp.getCellY()
|
||||||
|
+ ") to CellLayout");
|
||||||
}
|
}
|
||||||
|
|
||||||
child.setHapticFeedbackEnabled(false);
|
child.setHapticFeedbackEnabled(false);
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
|
|||||||
if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
|
if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
|
||||||
&& layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
|
&& layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
|
||||||
|| !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
|
|| !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
|
||||||
lp.cellX --;
|
lp.setCellX(lp.getCellX() - 1);
|
||||||
info.cellX --;
|
info.cellX --;
|
||||||
}
|
}
|
||||||
lp.cellHSpan ++;
|
lp.cellHSpan ++;
|
||||||
@@ -269,7 +269,7 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
|
|||||||
info.spanX --;
|
info.spanX --;
|
||||||
} else if (action == R.string.action_increase_height) {
|
} else if (action == R.string.action_increase_height) {
|
||||||
if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
|
if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
|
||||||
lp.cellY --;
|
lp.setCellY(lp.getCellY() - 1);
|
||||||
info.cellY --;
|
info.cellY --;
|
||||||
}
|
}
|
||||||
lp.cellVSpan ++;
|
lp.cellVSpan ++;
|
||||||
|
|||||||
@@ -29,29 +29,17 @@ import androidx.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
||||||
|
|
||||||
public int screenId = -1;
|
private int mScreenId = -1;
|
||||||
|
|
||||||
/**
|
|
||||||
* Horizontal location of the item in the grid.
|
|
||||||
*/
|
|
||||||
@ViewDebug.ExportedProperty
|
@ViewDebug.ExportedProperty
|
||||||
public int cellX;
|
private int mCellX;
|
||||||
|
|
||||||
/**
|
|
||||||
* Vertical location of the item in the grid.
|
|
||||||
*/
|
|
||||||
@ViewDebug.ExportedProperty
|
@ViewDebug.ExportedProperty
|
||||||
public int cellY;
|
private int mCellY;
|
||||||
|
|
||||||
/**
|
private int mTmpCellX;
|
||||||
* Temporary horizontal location of the item in the grid during reorder
|
|
||||||
*/
|
|
||||||
public int tmpCellX;
|
|
||||||
|
|
||||||
/**
|
private int mTmpCellY;
|
||||||
* Temporary vertical location of the item in the grid during reorder
|
|
||||||
*/
|
|
||||||
public int tmpCellY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the temporary coordinates should be used to layout the items
|
* Indicates that the temporary coordinates should be used to layout the items
|
||||||
@@ -105,24 +93,24 @@ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
|||||||
|
|
||||||
public CellLayoutLayoutParams(CellLayoutLayoutParams source) {
|
public CellLayoutLayoutParams(CellLayoutLayoutParams source) {
|
||||||
super(source);
|
super(source);
|
||||||
this.cellX = source.cellX;
|
this.mCellX = source.getCellX();
|
||||||
this.cellY = source.cellY;
|
this.mCellY = source.getCellY();
|
||||||
this.cellHSpan = source.cellHSpan;
|
this.cellHSpan = source.cellHSpan;
|
||||||
this.cellVSpan = source.cellVSpan;
|
this.cellVSpan = source.cellVSpan;
|
||||||
this.screenId = source.screenId;
|
this.mScreenId = source.getScreenId();
|
||||||
this.tmpCellX = source.tmpCellX;
|
this.mTmpCellX = source.getTmpCellX();
|
||||||
this.tmpCellY = source.tmpCellY;
|
this.mTmpCellY = source.getTmpCellY();
|
||||||
this.useTmpCoords = source.useTmpCoords;
|
this.useTmpCoords = source.useTmpCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan,
|
public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan,
|
||||||
int screenId) {
|
int screenId) {
|
||||||
super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT);
|
super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT);
|
||||||
this.cellX = cellX;
|
this.mCellX = cellX;
|
||||||
this.cellY = cellY;
|
this.mCellY = cellY;
|
||||||
this.cellHSpan = cellHSpan;
|
this.cellHSpan = cellHSpan;
|
||||||
this.cellVSpan = cellVSpan;
|
this.cellVSpan = cellVSpan;
|
||||||
this.screenId = screenId;
|
this.mScreenId = screenId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,8 +136,8 @@ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
|||||||
if (isLockedToGrid) {
|
if (isLockedToGrid) {
|
||||||
final int myCellHSpan = cellHSpan;
|
final int myCellHSpan = cellHSpan;
|
||||||
final int myCellVSpan = cellVSpan;
|
final int myCellVSpan = cellVSpan;
|
||||||
int myCellX = useTmpCoords ? tmpCellX : cellX;
|
int myCellX = useTmpCoords ? getTmpCellX() : getCellX();
|
||||||
int myCellY = useTmpCoords ? tmpCellY : cellY;
|
int myCellY = useTmpCoords ? getTmpCellY() : getCellY();
|
||||||
|
|
||||||
if (invertHorizontally) {
|
if (invertHorizontally) {
|
||||||
myCellX = colCount - myCellX - cellHSpan;
|
myCellX = colCount - myCellX - cellHSpan;
|
||||||
@@ -179,14 +167,66 @@ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
|||||||
* Sets the position to the provided point
|
* Sets the position to the provided point
|
||||||
*/
|
*/
|
||||||
public void setCellXY(Point point) {
|
public void setCellXY(Point point) {
|
||||||
cellX = point.x;
|
setCellX(point.x);
|
||||||
cellY = point.y;
|
setCellY(point.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the string representation of the position of the {@link CellLayoutLayoutParams}
|
* @return the string representation of the position of the {@link CellLayoutLayoutParams}
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "(" + this.cellX + ", " + this.cellY + ")";
|
return "(" + this.getCellX() + ", " + this.getCellY() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScreenId() {
|
||||||
|
return mScreenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenId(int screenId) {
|
||||||
|
this.mScreenId = screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Horizontal location of the item in the grid.
|
||||||
|
*/
|
||||||
|
public int getCellX() {
|
||||||
|
return mCellX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCellX(int cellX) {
|
||||||
|
this.mCellX = cellX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vertical location of the item in the grid.
|
||||||
|
*/
|
||||||
|
public int getCellY() {
|
||||||
|
return mCellY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCellY(int cellY) {
|
||||||
|
this.mCellY = cellY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary horizontal location of the item in the grid during reorder
|
||||||
|
*/
|
||||||
|
public int getTmpCellX() {
|
||||||
|
return mTmpCellX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTmpCellX(int tmpCellX) {
|
||||||
|
this.mTmpCellX = tmpCellX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary vertical location of the item in the grid during reorder
|
||||||
|
*/
|
||||||
|
public int getTmpCellY() {
|
||||||
|
return mTmpCellY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTmpCellY(int tmpCellY) {
|
||||||
|
this.mTmpCellY = tmpCellY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
|
|||||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) getLayoutParams();
|
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) getLayoutParams();
|
||||||
CellLayout cl = (CellLayout) getParent().getParent();
|
CellLayout cl = (CellLayout) getParent().getParent();
|
||||||
|
|
||||||
mBackground.animateToAccept(cl, lp.cellX, lp.cellY);
|
mBackground.animateToAccept(cl, lp.getCellX(), lp.getCellY());
|
||||||
mOpenAlarm.setOnAlarmListener(mOnOpenListener);
|
mOpenAlarm.setOnAlarmListener(mOnOpenListener);
|
||||||
if (SPRING_LOADING_ENABLED &&
|
if (SPRING_LOADING_ENABLED &&
|
||||||
((dragInfo instanceof WorkspaceItemFactory)
|
((dragInfo instanceof WorkspaceItemFactory)
|
||||||
|
|||||||
@@ -225,8 +225,8 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
|||||||
textView.setLayoutParams(new CellLayoutLayoutParams(
|
textView.setLayoutParams(new CellLayoutLayoutParams(
|
||||||
item.cellX, item.cellY, item.spanX, item.spanY, item.screenId));
|
item.cellX, item.cellY, item.spanX, item.spanY, item.screenId));
|
||||||
} else {
|
} else {
|
||||||
lp.cellX = item.cellX;
|
lp.setCellX(item.cellX);
|
||||||
lp.cellY = item.cellY;
|
lp.setCellY(item.cellY);
|
||||||
lp.cellHSpan = lp.cellVSpan = 1;
|
lp.cellHSpan = lp.cellVSpan = 1;
|
||||||
}
|
}
|
||||||
return textView;
|
return textView;
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ public class ReorderWidgets extends AbstractLauncherUiTest {
|
|||||||
(CellLayoutLayoutParams) callView.getLayoutParams();
|
(CellLayoutLayoutParams) callView.getLayoutParams();
|
||||||
// is icon
|
// is icon
|
||||||
if (callView instanceof DoubleShadowBubbleTextView) {
|
if (callView instanceof DoubleShadowBubbleTextView) {
|
||||||
board.addIcon(params.cellX, params.cellY);
|
board.addIcon(params.getCellX(), params.getCellY());
|
||||||
} else {
|
} else {
|
||||||
// is widget
|
// is widget
|
||||||
board.addWidget(params.cellX, params.cellY, params.cellHSpan,
|
board.addWidget(params.getCellX(), params.getCellY(), params.cellHSpan,
|
||||||
params.cellVSpan, (char) ('A' + widgetCount));
|
params.cellVSpan, (char) ('A' + widgetCount));
|
||||||
widgetCount++;
|
widgetCount++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user