@Override public void onErrorOccurred(Exception ex) { isRefreshing = false; if (isAttached) { swipeRefreshLayout.setRefreshing(false); CommonLogger.exception(TAG, ex.getMessage(), ex); } }
@Override public List<GrouperItem> getMoreDataAsync(FermatRefreshTypes refreshType, int pos) { ArrayList<GrouperItem> data = new ArrayList<>(); String grouperText; if (moduleManager != null) { GrouperItem<CustomerBrokerNegotiationInformation> grouper; List<CustomerBrokerNegotiationInformation> waitingForBroker = new ArrayList<>(); List<CustomerBrokerNegotiationInformation> waitingForCustomer = new ArrayList<>(); try { waitingForBroker.addAll(walletManager.getNegotiationsWaitingForBroker(0, 10)); waitingForCustomer.addAll(walletManager.getNegotiationsWaitingForCustomer(0, 10)); if (!waitingForBroker.isEmpty() || !waitingForCustomer.isEmpty()) { grouperText = getActivity().getString(R.string.waiting_for_you); grouper = new GrouperItem<>(grouperText, waitingForBroker, true); data.add(grouper); grouperText = getActivity().getString(R.string.waiting_for_the_customer); grouper = new GrouperItem<>(grouperText, waitingForCustomer, true); data.add(grouper); } } catch (Exception ex) { CommonLogger.exception(TAG, ex.getMessage(), ex); if (errorManager != null) { errorManager.reportUnexpectedWalletException( Wallets.CBP_CRYPTO_BROKER_WALLET, UnexpectedWalletExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_FRAGMENT, ex); } } } else { Toast.makeText( getActivity(), "Sorry, an error happened OpenNegotiationsTabFragment (Module == null)", Toast.LENGTH_SHORT) .show(); } return data; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { moduleManager = ((CryptoBrokerWalletSession) appSession).getModuleManager(); walletManager = moduleManager.getCryptoBrokerWallet(appSession.getAppPublicKey()); errorManager = appSession.getErrorManager(); } catch (Exception ex) { CommonLogger.exception(TAG, ex.getMessage(), ex); if (errorManager != null) errorManager.reportUnexpectedWalletException( Wallets.CBP_CRYPTO_BROKER_WALLET, UnexpectedWalletExceptionSeverity.DISABLES_THIS_FRAGMENT, ex); } openNegotiationList = getMoreDataAsync(FermatRefreshTypes.NEW, 0); }