From 34a31064b2c0f5c2767eadecb79b022eeaed14e3 Mon Sep 17 00:00:00 2001 From: Jung Kai Date: Mon, 25 Nov 2013 12:30:04 +0900 Subject: [PATCH] fix the bug of list item height changing. When each list item height is different, list item height is suddenly changed after perform dismiss. (issue is easily found with the list view which has different item height) --- .../java/de/timroes/android/listview/EnhancedListView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/EnhancedListView/src/main/java/de/timroes/android/listview/EnhancedListView.java b/EnhancedListView/src/main/java/de/timroes/android/listview/EnhancedListView.java index 69e566d..5013ac1 100644 --- a/EnhancedListView/src/main/java/de/timroes/android/listview/EnhancedListView.java +++ b/EnhancedListView/src/main/java/de/timroes/android/listview/EnhancedListView.java @@ -748,6 +748,11 @@ private void performDismiss(final View dismissView, final View listItemView, fin final ViewGroup.LayoutParams lp = listItemView.getLayoutParams(); final int originalHeight = listItemView.getHeight(); + int nextChildPositionOffset = getHeaderViewsCount() + 1; + View childView = getChildAt(dismissPosition + nextChildPositionOffset - getFirstVisiblePosition()); + + final int nextChildItemHeight = (childView != null) ? childView.getMeasuredHeight(): 0; + ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime); animator.addListener(new AnimatorListenerAdapter() { @@ -802,7 +807,7 @@ public void onAnimationEnd(Animator animation) { ViewHelper.setAlpha(pendingDismiss.view, 1f); ViewHelper.setTranslationX(pendingDismiss.view, 0); lp = pendingDismiss.childView.getLayoutParams(); - lp.height = originalHeight; + lp.height = nextChildItemHeight; pendingDismiss.childView.setLayoutParams(lp); }