Merge "Moving the class LayoutParams to a file outside CellLayout" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
73b8ee9390
@@ -38,6 +38,7 @@ import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
@@ -192,7 +193,7 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
icon.setEnabled(false);
|
||||
icon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
icon.verifyHighRes();
|
||||
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(i, 0, 1, 1);
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1);
|
||||
mSampleHotseat.addViewToCellLayout(icon, i, info.getViewId(), lp, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
@@ -271,7 +272,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
mIsPinned = true;
|
||||
applyFromWorkspaceItem(info);
|
||||
setOnLongClickListener(ItemLongClickListener.INSTANCE_WORKSPACE);
|
||||
((CellLayout.LayoutParams) getLayoutParams()).canReorder = true;
|
||||
((CellLayoutLayoutParams) getLayoutParams()).canReorder = true;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@@ -280,7 +281,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
*/
|
||||
public void finishBinding(OnLongClickListener longClickListener) {
|
||||
setOnLongClickListener(longClickListener);
|
||||
((CellLayout.LayoutParams) getLayoutParams()).canReorder = false;
|
||||
((CellLayoutLayoutParams) getLayoutParams()).canReorder = false;
|
||||
setTextVisibility(false);
|
||||
verifyHighRes();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.SpringAnimationBuilder;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
@@ -122,8 +123,7 @@ public class StaggeredWorkspaceAnim {
|
||||
if (grid.isVerticalBarLayout()) {
|
||||
for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) {
|
||||
View child = hotseatIcons.getChildAt(i);
|
||||
CellLayout.LayoutParams lp =
|
||||
((CellLayout.LayoutParams) child.getLayoutParams());
|
||||
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
||||
addStaggeredAnimationForView(child, lp.cellY + 1, totalRows, duration);
|
||||
}
|
||||
} else {
|
||||
@@ -193,7 +193,7 @@ public class StaggeredWorkspaceAnim {
|
||||
// Set up springs on workspace items.
|
||||
for (int i = itemsContainer.getChildCount() - 1; i >= 0; i--) {
|
||||
View child = itemsContainer.getChildAt(i);
|
||||
CellLayout.LayoutParams lp = ((CellLayout.LayoutParams) child.getLayoutParams());
|
||||
CellLayoutLayoutParams lp = ((CellLayoutLayoutParams) child.getLayoutParams());
|
||||
addStaggeredAnimationForView(child, lp.cellY + lp.cellVSpan, totalRows, duration);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.Px;
|
||||
|
||||
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
@@ -265,7 +266,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
}
|
||||
}
|
||||
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) mWidgetView.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mWidgetView.getLayoutParams();
|
||||
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
|
||||
lp.cellX = lp.tmpCellX = widgetInfo.cellX;
|
||||
lp.cellY = lp.tmpCellY = widgetInfo.cellY;
|
||||
@@ -405,7 +406,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
*/
|
||||
private void resizeWidgetIfNeeded(boolean onDismiss) {
|
||||
ViewGroup.LayoutParams wlp = mWidgetView.getLayoutParams();
|
||||
if (!(wlp instanceof CellLayout.LayoutParams)) {
|
||||
if (!(wlp instanceof CellLayoutLayoutParams)) {
|
||||
return;
|
||||
}
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
@@ -420,7 +421,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
mDirectionVector[0] = 0;
|
||||
mDirectionVector[1] = 0;
|
||||
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) wlp;
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) wlp;
|
||||
|
||||
int spanX = lp.cellHSpan;
|
||||
int spanY = lp.cellVSpan;
|
||||
|
||||
@@ -61,6 +61,7 @@ import androidx.core.view.ViewCompat;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.DraggableView;
|
||||
import com.android.launcher3.folder.PreviewBackground;
|
||||
@@ -130,7 +131,7 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
// These arrays are used to implement the drag visualization on x-large screens.
|
||||
// They are used as circular arrays, indexed by mDragOutlineCurrent.
|
||||
@Thunk final CellLayout.LayoutParams[] mDragOutlines = new CellLayout.LayoutParams[4];
|
||||
@Thunk final CellLayoutLayoutParams[] mDragOutlines = new CellLayoutLayoutParams[4];
|
||||
@Thunk final float[] mDragOutlineAlphas = new float[mDragOutlines.length];
|
||||
private final InterruptibleInOutAnimator[] mDragOutlineAnims =
|
||||
new InterruptibleInOutAnimator[mDragOutlines.length];
|
||||
@@ -139,7 +140,7 @@ public class CellLayout extends ViewGroup {
|
||||
private int mDragOutlineCurrent = 0;
|
||||
private final Paint mDragOutlinePaint = new Paint();
|
||||
|
||||
@Thunk final ArrayMap<LayoutParams, Animator> mReorderAnimators = new ArrayMap<>();
|
||||
@Thunk final ArrayMap<CellLayoutLayoutParams, Animator> mReorderAnimators = new ArrayMap<>();
|
||||
@Thunk final ArrayMap<Reorderable, ReorderPreviewAnimation> mShakeAnimators = new ArrayMap<>();
|
||||
|
||||
private boolean mItemPlacementDirty = false;
|
||||
@@ -269,7 +270,7 @@ public class CellLayout extends ViewGroup {
|
||||
mDragCell[0] = mDragCell[1] = -1;
|
||||
mDragCellSpan[0] = mDragCellSpan[1] = -1;
|
||||
for (int i = 0; i < mDragOutlines.length; i++) {
|
||||
mDragOutlines[i] = new CellLayout.LayoutParams(0, 0, 0, 0);
|
||||
mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0);
|
||||
}
|
||||
mDragOutlinePaint.setColor(Themes.getAttrColor(context, R.attr.workspaceTextColor));
|
||||
|
||||
@@ -737,9 +738,19 @@ public class CellLayout extends ViewGroup {
|
||||
return mContainerType == WORKSPACE;
|
||||
}
|
||||
|
||||
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
|
||||
boolean markCells) {
|
||||
final LayoutParams lp = params;
|
||||
/**
|
||||
* Adds the given view to the CellLayout
|
||||
*
|
||||
* @param child view to add.
|
||||
* @param index index of the CellLayout children where to add the view.
|
||||
* @param childId id of the view.
|
||||
* @param params represent the logic of the view on the CellLayout.
|
||||
* @param markCells if the occupied cells should be marked or not
|
||||
* @return if adding the view was successful
|
||||
*/
|
||||
public boolean addViewToCellLayout(View child, int index, int childId,
|
||||
CellLayoutLayoutParams params, boolean markCells) {
|
||||
final CellLayoutLayoutParams lp = params;
|
||||
|
||||
// Hotseat icons - remove text
|
||||
if (child instanceof BubbleTextView) {
|
||||
@@ -1046,7 +1057,7 @@ public class CellLayout extends ViewGroup {
|
||||
ShortcutAndWidgetContainer clc = getShortcutsAndWidgets();
|
||||
|
||||
if (clc.indexOfChild(child) != -1 && (child instanceof Reorderable)) {
|
||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
final CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
final ItemInfo info = (ItemInfo) child.getTag();
|
||||
final Reorderable item = (Reorderable) child;
|
||||
|
||||
@@ -1153,7 +1164,7 @@ public class CellLayout extends ViewGroup {
|
||||
mDragOutlineAnims[oldIndex].animateOut();
|
||||
mDragOutlineCurrent = (oldIndex + 1) % mDragOutlines.length;
|
||||
|
||||
LayoutParams cell = mDragOutlines[mDragOutlineCurrent];
|
||||
CellLayoutLayoutParams cell = mDragOutlines[mDragOutlineCurrent];
|
||||
cell.cellX = cellX;
|
||||
cell.cellY = cellY;
|
||||
cell.cellHSpan = spanX;
|
||||
@@ -1708,7 +1719,7 @@ public class CellLayout extends ViewGroup {
|
||||
// cluster.
|
||||
if (!cluster.views.contains(v) && v != dragView) {
|
||||
if (cluster.isViewTouchingEdge(v, whichEdge)) {
|
||||
LayoutParams lp = (LayoutParams) v.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) v.getLayoutParams();
|
||||
if (!lp.canReorder) {
|
||||
// The push solution includes the all apps button, this is not viable.
|
||||
fail = true;
|
||||
@@ -1919,7 +1930,7 @@ public class CellLayout extends ViewGroup {
|
||||
for (View child: solution.map.keySet()) {
|
||||
if (child == ignoreView) continue;
|
||||
CellAndSpan c = solution.map.get(child);
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
r1.set(c.cellX, c.cellY, c.cellX + c.spanX, c.cellY + c.spanY);
|
||||
if (Rect.intersects(r0, r1)) {
|
||||
if (!lp.canReorder) {
|
||||
@@ -2016,7 +2027,7 @@ public class CellLayout extends ViewGroup {
|
||||
int childCount = mShortcutsAndWidgets.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
CellAndSpan c;
|
||||
if (temp) {
|
||||
c = new CellAndSpan(lp.tmpCellX, lp.tmpCellY, lp.cellHSpan, lp.cellVSpan);
|
||||
@@ -2034,7 +2045,7 @@ public class CellLayout extends ViewGroup {
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||
if (child == dragView) continue;
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
CellAndSpan c = solution.map.get(child);
|
||||
if (c != null) {
|
||||
lp.tmpCellX = c.cellX;
|
||||
@@ -2082,7 +2093,7 @@ public class CellLayout extends ViewGroup {
|
||||
!= null && !solution.intersectingViews.contains(child);
|
||||
|
||||
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
if (c != null && !skip && (child instanceof Reorderable)) {
|
||||
ReorderPreviewAnimation rha = new ReorderPreviewAnimation((Reorderable) child,
|
||||
mode, lp.cellX, lp.cellY, c.cellX, c.cellY, c.spanX, c.spanY);
|
||||
@@ -2273,7 +2284,7 @@ public class CellLayout extends ViewGroup {
|
||||
int childCount = mShortcutsAndWidgets.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
ItemInfo info = (ItemInfo) child.getTag();
|
||||
// We do a null check here because the item info can be null in the case of the
|
||||
// AllApps button in the hotseat.
|
||||
@@ -2298,7 +2309,8 @@ public class CellLayout extends ViewGroup {
|
||||
private void setUseTempCoords(boolean useTempCoords) {
|
||||
int childCount = mShortcutsAndWidgets.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
LayoutParams lp = (LayoutParams) mShortcutsAndWidgets.getChildAt(i).getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mShortcutsAndWidgets.getChildAt(
|
||||
i).getLayoutParams();
|
||||
lp.useTmpCoords = useTempCoords;
|
||||
}
|
||||
}
|
||||
@@ -2383,7 +2395,8 @@ public class CellLayout extends ViewGroup {
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||
if (child == dragView) continue;
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
r1.set(lp.cellX, lp.cellY, lp.cellX + lp.cellHSpan, lp.cellY + lp.cellVSpan);
|
||||
if (Rect.intersects(r0, r1)) {
|
||||
mIntersectingViews.add(child);
|
||||
@@ -2408,7 +2421,8 @@ public class CellLayout extends ViewGroup {
|
||||
final int count = mShortcutsAndWidgets.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = mShortcutsAndWidgets.getChildAt(i);
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
if (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY) {
|
||||
lp.tmpCellX = lp.cellX;
|
||||
lp.tmpCellY = lp.cellY;
|
||||
@@ -2685,7 +2699,8 @@ public class CellLayout extends ViewGroup {
|
||||
*/
|
||||
void onDropChild(View child) {
|
||||
if (child != null) {
|
||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
lp.dropped = true;
|
||||
child.requestLayout();
|
||||
markCellsAsOccupiedForView(child);
|
||||
@@ -2727,7 +2742,8 @@ public class CellLayout extends ViewGroup {
|
||||
return;
|
||||
}
|
||||
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
||||
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
||||
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, true);
|
||||
}
|
||||
|
||||
@@ -2739,7 +2755,8 @@ public class CellLayout extends ViewGroup {
|
||||
return;
|
||||
}
|
||||
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
|
||||
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
||||
CellLayoutLayoutParams
|
||||
lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
||||
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, false);
|
||||
}
|
||||
|
||||
@@ -2763,165 +2780,17 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new CellLayout.LayoutParams(getContext(), attrs);
|
||||
return new CellLayoutLayoutParams(getContext(), attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p instanceof CellLayout.LayoutParams;
|
||||
return p instanceof CellLayoutLayoutParams;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return new CellLayout.LayoutParams(p);
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
/**
|
||||
* Horizontal location of the item in the grid.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellX;
|
||||
|
||||
/**
|
||||
* Vertical location of the item in the grid.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellY;
|
||||
|
||||
/**
|
||||
* Temporary horizontal location of the item in the grid during reorder
|
||||
*/
|
||||
public int tmpCellX;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean useTmpCoords;
|
||||
|
||||
/**
|
||||
* Number of cells spanned horizontally by the item.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellHSpan;
|
||||
|
||||
/**
|
||||
* Number of cells spanned vertically by the item.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellVSpan;
|
||||
|
||||
/**
|
||||
* Indicates whether the item will set its x, y, width and height parameters freely,
|
||||
* or whether these will be computed based on cellX, cellY, cellHSpan and cellVSpan.
|
||||
*/
|
||||
public boolean isLockedToGrid = true;
|
||||
|
||||
/**
|
||||
* Indicates whether this item can be reordered. Always true except in the case of the
|
||||
* the AllApps button and QSB place holder.
|
||||
*/
|
||||
public boolean canReorder = true;
|
||||
|
||||
// X coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
public int x;
|
||||
// Y coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
public int y;
|
||||
|
||||
boolean dropped;
|
||||
|
||||
public LayoutParams(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
cellHSpan = 1;
|
||||
cellVSpan = 1;
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams source) {
|
||||
super(source);
|
||||
cellHSpan = 1;
|
||||
cellVSpan = 1;
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams source) {
|
||||
super(source);
|
||||
this.cellX = source.cellX;
|
||||
this.cellY = source.cellY;
|
||||
this.cellHSpan = source.cellHSpan;
|
||||
this.cellVSpan = source.cellVSpan;
|
||||
}
|
||||
|
||||
public LayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) {
|
||||
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
||||
this.cellX = cellX;
|
||||
this.cellY = cellY;
|
||||
this.cellHSpan = cellHSpan;
|
||||
this.cellVSpan = cellVSpan;
|
||||
}
|
||||
|
||||
public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount,
|
||||
int rowCount, Point borderSpace, @Nullable Rect inset) {
|
||||
setup(cellWidth, cellHeight, invertHorizontally, colCount, rowCount, 1.0f, 1.0f,
|
||||
borderSpace, inset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method, as opposed to {@link #setup(int, int, boolean, int, int, Point, Rect)},
|
||||
* if the view needs to be scaled.
|
||||
*
|
||||
* ie. In multi-window mode, we setup widgets so that they are measured and laid out
|
||||
* using their full/invariant device profile sizes.
|
||||
*/
|
||||
public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount,
|
||||
int rowCount, float cellScaleX, float cellScaleY, Point borderSpace,
|
||||
@Nullable Rect inset) {
|
||||
if (isLockedToGrid) {
|
||||
final int myCellHSpan = cellHSpan;
|
||||
final int myCellVSpan = cellVSpan;
|
||||
int myCellX = useTmpCoords ? tmpCellX : cellX;
|
||||
int myCellY = useTmpCoords ? tmpCellY : cellY;
|
||||
|
||||
if (invertHorizontally) {
|
||||
myCellX = colCount - myCellX - cellHSpan;
|
||||
}
|
||||
|
||||
int hBorderSpacing = (myCellHSpan - 1) * borderSpace.x;
|
||||
int vBorderSpacing = (myCellVSpan - 1) * borderSpace.y;
|
||||
|
||||
float myCellWidth = ((myCellHSpan * cellWidth) + hBorderSpacing) / cellScaleX;
|
||||
float myCellHeight = ((myCellVSpan * cellHeight) + vBorderSpacing) / cellScaleY;
|
||||
|
||||
width = Math.round(myCellWidth) - leftMargin - rightMargin;
|
||||
height = Math.round(myCellHeight) - topMargin - bottomMargin;
|
||||
x = leftMargin + (myCellX * cellWidth) + (myCellX * borderSpace.x);
|
||||
y = topMargin + (myCellY * cellHeight) + (myCellY * borderSpace.y);
|
||||
|
||||
if (inset != null) {
|
||||
x -= inset.left;
|
||||
y -= inset.top;
|
||||
width += inset.left + inset.right;
|
||||
height += inset.top + inset.bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position to the provided point
|
||||
*/
|
||||
public void setCellXY(Point point) {
|
||||
cellX = point.x;
|
||||
cellY = point.y;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "(" + this.cellX + ", " + this.cellY + ")";
|
||||
}
|
||||
return new CellLayoutLayoutParams(p);
|
||||
}
|
||||
|
||||
// This class stores info for two purposes:
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.launcher3.CellLayout.ContainerType;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
@@ -80,7 +81,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
final int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = getChildAt(i);
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
|
||||
if ((lp.cellX <= cellX) && (cellX < lp.cellX + lp.cellHSpan)
|
||||
&& (lp.cellY <= cellY) && (cellY < lp.cellY + lp.cellVSpan)) {
|
||||
@@ -107,7 +108,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
}
|
||||
|
||||
public void setupLp(View child) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
if (child instanceof NavigableAppWidgetHostView) {
|
||||
DeviceProfile profile = mActivity.getDeviceProfile();
|
||||
((NavigableAppWidgetHostView) child).getWidgetInset(profile, mTempRect);
|
||||
@@ -131,7 +132,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
}
|
||||
|
||||
public void measureChild(View child) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
final DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
|
||||
if (child instanceof NavigableAppWidgetHostView) {
|
||||
@@ -175,7 +176,6 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
layoutChild(child);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
* Core logic to layout a child for this ViewGroup.
|
||||
*/
|
||||
public void layoutChild(View child) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
if (child instanceof NavigableAppWidgetHostView) {
|
||||
NavigableAppWidgetHostView nahv = (NavigableAppWidgetHostView) child;
|
||||
|
||||
@@ -255,7 +255,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
|
||||
@Override
|
||||
public void drawFolderLeaveBehindForIcon(FolderIcon child) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
// While the folder is open, the position of the icon cannot change.
|
||||
lp.canReorder = false;
|
||||
if (mContainerType == HOTSEAT) {
|
||||
@@ -266,7 +266,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
||||
|
||||
@Override
|
||||
public void clearFolderLeaveBehind(FolderIcon child) {
|
||||
((CellLayout.LayoutParams) child.getLayoutParams()).canReorder = true;
|
||||
((CellLayoutLayoutParams) child.getLayoutParams()).canReorder = true;
|
||||
if (mContainerType == HOTSEAT) {
|
||||
CellLayout cl = (CellLayout) getParent();
|
||||
cl.clearFolderLeaveBehind();
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
|
||||
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dot.FolderDotInfo;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
@@ -562,7 +563,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
|
||||
int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;
|
||||
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, cellHSpan, 1);
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1);
|
||||
lp.canReorder = false;
|
||||
if (!firstPage.addViewToCellLayout(mQsb, 0, R.id.search_container_workspace, lp, true)) {
|
||||
Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
|
||||
@@ -1805,7 +1806,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
boolean willCreateUserFolder(ItemInfo info, View dropOverView, boolean considerTimeout) {
|
||||
if (dropOverView != null) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) dropOverView.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
||||
if (lp.useTmpCoords && (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1840,7 +1841,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
boolean willAddToExistingUserFolder(ItemInfo dragInfo, View dropOverView) {
|
||||
if (dropOverView != null) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) dropOverView.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) dropOverView.getLayoutParams();
|
||||
if (lp.useTmpCoords && (lp.tmpCellX != lp.cellX || lp.tmpCellY != lp.cellY)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2057,7 +2058,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
|
||||
// update the item's position after drop
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
||||
lp.cellX = lp.tmpCellX = mTargetCell[0];
|
||||
lp.cellY = lp.tmpCellY = mTargetCell[1];
|
||||
lp.cellHSpan = item.spanX;
|
||||
@@ -2083,7 +2084,7 @@ 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
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) cell.getLayoutParams();
|
||||
mTargetCell[0] = lp.cellX;
|
||||
mTargetCell[1] = lp.cellY;
|
||||
CellLayout layout = (CellLayout) cell.getParent().getParent();
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
@@ -111,11 +112,11 @@ public interface WorkspaceLayoutManager {
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams genericLp = child.getLayoutParams();
|
||||
CellLayout.LayoutParams lp;
|
||||
if (genericLp == null || !(genericLp instanceof CellLayout.LayoutParams)) {
|
||||
lp = new CellLayout.LayoutParams(x, y, spanX, spanY);
|
||||
CellLayoutLayoutParams lp;
|
||||
if (genericLp == null || !(genericLp instanceof CellLayoutLayoutParams)) {
|
||||
lp = new CellLayoutLayoutParams(x, y, spanX, spanY);
|
||||
} else {
|
||||
lp = (CellLayout.LayoutParams) genericLp;
|
||||
lp = (CellLayoutLayoutParams) genericLp;
|
||||
lp.cellX = x;
|
||||
lp.cellY = y;
|
||||
lp.cellHSpan = spanX;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.PendingAddItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.dragndrop.DragOptions.PreDragCondition;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
@@ -244,7 +245,7 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
|
||||
}
|
||||
|
||||
private boolean performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) host.getLayoutParams();
|
||||
CellLayout layout = (CellLayout) host.getParent().getParent();
|
||||
layout.markCellsAsUnoccupiedForView(host);
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3.celllayout;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the logic of where a view is in a CellLayout and its size
|
||||
*/
|
||||
public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
/**
|
||||
* Horizontal location of the item in the grid.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellX;
|
||||
|
||||
/**
|
||||
* Vertical location of the item in the grid.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellY;
|
||||
|
||||
/**
|
||||
* Temporary horizontal location of the item in the grid during reorder
|
||||
*/
|
||||
public int tmpCellX;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean useTmpCoords;
|
||||
|
||||
/**
|
||||
* Number of cells spanned horizontally by the item.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellHSpan;
|
||||
|
||||
/**
|
||||
* Number of cells spanned vertically by the item.
|
||||
*/
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellVSpan;
|
||||
|
||||
/**
|
||||
* Indicates whether the item will set its x, y, width and height parameters freely,
|
||||
* or whether these will be computed based on cellX, cellY, cellHSpan and cellVSpan.
|
||||
*/
|
||||
public boolean isLockedToGrid = true;
|
||||
|
||||
/**
|
||||
* Indicates whether this item can be reordered. Always true except in the case of the
|
||||
* the AllApps button and QSB place holder.
|
||||
*/
|
||||
public boolean canReorder = true;
|
||||
|
||||
// X coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
public int x;
|
||||
// Y coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
public int y;
|
||||
|
||||
public boolean dropped;
|
||||
|
||||
public CellLayoutLayoutParams(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
cellHSpan = 1;
|
||||
cellVSpan = 1;
|
||||
}
|
||||
|
||||
public CellLayoutLayoutParams(ViewGroup.LayoutParams source) {
|
||||
super(source);
|
||||
cellHSpan = 1;
|
||||
cellVSpan = 1;
|
||||
}
|
||||
|
||||
public CellLayoutLayoutParams(CellLayoutLayoutParams source) {
|
||||
super(source);
|
||||
this.cellX = source.cellX;
|
||||
this.cellY = source.cellY;
|
||||
this.cellHSpan = source.cellHSpan;
|
||||
this.cellVSpan = source.cellVSpan;
|
||||
}
|
||||
|
||||
public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) {
|
||||
super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT);
|
||||
this.cellX = cellX;
|
||||
this.cellY = cellY;
|
||||
this.cellHSpan = cellHSpan;
|
||||
this.cellVSpan = cellVSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the {@link CellLayoutLayoutParams} with the right measures using their
|
||||
* full/invariant device profile sizes.
|
||||
*/
|
||||
public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount,
|
||||
int rowCount, Point borderSpace, @Nullable Rect inset) {
|
||||
setup(cellWidth, cellHeight, invertHorizontally, colCount, rowCount, 1.0f, 1.0f,
|
||||
borderSpace, inset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method, as opposed to {@link #setup(int, int, boolean, int, int, Point, Rect)},
|
||||
* if the view needs to be scaled.
|
||||
*
|
||||
* ie. In multi-window mode, we setup widgets so that they are measured and laid out
|
||||
* using their full/invariant device profile sizes.
|
||||
*/
|
||||
public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount,
|
||||
int rowCount, float cellScaleX, float cellScaleY, Point borderSpace,
|
||||
@Nullable Rect inset) {
|
||||
if (isLockedToGrid) {
|
||||
final int myCellHSpan = cellHSpan;
|
||||
final int myCellVSpan = cellVSpan;
|
||||
int myCellX = useTmpCoords ? tmpCellX : cellX;
|
||||
int myCellY = useTmpCoords ? tmpCellY : cellY;
|
||||
|
||||
if (invertHorizontally) {
|
||||
myCellX = colCount - myCellX - cellHSpan;
|
||||
}
|
||||
|
||||
int hBorderSpacing = (myCellHSpan - 1) * borderSpace.x;
|
||||
int vBorderSpacing = (myCellVSpan - 1) * borderSpace.y;
|
||||
|
||||
float myCellWidth = ((myCellHSpan * cellWidth) + hBorderSpacing) / cellScaleX;
|
||||
float myCellHeight = ((myCellVSpan * cellHeight) + vBorderSpacing) / cellScaleY;
|
||||
|
||||
width = Math.round(myCellWidth) - leftMargin - rightMargin;
|
||||
height = Math.round(myCellHeight) - topMargin - bottomMargin;
|
||||
x = leftMargin + (myCellX * cellWidth) + (myCellX * borderSpace.x);
|
||||
y = topMargin + (myCellY * cellHeight) + (myCellY * borderSpace.y);
|
||||
|
||||
if (inset != null) {
|
||||
x -= inset.left;
|
||||
y -= inset.top;
|
||||
width += inset.left + inset.right;
|
||||
height += inset.top + inset.bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position to the provided point
|
||||
*/
|
||||
public void setCellXY(Point point) {
|
||||
cellX = point.x;
|
||||
cellY = point.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the string representation of the position of the {@link CellLayoutLayoutParams}
|
||||
*/
|
||||
public String toString() {
|
||||
return "(" + this.cellX + ", " + this.cellY + ")";
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DropTargetBar;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
@@ -51,6 +50,7 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.SpringProperty;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.Scrim;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
@@ -237,7 +237,7 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
View anchorView) {
|
||||
|
||||
ShortcutAndWidgetContainer parentChildren = (ShortcutAndWidgetContainer) child.getParent();
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) child.getLayoutParams();
|
||||
parentChildren.measureChild(child);
|
||||
parentChildren.layoutChild(child);
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PropertyResetListener;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
@@ -342,7 +343,7 @@ public class FolderAnimationManager {
|
||||
ShortcutAndWidgetContainer cwc = mContent.getPageAt(0).getShortcutsAndWidgets();
|
||||
for (int i = 0; i < numItemsInPreview; ++i) {
|
||||
final BubbleTextView btv = itemsInPreview.get(i);
|
||||
CellLayout.LayoutParams btvLp = (CellLayout.LayoutParams) btv.getLayoutParams();
|
||||
CellLayoutLayoutParams btvLp = (CellLayoutLayoutParams) btv.getLayoutParams();
|
||||
|
||||
// Calculate the final values in the LayoutParams.
|
||||
btvLp.isLockedToGrid = true;
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.dot.FolderDotInfo;
|
||||
import com.android.launcher3.dragndrop.BaseItemDragListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
@@ -277,7 +278,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
|
||||
|
||||
public void onDragEnter(ItemInfo dragInfo) {
|
||||
if (mFolder.isDestroyed() || !willAcceptItem(dragInfo)) return;
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) getLayoutParams();
|
||||
CellLayout cl = (CellLayout) getParent().getParent();
|
||||
|
||||
mBackground.animateToAccept(cl, lp.cellX, lp.cellY);
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.android.launcher3.PagedView;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
@@ -202,7 +203,7 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
public void addViewForRank(View view, WorkspaceItemInfo item, int rank) {
|
||||
int pageNo = rank / mOrganizer.getMaxItemsPerPage();
|
||||
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) view.getLayoutParams();
|
||||
lp.setCellXY(mOrganizer.getPosForRank(rank));
|
||||
getPageAt(pageNo).addViewToCellLayout(view, -1, item.getViewId(), lp, true);
|
||||
}
|
||||
@@ -218,9 +219,9 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
textView.setOnClickListener(ItemClickHandler.INSTANCE);
|
||||
textView.setOnLongClickListener(mFolder);
|
||||
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) textView.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) textView.getLayoutParams();
|
||||
if (lp == null) {
|
||||
textView.setLayoutParams(new CellLayout.LayoutParams(
|
||||
textView.setLayoutParams(new CellLayoutLayoutParams(
|
||||
item.cellX, item.cellY, item.spanX, item.spanY));
|
||||
} else {
|
||||
lp.cellX = item.cellX;
|
||||
@@ -314,7 +315,7 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
|
||||
}
|
||||
|
||||
if (v != null) {
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
|
||||
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) v.getLayoutParams();
|
||||
ItemInfo info = (ItemInfo) v.getTag();
|
||||
lp.setCellXY(mOrganizer.getPosForRank(rank));
|
||||
currentPage.addViewToCellLayout(v, -1, info.getViewId(), lp, true);
|
||||
|
||||
@@ -72,6 +72,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.WorkspaceLayoutManager;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.icons.BaseIconFactory;
|
||||
@@ -532,8 +533,8 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);
|
||||
View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen,
|
||||
false);
|
||||
CellLayout.LayoutParams lp =
|
||||
new CellLayout.LayoutParams(0, 0, firstScreen.getCountX(), 1);
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, firstScreen.getCountX(),
|
||||
1);
|
||||
lp.canReorder = false;
|
||||
firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user