use of com.odysee.app.tasks.claim.PurchaseListTask in project odysee-android by OdyseeTeam.
the class FileViewFragment method checkAndConfirmPurchaseUrl.
private void checkAndConfirmPurchaseUrl() {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (actualClaim != null) {
PurchaseListTask task = new PurchaseListTask(actualClaim.getClaimId(), null, new ClaimSearchResultHandler() {
@Override
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
boolean purchased = false;
if (claims.size() == 1) {
Claim purchasedClaim = claims.get(0);
if (actualClaim.getClaimId().equalsIgnoreCase(purchasedClaim.getClaimId())) {
// already purchased
purchased = true;
}
}
if (purchased) {
handleMainActionForClaim();
} else {
restoreMainActionButton();
confirmPurchaseUrl();
}
}
@Override
public void onError(Exception error) {
// pass
restoreMainActionButton();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
use of com.odysee.app.tasks.claim.PurchaseListTask in project odysee-android by OdyseeTeam.
the class LibraryFragment method fetchPurchases.
private void fetchPurchases() {
contentListLoading = true;
Helper.setViewVisibility(linkStats, View.GONE);
Helper.setViewVisibility(layoutListEmpty, View.GONE);
PurchaseListTask task = new PurchaseListTask(currentPage, PAGE_SIZE, listLoading, new ClaimSearchResultHandler() {
@Override
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
listReachedEnd = hasReachedEnd;
if (contentListAdapter == null) {
initContentListAdapter(claims);
} else {
contentListAdapter.addItems(claims);
}
if (contentListAdapter != null && contentList.getAdapter() == null) {
contentList.setAdapter(contentListAdapter);
}
checkListEmpty();
contentListLoading = false;
}
@Override
public void onError(Exception error) {
checkStatsLink();
checkListEmpty();
contentListLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations