Skip to content

Commit

Permalink
Updated doc for CardCursorAdapter and new expand methods gabrielemari…
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielemariotti committed Mar 10, 2014
1 parent ab1a49c commit 610f032
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Log
Version 1.4.2 *(2014-03-07)*
----------------------------
* LIB: new expand/collapse methods are now available also for `CardCursorAdapter` [(doc)](https://github.com/gabrielemariotti/cardslib/blob/master/doc/EXPAND.md#cardexpand-and-cardlistview)
It contains a **BREAKING CHANGE** with CardCursorApdater and Expand feature. Read the above link to migrate your code.


Version 1.4.0 *(2014-03-02)*
Expand Down
24 changes: 20 additions & 4 deletions doc/EXPAND.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ How to enable the custom expand/collapse in a `ListView`.

You can use the `CardExpand` inside the `CardListView`.

With a **`CardArrayAdapter` ** you can use the same code described above.
With a **`CardArrayAdapter`** you can use the same code described above.

You can find an example in [`ListExpandCardFragment`]((https://github.com/gabrielemariotti/cardslib/tree/master/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/ListExpandCardFragment.java).)

Expand Down Expand Up @@ -278,7 +278,7 @@ If you want to know about your card, you can use
When you click a card to expand or collapse the method `adapter.notifyDataSetChanged` will be called.


With a **`CardCursorAdapter` ** you have to use this code:
With a **`CardCursorAdapter`** you have to use this code:

``` java
public class MyCursorCardAdapter extends CardCursorAdapter {
Expand Down Expand Up @@ -327,6 +327,15 @@ With a **`CardCursorAdapter` ** you have to use this code:
}
```

**Pay attention**: To work with a `CardCursorAdapter` and expand/collapse feature you have to set your Id inside your card.

``` java
card.setId("xxxx)";
```

The `id` must be unique, and it can be useful to set it with your id in the database.


If you want to set a card as expanded/collapsed, you can use one of these methods:

``` java
Expand All @@ -344,12 +353,10 @@ If you want to set a card as expanded/collapsed, you can use one of these method

If you want to know about your card, you can use:


``` java
.mAdapter.isExpanded(Card card)
```


If you want to know all ids expanded you can use:

``` java
Expand All @@ -358,3 +365,12 @@ If you want to know all ids expanded you can use:

In this case the method `adapter.notifyDataSetChanged` will NOT be called.


**Migration from 1.4.0 (and previous releases) - to 1.4.2**

The 1.4.2 may introduce a breaking change with CardCursorAdapter and expand feature.
To migrate your code you have to:

* call `card.setId("xxxx)";` in your `getCardFromCursor` method
* remove `card.setExpanded(true/false)` from your adapter code
* use `mAdapter.setExpanded(card);` as described above to expand/collapse your cards.

0 comments on commit 610f032

Please sign in to comment.