Commit 99721bf8 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Use correct layout params when performing reorder

parent fef13c09
Pipeline #144697 passed with stage
in 2 minutes and 37 seconds
......@@ -160,7 +160,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private int mDragOverY = -1;
private static final int FOLDER_CREATION_TIMEOUT = 100;
public static final int REORDER_TIMEOUT = 650;
public static final int REORDER_TIMEOUT = 350;
private final Alarm mFolderCreationAlarm = new Alarm();
private final Alarm mReorderAlarm = new Alarm();
//private FolderIcon mDragOverFolderIcon = null;
......@@ -263,7 +263,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
mInsets.set(insets);
VariantDeviceProfile grid = mLauncher.getDeviceProfile();
mMaxDistanceForFolderCreation = (0.55f * grid.getIconSizePx());
mMaxDistanceForFolderCreation = (0.35f * grid.getIconSizePx());
Rect padding = grid.getWorkspacePadding();
setPadding(padding.left, padding.top, padding.right, padding.bottom);
int paddingLeftRight = grid.getCellLayoutPaddingLeftRightPx();
......
......@@ -15,6 +15,7 @@ import android.os.Handler
import android.os.Looper
import android.util.ArrayMap
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
......@@ -813,19 +814,26 @@ open class CellLayout @JvmOverloads constructor(
result[1] = index / mCountX
}
// appView.findViewById(R.id.app_label).setVisibility(GONE);
val genericLp: ViewGroup.LayoutParams = dragView.layoutParams
val rowSpec = spec(UNDEFINED)
val colSpec = spec(UNDEFINED)
val iconLayoutParams = LayoutParams(rowSpec, colSpec)
// iconLayoutParams.setGravity(Gravity.CENTER)
iconLayoutParams.height = if (mContainerType == HOTSEAT)
dp.hotseatCellHeightPx else dp.cellHeightPx
iconLayoutParams.width = dp.cellWidthPx
dragView.also {
if (it is IconTextView) it.setTextVisibility(mContainerType != HOTSEAT)
}
dragView.layoutParams = iconLayoutParams
addView(dragView, index)
val lp: LayoutParams
if (genericLp !is LayoutParams) {
lp = LayoutParams(rowSpec, colSpec)
} else {
lp = genericLp
lp.rowSpec = rowSpec
lp.columnSpec = colSpec
}
lp.setGravity(Gravity.CENTER)
// Get the canonical child id to uniquely represent this view in this screen
val childId: Int = launcher.getViewIdForItem(dragView.tag as LauncherItem)
dragView.apply {
if (this is IconTextView) setTextVisibility(mContainerType != HOTSEAT)
}
addViewToCellLayout(dragView, index, childId, lp, true)
// Update item info after reordering so that we always save correct state in database.
// TODO: May optimize this
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment