diff options
author | Danesh Mondegarian <daneshm90@gmail.com> | 2015-04-04 19:05:28 -0700 |
---|---|---|
committer | Danesh Mondegarian <daneshm90@gmail.com> | 2015-04-05 12:10:11 -0700 |
commit | 4925832e64c8e5f258ff57d39e8ab80a6cdf79cc (patch) | |
tree | ac9bf5672b8a014828e3208f560938d49a569f2c | |
parent | f50e944937e99e55588e8ab38baaeff4c8092413 (diff) | |
download | android_external_cyanogen_UICommon-4925832e64c8e5f258ff57d39e8ab80a6cdf79cc.tar.gz android_external_cyanogen_UICommon-4925832e64c8e5f258ff57d39e8ab80a6cdf79cc.tar.bz2 android_external_cyanogen_UICommon-4925832e64c8e5f258ff57d39e8ab80a6cdf79cc.zip |
Revert "Revert "UiCommon : Change to id instead of position""
This reverts commit f50e944937e99e55588e8ab38baaeff4c8092413.
Change-Id: I3e574e41668d1944000a23b5488b9e23271c15c6
-rw-r--r-- | src/com/cyngn/uicommon/view/ExpandingCard.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/com/cyngn/uicommon/view/ExpandingCard.java b/src/com/cyngn/uicommon/view/ExpandingCard.java index 1531166..f1e0d56 100644 --- a/src/com/cyngn/uicommon/view/ExpandingCard.java +++ b/src/com/cyngn/uicommon/view/ExpandingCard.java @@ -3,7 +3,6 @@ package com.cyngn.uicommon.view; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; -import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; @@ -362,7 +361,7 @@ public class ExpandingCard extends FrameLayout { * handler to manage expanding/collpasing. */ public static class ExpandingCardManager { - private int mSelectedPosition = -1; + private long mSelectedCardId = -1; private ExpandingCard mSelectedCard; private ListView mList; @@ -375,22 +374,22 @@ public class ExpandingCard extends FrameLayout { * in the list * * @param card - * @param position + * @param cardId */ - public void onBindExpandingCard(final ExpandingCard card, final int position) { + public void onBindExpandingCard(final ExpandingCard card, final long cardId) { card.reset(); card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (position == mSelectedPosition) { + if (cardId == mSelectedCardId) { card.collapse(); - mSelectedPosition = -1; + mSelectedCardId = -1; mSelectedCard = null; } else { // when the selection is moved from one card to another, we want the // newly selected card to expand into the space left by the collpasing // one. - if (mSelectedPosition >= 0 && position > mSelectedPosition) { + if (mSelectedCardId >= 0 && cardId > mSelectedCardId) { card.expand(AnimationType.ANCHOR_BOTTOM); } else { card.expand(AnimationType.ANCHOR_TOP); @@ -399,18 +398,18 @@ public class ExpandingCard extends FrameLayout { // If the currently selected card is in view, animate it closing. // We're assuming that our reference to the selected card view is still // valid is long as it is visible. - if (mSelectedPosition >= mList.getFirstVisiblePosition() && - mSelectedPosition <= mList.getLastVisiblePosition() && + if (mSelectedCardId >= mList.getFirstVisiblePosition() && + mSelectedCardId <= mList.getLastVisiblePosition() && mSelectedCard != null) { mSelectedCard.collapse(); } - mSelectedPosition = position; + mSelectedCardId = cardId; mSelectedCard = card; } } }); - if (position == mSelectedPosition) { + if (cardId == mSelectedCardId) { // selected card is coming back into view on a scroll, show selected // state without animation mSelectedCard = card; |