Skip to content

Commit c87cbc3

Browse files
committed
update to v1.4.0 with delegate pattern
1 parent 87bd432 commit c87cbc3

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# Changelog
22

3+
### v1.4.0
4+
5+
* Create a `DragDismissDelegate` and `DragDismissRecyclerViewDelegate` to handle the drag-dismiss functionality, for those that don't want to extend the `DragDismissActivity` and `DragDismissRecyclerViewActivity`.
6+
* The provided `Activities` just implement the delegate. Similar to `AppCompatActivity`.
7+
* No changes are required when implementing either of the two provided `Activities`.
8+
39
### v1.3.0
410

5-
* Option to set the drag elasticity on the `DragDismissIntentBuilder".
6-
`
11+
* Option to set the drag elasticity on the `DragDismissIntentBuilder`.
12+
713
### v1.2.3
814

915
* Improve the swipe to dismiss distance

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ To include it in your project, add this to your module's `build.gradle` file:
1919
```groovy
2020
dependencies {
2121
...
22-
compile 'com.klinkerapps:drag-dismiss-activity:1.3.0'
22+
compile 'com.klinkerapps:drag-dismiss-activity:1.4.0'
2323
}
2424
```
2525

26+
*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).*
27+
2628
#### Replacing an Activity
2729

2830
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.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ MIN_SDK=15
2323
TARGET_SDK=25
2424
COMPILE_SDK=25
2525

26-
VERSION_NAME=1.3.0
26+
VERSION_NAME=1.4.0
2727
VERSION_CODE=1
2828
GROUP=com.klinkerapps
2929

library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissActivity.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,13 @@
3434
* you to add any content you want. Your content will be housed in a NestedScrollView, so you shouldn't
3535
* worry about the height of the content.
3636
*/
37-
public abstract class DragDismissActivity extends AbstractDragDismissActivity {
37+
public abstract class DragDismissActivity extends AbstractDragDismissActivity implements DragDismissDelegate.Callback {
3838

39-
protected abstract View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState);
39+
public abstract View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState);
4040

4141
@Override
4242
protected AbstractDragDismissDelegate createDelegate() {
43-
return new DragDismissDelegate(this, new DragDismissDelegate.Callback() {
44-
@Override
45-
public View onCreateContent(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
46-
return DragDismissActivity.this.onCreateContent(inflater, parent, savedInstanceState);
47-
}
48-
});
43+
return new DragDismissDelegate(this, this);
4944
}
5045

5146
/**

library/src/main/java/xyz/klinker/android/drag_dismiss/activity/DragDismissRecyclerViewActivity.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,13 @@
3636
* You will have to set up the RecyclerView in the abstract setupRecyclerView method. Within that
3737
* method, you should set the adapter and the LayoutManager.
3838
*/
39-
public abstract class DragDismissRecyclerViewActivity extends AbstractDragDismissActivity {
39+
public abstract class DragDismissRecyclerViewActivity extends AbstractDragDismissActivity implements DragDismissRecyclerViewDelegate.Callback {
4040

41-
protected abstract void setupRecyclerView(RecyclerView recyclerView);
41+
public abstract void setupRecyclerView(RecyclerView recyclerView);
4242

4343
@Override
4444
protected AbstractDragDismissDelegate createDelegate() {
45-
return new DragDismissRecyclerViewDelegate(this, new DragDismissRecyclerViewDelegate.Callback() {
46-
@Override
47-
public void setupRecyclerView(RecyclerView recyclerView) {
48-
DragDismissRecyclerViewActivity.this.setupRecyclerView(recyclerView);
49-
}
50-
});
45+
return new DragDismissRecyclerViewDelegate(this, this);
5146
}
5247

5348
/**

0 commit comments

Comments
 (0)