From 32b10ab674ca87cf26ca12e7be30db3e79377a66 Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Sat, 13 Jan 2018 15:22:38 +0100 Subject: [PATCH 1/4] * rename `collapsed` to `expanded` --- .../src/main/java/com/mikepenz/fastadapter/IExpandable.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/IExpandable.java b/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/IExpandable.java index f488f935c..f0be3a627 100644 --- a/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/IExpandable.java +++ b/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/IExpandable.java @@ -14,10 +14,10 @@ public interface IExpandable { /** * use this method to set if the Expandable item is currently expanded * - * @param collapsed true if expanded (opened) + * @param expanded true if expanded (opened) * @return this */ - T withIsExpanded(boolean collapsed); + T withIsExpanded(boolean expanded); /** * use this method to set the subItems of this item From 12ec1890ca998838bf3a7f402210d44bbef530b3 Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Mon, 15 Jan 2018 12:02:04 +0100 Subject: [PATCH 2/4] * adjust the logic for the `setNewList` of the new `IItemList` which might cause issues in some cases --- .../java/com/mikepenz/fastadapter/IItemList.java | 2 +- .../fastadapter/adapters/ModelAdapter.java | 7 ++++--- .../fastadapter/utils/ComparableItemListImpl.java | 15 +++++++++++++-- .../fastadapter/utils/DefaultItemListImpl.java | 6 ++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/library-core/src/main/java/com/mikepenz/fastadapter/IItemList.java b/library-core/src/main/java/com/mikepenz/fastadapter/IItemList.java index d138c88d9..6bee15a95 100644 --- a/library-core/src/main/java/com/mikepenz/fastadapter/IItemList.java +++ b/library-core/src/main/java/com/mikepenz/fastadapter/IItemList.java @@ -30,7 +30,7 @@ public interface IItemList { void set(List items, int preItemCount, @Nullable IAdapterNotifier adapterNotifier); - void setNewList(List items); + void setNewList(List items, boolean notify); void addAll(int position, List items, int preItemCount); diff --git a/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java b/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java index 8a0ee57b8..08849ceca 100644 --- a/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java +++ b/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java @@ -351,12 +351,13 @@ public ModelAdapter setNewList(List list, boolean retainFilt getItemFilter().performFiltering(null); } - mItems.setNewList(items); - mapPossibleTypes(mItems.getItems()); + mapPossibleTypes(items); - if (filter != null && retainFilter) { + boolean publishResults = filter != null && retainFilter; + if (publishResults) { getItemFilter().publishResults(filter, getItemFilter().performFiltering(filter)); } + mItems.setNewList(items, !publishResults); return this; } diff --git a/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java b/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java index 82158f0d2..34c8a39f0 100644 --- a/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java +++ b/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java @@ -80,7 +80,7 @@ public void move(int fromPosition, int toPosition, int preItemCount) { public void addAll(List items, int preItemCount) { mItems.addAll(items); if (mComparator != null) { - Collections.sort(items, mComparator); + Collections.sort(mItems, mComparator); } getFastAdapter().notifyAdapterDataSetChanged(); } @@ -89,8 +89,19 @@ public void addAll(List items, int preItemCount) { public void addAll(int position, List items, int preItemCount) { mItems.addAll(position - preItemCount, items); if (mComparator != null) { - Collections.sort(items, mComparator); + Collections.sort(mItems, mComparator); } getFastAdapter().notifyAdapterDataSetChanged(); } + + @Override + public void setNewList(List items, boolean notify) { + mItems = new ArrayList<>(items); + if (mComparator != null) { + Collections.sort(mItems, mComparator); + } + if(notify) { + getFastAdapter().notifyAdapterDataSetChanged(); + } + } } diff --git a/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java b/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java index 6ca1dccfd..f106b0d17 100644 --- a/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java +++ b/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java @@ -132,8 +132,10 @@ public void set(List items, int preItemCount, @Nullable IAdapterNotifier a } @Override - public void setNewList(List items) { + public void setNewList(List items, boolean notify) { mItems = new ArrayList<>(items); - getFastAdapter().notifyAdapterDataSetChanged(); + if(notify) { + getFastAdapter().notifyAdapterDataSetChanged(); + } } } From db9a10ebb8e01cc87a8c6655e6c9094c8a7b906b Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Mon, 15 Jan 2018 16:30:11 +0100 Subject: [PATCH 3/4] * setting an item at a position, requires a `notifyItemChanged` not a `notifyItemInserted` * FIX #602 --- .../com/mikepenz/fastadapter/utils/DefaultItemListImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java b/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java index f106b0d17..6898507fe 100644 --- a/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java +++ b/library-core/src/main/java/com/mikepenz/fastadapter/utils/DefaultItemListImpl.java @@ -91,7 +91,7 @@ public boolean isEmpty() { @Override public void set(int position, Item item) { mItems.set(position, item); - getFastAdapter().notifyAdapterItemInserted(position); + getFastAdapter().notifyAdapterItemChanged(position); } @Override From 5cdaeae2adc9cda57305e671ac47c368d209f65b Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Mon, 15 Jan 2018 16:38:20 +0100 Subject: [PATCH 4/4] * [release] v3.1.2 --- README.md | 8 ++++---- app/build.gradle | 4 ++-- library-core/build.gradle | 4 ++-- library-core/gradle.properties | 4 ++-- library-extensions-expandable/build.gradle | 4 ++-- library-extensions-expandable/gradle.properties | 4 ++-- library-extensions/build.gradle | 4 ++-- library-extensions/gradle.properties | 4 ++-- library/build.gradle | 4 ++-- library/gradle.properties | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 7ddd2d27e..55d0ae958 100644 --- a/README.md +++ b/README.md @@ -41,26 +41,26 @@ You can try it out here [Google Play](https://play.google.com/store/apps/details The library is split up into core, commons, and extensions. The core functions are included in the following dependency. ```gradle -implementation 'com.mikepenz:fastadapter:3.1.1@aar' +implementation 'com.mikepenz:fastadapter:3.1.2@aar' implementation 'com.android.support:appcompat-v7:${latestSupportLib}' implementation 'com.android.support:recyclerview-v7:${latestSupportLib}' ``` The commons package comes with some useful helpers (which are not needed in all cases) This one for example includes the `FastItemAdapter` ```gradle -implementation 'com.mikepenz:fastadapter-commons:3.1.1@aar' +implementation 'com.mikepenz:fastadapter-commons:3.1.2@aar' ``` Expandable support is included and can be added via this ```gradle -implementation 'com.mikepenz:fastadapter-extensions-expandable:3.1.1@aar' +implementation 'com.mikepenz:fastadapter-extensions-expandable:3.1.2@aar' //The tiny Materialize library used for its useful helper classes implementation 'com.mikepenz:materialize:${latestVersion}@aar' ``` Many helper classes are included in the following dependency. (This functionality also needs the `Expandable` extension ```gradle -implementation 'com.mikepenz:fastadapter-extensions:3.1.1@aar' +implementation 'com.mikepenz:fastadapter-extensions:3.1.2@aar' implementation 'com.android.support:design:${versions.supportLib}' //The tiny Materialize library used for its useful helper classes implementation 'com.mikepenz:materialize:${latestVersion}@aar' diff --git a/app/build.gradle b/app/build.gradle index 994135984..f718ca2b8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { defaultConfig { minSdkVersion setup.minSdk targetSdkVersion setup.targetSdk - versionCode 3110 - versionName '3.1.1' + versionCode 3120 + versionName '3.1.2' setProperty("archivesBaseName", "FastAdapter-v$versionName-c$versionCode") } diff --git a/library-core/build.gradle b/library-core/build.gradle index 6710c9ae5..0eb005961 100644 --- a/library-core/build.gradle +++ b/library-core/build.gradle @@ -10,8 +10,8 @@ android { defaultConfig { minSdkVersion setup.minSdk targetSdkVersion setup.targetSdk - versionCode 3110 - versionName '3.1.1' + versionCode 3120 + versionName '3.1.2' consumerProguardFiles 'consumer-proguard-rules.pro' diff --git a/library-core/gradle.properties b/library-core/gradle.properties index 45ba86d8a..9a63882a1 100755 --- a/library-core/gradle.properties +++ b/library-core/gradle.properties @@ -1,5 +1,5 @@ POM_NAME=FastAdapter Library POM_ARTIFACT_ID=fastadapter POM_PACKAGING=aar -VERSION_NAME=3.1.1 -VERSION_CODE=3110 +VERSION_NAME=3.1.2 +VERSION_CODE=3120 diff --git a/library-extensions-expandable/build.gradle b/library-extensions-expandable/build.gradle index 5b07ddb06..3ebb5f406 100644 --- a/library-extensions-expandable/build.gradle +++ b/library-extensions-expandable/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion setup.minSdk targetSdkVersion setup.targetSdk - versionCode 3110 - versionName '3.1.1' + versionCode 3120 + versionName '3.1.2' } buildTypes { release { diff --git a/library-extensions-expandable/gradle.properties b/library-extensions-expandable/gradle.properties index 8dfb4d99e..9b653a19c 100755 --- a/library-extensions-expandable/gradle.properties +++ b/library-extensions-expandable/gradle.properties @@ -1,5 +1,5 @@ POM_NAME=FastAdapter Library-Extensions-Expandable POM_ARTIFACT_ID=fastadapter-extensions-expandable POM_PACKAGING=aar -VERSION_NAME=3.1.1 -VERSION_CODE=3110 \ No newline at end of file +VERSION_NAME=3.1.2 +VERSION_CODE=3120 \ No newline at end of file diff --git a/library-extensions/build.gradle b/library-extensions/build.gradle index 001c2766f..dfe818f38 100644 --- a/library-extensions/build.gradle +++ b/library-extensions/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion setup.minSdk targetSdkVersion setup.targetSdk - versionCode 3110 - versionName '3.1.1' + versionCode 3120 + versionName '3.1.2' consumerProguardFiles 'consumer-proguard-rules.pro' } diff --git a/library-extensions/gradle.properties b/library-extensions/gradle.properties index e829cd6f8..6155bc684 100755 --- a/library-extensions/gradle.properties +++ b/library-extensions/gradle.properties @@ -1,5 +1,5 @@ POM_NAME=FastAdapter Library-Extensions POM_ARTIFACT_ID=fastadapter-extensions POM_PACKAGING=aar -VERSION_NAME=3.1.1 -VERSION_CODE=3110 +VERSION_NAME=3.1.2 +VERSION_CODE=3120 diff --git a/library/build.gradle b/library/build.gradle index 811920ee1..fd0fbaf43 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion setup.minSdk targetSdkVersion setup.targetSdk - versionCode 3110 - versionName '3.1.1' + versionCode 3120 + versionName '3.1.2' } buildTypes { release { diff --git a/library/gradle.properties b/library/gradle.properties index 60e85b92c..3ddac1ef4 100755 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -1,5 +1,5 @@ POM_NAME=FastAdapter Library POM_ARTIFACT_ID=fastadapter-commons POM_PACKAGING=aar -VERSION_NAME=3.1.1 -VERSION_CODE=3110 +VERSION_NAME=3.1.2 +VERSION_CODE=3120