Skip to content

Commit 7eaeea0

Browse files
author
Ingo Schwarz
committed
Create Swipe to Refresh section in Readme
1 parent 49feba8 commit 7eaeea0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,22 @@ If you want to have a seperator between the data rows you can do so by specifyin
312312
```
313313
As for the `ListView` you can specify `divider` as a drawable and `dividerHeight` as the vertical size of the divider.
314314

315+
### Swipe to Refresh
316+
The TableView has a build in SwipeToRefresh action. By default this is disabled, but you can easily enable it using the follwing line.
317+
```java
318+
tableView.setSwipeToRefreshEnabled( true );
319+
```
320+
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.
321+
```java
322+
carTableView.setSwipeToRefreshListener(new SwipeToRefreshListener() {
323+
@Override
324+
public void onRefresh(final RefreshIndicator refreshIndicator) {
325+
// your async refresh action goes here
326+
}
327+
});
328+
```
329+
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()`.
330+
315331
### State Persistence
316332
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.
317333
```java

0 commit comments

Comments
 (0)