So here is the method I found in most tutorials of SwipeRefreshLayout but it seems complitely stupid to me.
What it does : it does the refresh animation for 2000 ms before actually doStuff().
What I (obviously!!) want to do : refresh animation while it does doStuff() then stop. No timer needed ! Am I doing something wrong ? Internet tells me no...
view.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeEmptyView.setRefreshing(true);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doStuff();
swipeEmptyView.setRefreshing(false);
}
}, 2000);
}
});