diff options
| author | Lars Greiss <kufikugel@googlemail.com> | 2014-03-19 03:07:36 +0100 |
|---|---|---|
| committer | Lars Greiss <kufikugel@googlemail.com> | 2014-03-19 03:07:36 +0100 |
| commit | e378e5e98596a5cf211a86f6e1da6fe419b36e8c (patch) | |
| tree | 4b8384c4ee4f82104d0aab9f95ade2e9b2a88a34 | |
| parent | a0cde8d6ee8fbd416f2be66c57df85a6ba0afd87 (diff) | |
Cardslib: use own getCount and getItem
Change-Id: I19696a80769ec73dfe31646d66f1d3ac32bd40e7
| -rw-r--r-- | src/com/android/cards/internal/CardGridArrayAdapter.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/cards/internal/CardGridArrayAdapter.java b/src/com/android/cards/internal/CardGridArrayAdapter.java index b658ad1..2fb10bd 100644 --- a/src/com/android/cards/internal/CardGridArrayAdapter.java +++ b/src/com/android/cards/internal/CardGridArrayAdapter.java @@ -86,6 +86,11 @@ public class CardGridArrayAdapter extends BaseCardArrayAdapter { */ protected SwipeDismissListViewTouchListener mOnTouchListener; + /** + * List of cards represented in the ListView. + */ + private List<Card> cards; + // ------------------------------------------------------------- // Constructors @@ -99,6 +104,7 @@ public class CardGridArrayAdapter extends BaseCardArrayAdapter { */ public CardGridArrayAdapter(Context context, List<Card> cards) { super(context, cards); + this.cards = cards; } // ------------------------------------------------------------- @@ -115,7 +121,7 @@ public class CardGridArrayAdapter extends BaseCardArrayAdapter { LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //Retrieve card from items - mCard = (Card) getItem(position); + mCard = getItem(position); if (mCard != null) { int layout = mRowLayoutId; @@ -165,6 +171,16 @@ public class CardGridArrayAdapter extends BaseCardArrayAdapter { return view; } + @Override + public int getCount() { + return cards.size(); + } + + @Override + public Card getItem(int pos){ + return cards.get(pos); + } + /** * Removes SwipeAnimation on Grid * |
