use of com.odysee.app.tasks.file.FileListTask in project odysee-android by OdyseeTeam.
the class FileViewFragment method tryOpenFileOrFileGet.
private void tryOpenFileOrFileGet() {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (actualClaim != null) {
String claimId = actualClaim.getClaimId();
FileListTask task = new FileListTask(claimId, null, new FileListTask.FileListResultHandler() {
@Override
public void onSuccess(List<LbryFile> files, boolean hasReachedEnd) {
if (files.size() > 0) {
actualClaim.setFile(files.get(0));
handleMainActionForClaim();
checkIsFileComplete();
} else {
checkStoragePermissionAndFileGet();
}
}
@Override
public void onError(Exception error) {
checkStoragePermissionAndFileGet();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
use of com.odysee.app.tasks.file.FileListTask in project odysee-android by OdyseeTeam.
the class LibraryFragment method fetchDownloads.
private void fetchDownloads() {
contentListLoading = true;
Helper.setViewVisibility(linkStats, View.GONE);
Helper.setViewVisibility(layoutListEmpty, View.GONE);
FileListTask task = new FileListTask(currentPage, PAGE_SIZE, true, listLoading, new FileListTask.FileListResultHandler() {
@Override
public void onSuccess(List<LbryFile> files, boolean hasReachedEnd) {
listReachedEnd = hasReachedEnd;
List<LbryFile> filteredFiles = Helper.filterDownloads(files);
List<Claim> claims = Helper.claimsFromFiles(filteredFiles);
addFiles(filteredFiles);
updateStats();
checkStatsLink();
if (contentListAdapter == null) {
initContentListAdapter(claims);
} else {
contentListAdapter.addItems(claims);
}
if (contentListAdapter != null && contentList.getAdapter() == null) {
contentList.setAdapter(contentListAdapter);
}
resolveMissingChannelNames(buildUrlsToResolve(claims));
checkListEmpty();
contentListLoading = false;
}
@Override
public void onError(Exception error) {
// pass
checkStatsLink();
checkListEmpty();
contentListLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of com.odysee.app.tasks.file.FileListTask in project odysee-android by OdyseeTeam.
the class FileViewFragment method loadFile.
private void loadFile() {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
String claimId = actualClaim.getClaimId();
FileListTask task = new FileListTask(claimId, null, new FileListTask.FileListResultHandler() {
@Override
public void onSuccess(List<LbryFile> files, boolean hasReachedEnd) {
if (files.size() > 0) {
actualClaim.setFile(files.get(0));
checkIsFileComplete();
if (!actualClaim.isPlayable() && !actualClaim.isViewable()) {
showUnsupportedView();
}
} else {
if (!actualClaim.isPlayable() && !actualClaim.isViewable()) {
restoreMainActionButton();
}
}
// initialFileLoadDone = true;
}
@Override
public void onError(Exception error) {
// initialFileLoadDone = true;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations