use of com.ferg.awfulapp.task.PostRequest in project Awful.apk by Awful.
the class ThreadDisplayFragment method syncThread.
/**
* Reload the current thread page
*/
private void syncThread() {
final Activity activity = getActivity();
if (activity != null) {
Timber.i("Syncing - reloading from site (thread %d, page %d) to update DB", getThreadId(), getPageNumber());
// cancel pending post loading requests
NetworkUtils.cancelRequests(PostRequest.REQUEST_TAG);
bodyHtml = "";
// call this with cancelOnDestroy=false to retain the request's specific type tag
final int pageNumber = getPageNumber();
int userId = postFilterUserId == null ? BLANK_USER_ID : postFilterUserId;
queueRequest(new PostRequest(activity, getThreadId(), pageNumber, userId).build(this, new AwfulRequest.AwfulResultCallback<Integer>() {
@Override
public void success(Integer result) {
refreshInfo();
setProgress(75);
refreshPosts();
}
@Override
public void failure(VolleyError error) {
Timber.w("Failed to sync thread! Error: %s", error.getMessage());
refreshInfo();
refreshPosts();
}
}), false);
}
}
Aggregations