use of com.odysee.app.tasks.file.DeleteFileTask in project odysee-android by OdyseeTeam.
the class FileViewFragment method deleteClaimFile.
private void deleteClaimFile() {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (actualClaim != null) {
View actionDelete = getView().findViewById(R.id.file_view_action_delete);
DeleteFileTask task = new DeleteFileTask(actualClaim.getClaimId(), new GenericTaskHandler() {
@Override
public void beforeStart() {
actionDelete.setEnabled(false);
}
@Override
public void onSuccess() {
Helper.setViewVisibility(actionDelete, View.GONE);
View root = getView();
if (root != null) {
// root.findViewById(R.id.file_view_action_download).setVisibility(View.VISIBLE);
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.GONE);
}
Helper.setViewEnabled(actionDelete, true);
actualClaim.setFile(null);
Lbry.unsetFilesForCachedClaims(Arrays.asList(actualClaim.getClaimId()));
restoreMainActionButton();
}
@Override
public void onError(Exception error) {
actionDelete.setEnabled(true);
if (error != null) {
showError(error.getMessage());
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
Aggregations