use of com.odysee.app.tasks.claim.AbandonChannelTask in project odysee-android by OdyseeTeam.
the class ChannelFragment method deleteCurrentClaim.
private void deleteCurrentClaim() {
if (claim != null) {
Helper.setViewVisibility(layoutDisplayArea, View.GONE);
Helper.setViewVisibility(layoutLoadingState, View.VISIBLE);
AbandonChannelTask task = new AbandonChannelTask(Collections.singletonList(claim.getClaimId()), layoutResolving, Lbryio.AUTH_TOKEN, new AbandonHandler() {
@Override
public void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors) {
Context context = getContext();
if (context instanceof MainActivity) {
if (failedClaimIds.size() == 0) {
MainActivity activity = (MainActivity) context;
activity.showMessage(R.string.channel_deleted);
activity.onBackPressed();
} else {
View root = getView();
if (root != null) {
Snackbar.make(root, R.string.channel_failed_delete, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
}
}
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
use of com.odysee.app.tasks.claim.AbandonChannelTask in project odysee-android by OdyseeTeam.
the class ChannelManagerFragment method handleDeleteSelectedClaims.
private void handleDeleteSelectedClaims(List<Claim> selectedClaims) {
List<String> claimIds = new ArrayList<>();
for (Claim claim : selectedClaims) {
claimIds.add(claim.getClaimId());
}
if (actionMode != null) {
actionMode.finish();
}
Helper.setViewVisibility(channelList, View.INVISIBLE);
Helper.setViewVisibility(fabNewChannel, View.INVISIBLE);
AbandonChannelTask task = new AbandonChannelTask(claimIds, bigLoading, Lbryio.AUTH_TOKEN, new AbandonHandler() {
@Override
public void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors) {
View root = getView();
if (root != null) {
if (failedClaimIds.size() > 0) {
Snackbar.make(root, R.string.one_or_more_channels_failed_abandon, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
} else if (successfulClaimIds.size() == claimIds.size()) {
try {
String message = getResources().getQuantityString(R.plurals.channels_deleted, successfulClaimIds.size());
Snackbar.make(root, message, Snackbar.LENGTH_LONG).show();
} catch (IllegalStateException ex) {
// pass
}
}
}
Lbry.abandonedClaimIds.addAll(successfulClaimIds);
if (adapter != null) {
adapter.setItems(Helper.filterDeletedClaims(adapter.getItems()));
}
Helper.setViewVisibility(channelList, View.VISIBLE);
Helper.setViewVisibility(fabNewChannel, View.VISIBLE);
checkNoChannels();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations