Skip to content

Commit

Permalink
update to v1.4.0 with delegate pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
klinker24 committed Mar 19, 2017
1 parent 87bd432 commit c87cbc3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit c87cbc3

Please sign in to comment.