diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..86c37e11 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +# How to Contribute + +## [IMPORTANT] When opening a Pull Request + +This project is actively developed on the [`develop`](/h6ah4i/android-advancedrecyclerview/tree/develop) branch. **Please change the base branch to `develop`**. + + + +## Issue reports + +When creating an issue report, please provide sufficient information of the issue; + +- Version of the Advanced RecyclerView library +- What happens? +- What is the expected behavior? +- How to reproduce? + - *If the issue is hard to reproduce or only occurs in the specific condition, please upload minimal project which can reproduce the same issue.* + +These information are optional but recommended because it also helps me to determine what is wrong. + +- Dump of the call stack (if crash occurs) +- Version of the Support libraries +- Android OS version diff --git a/README.md b/README.md index 170ee051..4aa0eae5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expandable item features. Works on API level 9 or later. +[ ![Download](https://api.bintray.com/packages/h6ah4i/maven/android-advancedrecyclerview/images/download.svg) ](https://bintray.com/h6ah4i/maven/android-advancedrecyclerview/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Advanced%20RecyclerView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1432) --- @@ -32,7 +33,7 @@ Target platforms Latest version --- -- Version 0.8.3 (Oct. 27, 2015) ([RELEASE NOTES](./RELEASE-NOTES.md)) +- Version 0.8.4 (Nov. 4, 2015) ([RELEASE NOTES](./RELEASE-NOTES.md)) *If you are using support library v23.0.x, please use v0.8.1 instead.* @@ -44,45 +45,12 @@ This library is published on jCenter. Just add these lines to `build.gradle`. ```groovy dependencies { - compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.3@aar'){ + compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.4@aar'){ transitive=true } } ``` ---- - -*This library is provided as the AAR format. -The source jar file won't be downloaded automatically (due to the current Gradle and Anndroid Studio limitation), so javadoc comments are not displayed on IDE.* - -**Here is a workaround thanks to the superb [AARLinkSources](https://github.com/xujiaao/AARLinkSources) Gradle plugin !** - -```groovy -buildscript { - repositories { - maven { url 'https://raw.github.com/xujiaao/mvn-repository/master/releases' } - } - - dependencies { - classpath 'com.github.xujiaao:aarLinkSources:1.0.0' - } -} - -apply plugin: 'com.android.application' -apply plugin: 'aar-link-sources' - -android { - ... -} - -dependencies { - compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.3@aar'){ - transitive=true - } - aarLinkSources 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.3:sources@jar' -} -``` - Migration Guide --- @@ -91,7 +59,7 @@ The version 0.8.0 has fixed a lot of issues and introduced some new features. So ### Swipe The `SwipeableItemAdapter` interface has been changed drastically. -Also, some methods and some constants are marked as deprecated because vertical swipe feature is added. +Also, some methods and some constants are marked as deprecated because vertical swipe feature is added. #### Recommended way Implement the new `SwipeableItemAdapter.onItemSwipe()` method which returns `SwipeResultAction` objects. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 180d8740..ed328192 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,7 @@ +## 0.8.4 +- Fixed issue #142 (Recycler View crash on destroy) + + ## 0.8.3 - Fixed issue #131 (Bottom padding of recycler view offsets the dragging item [Drag drop] bug) - Fixed issue #133 (Wrong item position used when data set changes during swipe bug) diff --git a/example/build.gradle b/example/build.gradle index 5b25a8fa..ef620397 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -25,8 +25,8 @@ android { applicationId "com.h6ah4i.android.example.advrecyclerview" minSdkVersion 9 targetSdkVersion 23 - versionCode 13 - versionName "0.8.3" + versionCode 14 + versionName "0.8.4" } signingConfigs { diff --git a/images/contributing_pull_request.png b/images/contributing_pull_request.png new file mode 100644 index 00000000..757eee10 Binary files /dev/null and b/images/contributing_pull_request.png differ diff --git a/library/library-data.properties b/library/library-data.properties index bd5562e4..98d6838b 100644 --- a/library/library-data.properties +++ b/library/library-data.properties @@ -1,7 +1,7 @@ # suppress inspection "UnusedProperty" for whole file # common -VERSION_NAME=0.8.3 -VERSION_CODE=13 +VERSION_NAME=0.8.4 +VERSION_CODE=14 # for maven-publish POM_GROUP_ID=com.h6ah4i.android.widget.advrecyclerview diff --git a/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/utils/BaseWrapperAdapter.java b/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/utils/BaseWrapperAdapter.java index dbcd0da0..36b39d4b 100644 --- a/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/utils/BaseWrapperAdapter.java +++ b/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/utils/BaseWrapperAdapter.java @@ -37,6 +37,10 @@ public BaseWrapperAdapter(RecyclerView.Adapter adapter) { super.setHasStableIds(mWrappedAdapter.hasStableIds()); } + private boolean isWrappedAdapterAlive(){ + return mWrappedAdapter!=null; + } + public void release() { onRelease(); @@ -58,33 +62,40 @@ public RecyclerView.Adapter getWrappedAdapter() { @Override public void onAttachedToRecyclerView(RecyclerView recyclerView) { - mWrappedAdapter.onAttachedToRecyclerView(recyclerView); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onAttachedToRecyclerView(recyclerView); } @Override public void onDetachedFromRecyclerView(RecyclerView recyclerView) { - mWrappedAdapter.onDetachedFromRecyclerView(recyclerView); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onDetachedFromRecyclerView(recyclerView); } @Override public void onViewAttachedToWindow(VH holder) { - mWrappedAdapter.onViewAttachedToWindow(holder); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onViewAttachedToWindow(holder); } @Override public void onViewDetachedFromWindow(VH holder) { - mWrappedAdapter.onViewDetachedFromWindow(holder); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onViewDetachedFromWindow(holder); } @Override public void onViewRecycled(VH holder) { - mWrappedAdapter.onViewRecycled(holder); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onViewRecycled(holder); } @Override public void setHasStableIds(boolean hasStableIds) { super.setHasStableIds(hasStableIds); - mWrappedAdapter.setHasStableIds(hasStableIds); + + if (isWrappedAdapterAlive()) + mWrappedAdapter.setHasStableIds(hasStableIds); } @Override @@ -94,12 +105,13 @@ public VH onCreateViewHolder(ViewGroup parent, int viewType) { @Override public void onBindViewHolder(VH holder, int position) { - mWrappedAdapter.onBindViewHolder(holder, position); + if (isWrappedAdapterAlive()) + mWrappedAdapter.onBindViewHolder(holder, position); } @Override public int getItemCount() { - return mWrappedAdapter.getItemCount(); + return isWrappedAdapterAlive() ? mWrappedAdapter.getItemCount() : 0; } @Override