Skip to content

Instantly share code, notes, and snippets.

@dineshmm23
Created August 8, 2018 08:00
Show Gist options
  • Save dineshmm23/ebbf0ef7bb2d73550cddd0ebc5271486 to your computer and use it in GitHub Desktop.
Save dineshmm23/ebbf0ef7bb2d73550cddd0ebc5271486 to your computer and use it in GitHub Desktop.
Method for swipe to refresh
private void initializeSwipeToRefresh() {
// Swipe down to force synchronize
//swipeRefreshLayoutUserRole = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayoutUserRole.setDistanceToTriggerSync(390);
//swipeRefreshLayoutUserRole.setEnabled(true); //Controlled by fragments!
swipeRefreshLayoutUserRole.setColorSchemeResources(
android.R.color.holo_purple, android.R.color.holo_blue_light,
android.R.color.holo_green_light, android.R.color.holo_orange_light);
swipeRefreshLayoutUserRole.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// Passing true as parameter we always animate the changes between the old and the new data set
new GetUserRolesPrivleges().execute(skorkastBaseURL + "/user/" + userEmail + "/roleprivileges/" + communityId);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment