Moving the class LayoutParams to a file outside CellLayout

I'm moving the LayoutParams to another file to start the decoupling
of the Reorder outside of the CellLayout.

Also, I change the name from LayoutParams to LauncherLayoutParams to prevent confusion with ViewGroup.LayoutParams making it explicit that this are different LayoutParams.

Bug: 188081026
Test: atest ReorderWidget
Change-Id: I92251c5540ffcf5ece7b933e6f6c836eb825c997
This commit is contained in:
Sebastian Franco
2022-10-05 13:03:09 -05:00
committed by Sebastián Franco
parent b759de4769
commit d468299c0f
15 changed files with 269 additions and 207 deletions

View File

@@ -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();