use of com.odysee.app.adapter.TransactionListAdapter in project odysee-android by OdyseeTeam.
the class TransactionHistoryFragment method loadTransactions.
private void loadTransactions() {
currentTransactionPage = currentTransactionPage == 0 ? 1 : currentTransactionPage;
transactionsLoading = true;
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, Lbryio.AUTH_TOKEN, loading, new TransactionListTask.TransactionListHandler() {
@Override
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
Context context = getContext();
transactionsLoading = false;
transactionsHaveReachedEnd = hasReachedEnd;
if (context != null) {
if (adapter == null) {
adapter = new TransactionListAdapter(transactions, context);
adapter.setListener(TransactionHistoryFragment.this);
if (transactionList != null) {
transactionList.setAdapter(adapter);
}
} else {
adapter.addTransactions(transactions);
}
}
checkNoTransactions();
}
@Override
public void onError(Exception error) {
transactionsLoading = false;
checkNoTransactions();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of com.odysee.app.adapter.TransactionListAdapter in project odysee-android by OdyseeTeam.
the class WalletFragment method fetchRecentTransactions.
private void fetchRecentTransactions(boolean forceFetch) {
if (!Helper.isSignedIn(getContext())) {
return;
}
if (hasFetchedRecentTransactions && !forceFetch) {
return;
}
Helper.setViewVisibility(textNoRecentTransactions, View.GONE);
AccountManager am = AccountManager.get(getContext());
Account[] accounts = am.getAccounts();
TransactionListTask task = new TransactionListTask(1, 5, am.peekAuthToken(Helper.getOdyseeAccount(accounts), "auth_token_type"), loadingRecentContainer, new TransactionListTask.TransactionListHandler() {
@Override
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
hasFetchedRecentTransactions = true;
recentTransactionsAdapter = new TransactionListAdapter(transactions, getContext());
recentTransactionsAdapter.setListener(new TransactionListAdapter.TransactionClickListener() {
@Override
public void onTransactionClicked(Transaction transaction) {
}
@Override
public void onClaimUrlClicked(LbryUri uri) {
Context context = getContext();
if (uri != null && context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (uri.isChannel()) {
activity.openChannelUrl(uri.toString());
} else {
activity.openFileUrl(uri.toString());
}
}
}
});
recentTransactionsList.setAdapter(recentTransactionsAdapter);
displayNoRecentTransactions();
}
@Override
public void onError(Exception error) {
hasFetchedRecentTransactions = true;
displayNoRecentTransactions();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations