Skip to content

Commit 707662c

Browse files
committed
- Removing rx dependencies
- sdk 25 for lib - Bugfix
1 parent e33e5c7 commit 707662c

4 files changed

Lines changed: 16 additions & 29 deletions

File tree

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
pre:
1111
- echo y | android update sdk --no-ui --all --filter "tools"
1212
- echo y | android update sdk --no-ui --all --filter "build-tools-25.0.0"
13-
- echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-23
13+
- echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-25
1414
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.0
1515

1616
test:

library/multichoicerecyclerview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ext {
1111
PUBLISH_VERSION = '2.4.0'
1212
SUPPORT_LIBRARY_VERSION = '24.2.1'
1313
BUILD_TOOLS = "25.0.0"
14-
TARGET_SDK = 23
14+
TARGET_SDK = 25
1515

1616
PUBLISH_ARTIFACT_ID = 'multichoicerecyclerview'
1717
PUBLISH_GROUP_ID = 'com.davidecirillo.multichoicerecyclerview'

library/multichoicerecyclerview/src/main/java/com/davidecirillo/multichoicerecyclerview/MultiChoiceAdapter.java

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,15 @@ public void onRestoreInstanceState(Bundle savedInstanceState) {
168168
}
169169

170170
/**
171-
* Use this method instead of {@link RecyclerView.Adapter#notifyDataSetChanged()}
172-
* and it'll automatically handle the list refresh without loosing current item state
171+
* <b>Use this method instead of {@link RecyclerView.Adapter#notifyDataSetChanged()} for
172+
* notifying a change in the data set.</b>
173+
*
174+
* <b>NOTE: The new data will not keep the current selected status, all the item will be reset to INACTIVE.</b>
175+
*
173176
*/
174-
public void refreshDataSet() {
175-
refreshDataSetInternal();
177+
public void notifyAdapterDataSetChanged() {
178+
// TODO: 10/03/2017 Create some possible instrumentation tests around this functionality
179+
notifyAdapterDataSetChangedInternal();
176180
}
177181

178182
//endregion
@@ -314,24 +318,10 @@ private void performAll(Action action) {
314318
}
315319
}
316320

317-
private void refreshDataSetInternal() {
318-
if (mItemList.isEmpty()) {
319-
for (int i = 0; i < getItemCount(); i++) {
320-
mItemList.put(i, State.INACTIVE);
321-
}
322-
} else if (mItemList.size() > getItemCount()) { // We have new items, let's add only the new ones as inactive
323-
for (int i = 0; i < getItemCount(); i++) {
324-
if (mItemList.get(i) != null) {
325-
mItemList.put(i, State.INACTIVE);
326-
}
327-
}
328-
} else {
329-
// Keep just the number of item in the getItemCount remove all the others.
330-
for (int i = 0; i < mItemList.size(); i++) {
331-
if (i + 1 > getItemCount()) {
332-
mItemList.remove(i);
333-
}
334-
}
321+
private void notifyAdapterDataSetChangedInternal() {
322+
// TODO: 10/03/2017 create some unit tests on this
323+
for (int i = 0; i < getItemCount(); i++) {
324+
mItemList.put(i, State.INACTIVE);
335325
}
336326
processNotifyDataSetChanged();
337327
}
@@ -345,7 +335,7 @@ public void onClearButtonPressed() {
345335
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
346336
mRecyclerView = recyclerView;
347337

348-
refreshDataSetInternal();
338+
notifyAdapterDataSetChangedInternal();
349339
super.onAttachedToRecyclerView(recyclerView);
350340
}
351341

sample/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ext {
55
PUBLISH_VERSION = '2.0.0'
66
SUPPORT_LIBRARY_VERSION = '24.2.1'
77
BUILD_TOOLS = "25.0.0"
8-
TARGET_SDK = 23
8+
TARGET_SDK = 25
99
}
1010

1111
android {
@@ -81,9 +81,6 @@ dependencies {
8181
compile "com.android.support:design:${SUPPORT_LIBRARY_VERSION}"
8282
compile 'com.jakewharton:butterknife:8.1.0'
8383
apt 'com.jakewharton:butterknife-compiler:8.1.0'
84-
// RxAndroid - asynchronous operations
85-
compile 'io.reactivex:rxandroid:1.0.1'
86-
compile 'io.reactivex:rxjava:1.0.14'
8784
compile 'com.squareup.picasso:picasso:2.5.2'
8885
// Testing-only dependencies
8986
testCompile 'junit:junit:4.10'

0 commit comments

Comments
 (0)