use of com.odysee.app.tasks.localdata.FetchViewHistoryTask in project odysee-android by OdyseeTeam.
the class LibraryFragment method loadRecent.
private void loadRecent() {
contentListLoading = true;
Helper.setViewVisibility(layoutListEmpty, View.GONE);
DatabaseHelper dbHelper = DatabaseHelper.getInstance();
if (dbHelper != null) {
FetchViewHistoryTask task = new FetchViewHistoryTask(lastDate, PAGE_SIZE, dbHelper, new FetchViewHistoryTask.FetchViewHistoryHandler() {
@Override
public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) {
listReachedEnd = hasReachedEnd;
if (history.size() > 0) {
lastDate = history.get(history.size() - 1).getTimestamp();
}
List<Claim> claims = Helper.claimsFromViewHistory(history);
if (contentListAdapter == null) {
initRecentAdapter(claims);
}
if (contentListAdapter != null && recentList.getAdapter() == null) {
recentList.setAdapter(contentListAdapter);
}
checkListEmpty();
contentListLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
checkListEmpty();
contentListLoading = false;
}
}
Aggregations