Fix cast exception when dropping widgets to a drop target

When inflating a widget directly in the DragView, I've overridden
the layout param to FrameLayout.LayoutParam. Before drag complete,
we should restore the previous layout param.

Test: Drag a widget to a drop target. No crash is observed.
Bug: 186111130
Change-Id: Ifd33d57a886496ab31d4e741870b0ae18ca9ce4e
This commit is contained in:
Steven Ng
2021-04-22 17:44:22 +01:00
parent 8e64bba9cf
commit cf93ef6cc9

View File

@@ -240,6 +240,7 @@ public abstract class ButtonDropTarget extends TextView
final Rect to = getIconRect(d);
final float scale = (float) to.width() / from.width();
d.dragView.detachContentView(/* reattachToPreviousParent= */ true);
mDropTargetBar.deferOnDragEnd();
Runnable onAnimationEndRunnable = () -> {