diff --git a/CHANGELOG.md b/CHANGELOG.md index 662edcd..b36776d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # Changelog +### v1.4.0 + +* Create a `DragDismissDelegate` and `DragDismissRecyclerViewDelegate` to handle the drag-dismiss functionality, for those that don't want to extend the `DragDismissActivity` and `DragDismissRecyclerViewActivity`. +* The provided `Activities` just implement the delegate. Similar to `AppCompatActivity`. +* No changes are required when implementing either of the two provided `Activities`. + ### v1.3.0 -* Option to set the drag elasticity on the `DragDismissIntentBuilder". -` +* Option to set the drag elasticity on the `DragDismissIntentBuilder`. + ### v1.2.3 * Improve the swipe to dismiss distance diff --git a/README.md b/README.md index 31fa927..debd76a 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,12 @@ To include it in your project, add this to your module's `build.gradle` file: ```groovy dependencies { ... - compile 'com.klinkerapps:drag-dismiss-activity:1.3.0' + compile 'com.klinkerapps:drag-dismiss-activity:1.4.0' } ``` +*Note: The normal way to implement the drag-dismiss functionality is by extending the two provided `Activities`: `DragDismissActivity` and `DragDismissRecyclerViewActivity`. If you would rather not do that, I have provided a delegate for each of these use-cases, that you can use: `DragDismissDelegate` and `DragDismissRecyclerViewDelegate`. To see an example of the delegate's usage, check out the [AbstractDragDismissActivity](https://github.com/klinker24/Android-DragDismissActivity/blob/master/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/AbstractDragDismissActivity.java).* + #### Replacing an Activity This library is meant to replace your `AppCompatActivity`. I will set up all the drag-dismiss features for you, and wrap your content in a boilerplate UI that contains a `Toolbar` and a `ScrollView` for your content. diff --git a/gradle.properties b/gradle.properties index 1f14ce0..4b00f13 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ MIN_SDK=15 TARGET_SDK=25 COMPILE_SDK=25 -VERSION_NAME=1.3.0 +VERSION_NAME=1.4.0 VERSION_CODE=1 GROUP=com.klinkerapps diff --git a/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissActivity.java b/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissActivity.java index 801ec4a..2730d26 100644 --- a/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissActivity.java +++ b/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissActivity.java @@ -34,18 +34,13 @@ * you to add any content you want. Your content will be housed in a NestedScrollView, so you shouldn't * worry about the height of the content. */ -public abstract class DragDismissActivity extends AbstractDragDismissActivity { +public abstract class DragDismissActivity extends AbstractDragDismissActivity implements DragDismissDelegate.Callback { - protected abstract View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState); + public abstract View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState); @Override protected AbstractDragDismissDelegate createDelegate() { - return new DragDismissDelegate(this, new DragDismissDelegate.Callback() { - @Override - public View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { - return DragDismissActivity.this.onCreateContent(inflater, parent, savedInstanceState); - } - }); + return new DragDismissDelegate(this, this); } /** diff --git a/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissRecyclerViewActivity.java b/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissRecyclerViewActivity.java index 4a8bc85..3e6f53f 100644 --- a/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissRecyclerViewActivity.java +++ b/library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissRecyclerViewActivity.java @@ -36,18 +36,13 @@ * You will have to set up the RecyclerView in the abstract setupRecyclerView method. Within that * method, you should set the adapter and the LayoutManager. */ -public abstract class DragDismissRecyclerViewActivity extends AbstractDragDismissActivity { +public abstract class DragDismissRecyclerViewActivity extends AbstractDragDismissActivity implements DragDismissRecyclerViewDelegate.Callback { - protected abstract void setupRecyclerView(RecyclerView recyclerView); + public abstract void setupRecyclerView(RecyclerView recyclerView); @Override protected AbstractDragDismissDelegate createDelegate() { - return new DragDismissRecyclerViewDelegate(this, new DragDismissRecyclerViewDelegate.Callback() { - @Override - public void setupRecyclerView(RecyclerView recyclerView) { - DragDismissRecyclerViewActivity.this.setupRecyclerView(recyclerView); - } - }); + return new DragDismissRecyclerViewDelegate(this, this); } /**