Skip to content

Commit

Permalink
Create Swipe to Refresh section in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Schwarz committed Oct 8, 2016
1 parent 49feba8 commit 7eaeea0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ If you want to have a seperator between the data rows you can do so by specifyin
```
As for the `ListView` you can specify `divider` as a drawable and `dividerHeight` as the vertical size of the divider.

### Swipe to Refresh
The TableView has a build in SwipeToRefresh action. By default this is disabled, but you can easily enable it using the follwing line.
```java
tableView.setSwipeToRefreshEnabled( true );
```
This enables the user to trigger the table refresh on a single swipe. To listen for this user interaction you have to set an `SwipeToRefreshListener` to your tableview.
```java
carTableView.setSwipeToRefreshListener(new SwipeToRefreshListener() {
@Override
public void onRefresh(final RefreshIndicator refreshIndicator) {
// your async refresh action goes here
}
});
```
The callback method has the `RefreshIndicator` that is shown to the user passed as parameter. So if you finished your refresh action simply call `RefreshIndicator.hide()`.

### State Persistence
The TableView as well as the SortableTableView will persist its state automatically (e.g. on orientation change). If you want to disable this behaviour you can do so using the following code snipped.
```java
Expand Down

0 comments on commit 7eaeea0

Please sign in to comment.