Skip to content

Commit

Permalink
3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dexafree committed Aug 23, 2015
1 parent 5fbddf9 commit 0637e11
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# MaterialList v3

## 3.0.1
* Clear method now divided:
* `clear` removes the dismissible Cards.
* `clearAll` dismisses all the Cards.

## 3.0.0
* **Builder Pattern**: to easily create new Cards
* **Observer Pattern**: to replace the Eventbus Otto with native Java Observers
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ In order to use MaterialList, you can either clone the project and import it as
```groovy
dependencies {
...
compile 'com.github.dexafree:materiallist:3.0.0'
compile 'com.github.dexafree:materiallist:3.0.1'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_clear:
mListView.clear();
mListView.clearAll();
break;
case R.id.action_add_at_start:
addMockCardAtStart();
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=3.0.0
VERSION_CODE=300
VERSION_NAME=3.0.1
VERSION_CODE=301
GROUP=com.github.dexafree

POM_DESCRIPTION=Android library aimed to get the beautiful CardViews that Google shows at its official design specifications
Expand Down
4 changes: 2 additions & 2 deletions materialList/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 21
versionCode 300
versionName "3.0.0"
versionCode 301
versionName "3.0.1"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ public interface IMaterialListAdapter {
boolean isEmpty();

/**
* Clears the list from all Cards.
* Clears the list from all Cards (only if dismissable).
*/
void clear();

/**
* Clears the list from all Cards (even if they are not dismissable).
*/
void clearAll();

/**
* Get a Card at the specified position.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,21 @@ public void remove(@NonNull final Card card, boolean animate) {
}
}

public void clearAll() {
while(!mCardList.isEmpty()) {
final Card card = mCardList.get(0);
card.setDismissible(true);
remove(card, false);
}
}

public void clear() {
for (int index = 0; index < mCardList.size(); index++) {
remove(mCardList.get(index), false);
for (int index = 0; index < mCardList.size();) {
final Card card = mCardList.get(index);
if(!card.isDismissible()) {
index++;
}
remove(card, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public void clear() {
((MaterialListAdapter) getAdapter()).clear();
}

public void clearAll() {
((MaterialListAdapter) getAdapter()).clearAll();
}

@Override
public void setAdapter(final Adapter adapter) {
final Adapter oldAdapter = getAdapter();
Expand Down

0 comments on commit 0637e11

Please sign in to comment.