File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
library/src/main/java/com/jmedeisis/draglinearlayout Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ public interface OnViewSwapListener {
61
61
62
62
private OnViewSwapListener swapListener ;
63
63
64
+ private LayoutTransition layoutTransition ;
65
+
64
66
/**
65
67
* Mapping from child index to drag-related info container.
66
68
* Presence of mapping implies the child can be dragged, and is considered for swaps with the
@@ -357,6 +359,13 @@ private void startDetectingDrag(View child) {
357
359
}
358
360
359
361
private void startDrag () {
362
+ // remove layout transition, it conflicts with drag animation
363
+ // we will restore it after drag animation end, see stopDrag()
364
+ layoutTransition = getLayoutTransition ();
365
+ if (layoutTransition != null ) {
366
+ setLayoutTransition (null );
367
+ }
368
+
360
369
draggedItem .onDragStart ();
361
370
requestDisallowInterceptTouchEvent (true );
362
371
}
@@ -398,6 +407,11 @@ public void onAnimationEnd(Animator animation) {
398
407
399
408
if (null != dragTopShadowDrawable ) dragTopShadowDrawable .setAlpha (255 );
400
409
dragBottomShadowDrawable .setAlpha (255 );
410
+
411
+ // restore layout transition
412
+ if (layoutTransition != null && getLayoutTransition () == null ) {
413
+ setLayoutTransition (layoutTransition );
414
+ }
401
415
}
402
416
});
403
417
draggedItem .settleAnimation .start ();
You can’t perform that action at this time.
0 commit comments