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 ...@@ -160,7 +160,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private int mDragOverY = -1; private int mDragOverY = -1;
private static final int FOLDER_CREATION_TIMEOUT = 100; 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 mFolderCreationAlarm = new Alarm();
private final Alarm mReorderAlarm = new Alarm(); private final Alarm mReorderAlarm = new Alarm();
//private FolderIcon mDragOverFolderIcon = null; //private FolderIcon mDragOverFolderIcon = null;
...@@ -263,7 +263,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V ...@@ -263,7 +263,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
mInsets.set(insets); mInsets.set(insets);
VariantDeviceProfile grid = mLauncher.getDeviceProfile(); VariantDeviceProfile grid = mLauncher.getDeviceProfile();
mMaxDistanceForFolderCreation = (0.55f * grid.getIconSizePx()); mMaxDistanceForFolderCreation = (0.35f * grid.getIconSizePx());
Rect padding = grid.getWorkspacePadding(); Rect padding = grid.getWorkspacePadding();
setPadding(padding.left, padding.top, padding.right, padding.bottom); setPadding(padding.left, padding.top, padding.right, padding.bottom);
int paddingLeftRight = grid.getCellLayoutPaddingLeftRightPx(); int paddingLeftRight = grid.getCellLayoutPaddingLeftRightPx();
......
...@@ -15,6 +15,7 @@ import android.os.Handler ...@@ -15,6 +15,7 @@ import android.os.Handler
import android.os.Looper import android.os.Looper
import android.util.ArrayMap import android.util.ArrayMap
import android.util.AttributeSet import android.util.AttributeSet
import android.view.Gravity
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
...@@ -813,19 +814,26 @@ open class CellLayout @JvmOverloads constructor( ...@@ -813,19 +814,26 @@ open class CellLayout @JvmOverloads constructor(
result[1] = index / mCountX result[1] = index / mCountX
} }
// appView.findViewById(R.id.app_label).setVisibility(GONE); val genericLp: ViewGroup.LayoutParams = dragView.layoutParams
val rowSpec = spec(UNDEFINED) val rowSpec = spec(UNDEFINED)
val colSpec = spec(UNDEFINED) val colSpec = spec(UNDEFINED)
val iconLayoutParams = LayoutParams(rowSpec, colSpec) val lp: LayoutParams
// iconLayoutParams.setGravity(Gravity.CENTER) if (genericLp !is LayoutParams) {
iconLayoutParams.height = if (mContainerType == HOTSEAT) lp = LayoutParams(rowSpec, colSpec)
dp.hotseatCellHeightPx else dp.cellHeightPx } else {
iconLayoutParams.width = dp.cellWidthPx lp = genericLp
dragView.also { lp.rowSpec = rowSpec
if (it is IconTextView) it.setTextVisibility(mContainerType != HOTSEAT) 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)
} }
dragView.layoutParams = iconLayoutParams addViewToCellLayout(dragView, index, childId, lp, true)
addView(dragView, index)
// Update item info after reordering so that we always save correct state in database. // Update item info after reordering so that we always save correct state in database.
// TODO: May optimize this // 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