@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { AvailableAccountsAdaptor.Entry entry = (AvailableAccountsAdaptor.Entry) parent.getSelectedItem(); if (entry.accountOrCoinType instanceof WalletAccount) { WalletAccount newSource = (WalletAccount) entry.accountOrCoinType; // If same account selected, do nothing if (newSource.equals(sourceAccount)) return; // If new source and destination are the same, swap accounts if (destinationAccount != null && destinationAccount.isType(newSource)) { // Swap accounts setDestinationSpinner(sourceAccount); setDestination(sourceAccount, false); } setSource(newSource, true); } else { // Should not happen as "source" is always an account throw new IllegalStateException("Unexpected class: " + entry.accountOrCoinType.getClass()); } }
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { AvailableAccountsAdaptor.Entry entry = (AvailableAccountsAdaptor.Entry) parent.getSelectedItem(); if (entry.accountOrCoinType instanceof WalletAccount) { WalletAccount newDestination = (WalletAccount) entry.accountOrCoinType; // If same account selected, do nothing if (newDestination.equals(destinationAccount)) return; // If new destination and source are the same, swap accounts if (destinationAccount != null && sourceAccount.isType(newDestination)) { // Swap accounts setSourceSpinner(destinationAccount); setSource(destinationAccount, false); } setDestination(newDestination, true); } else if (entry.accountOrCoinType instanceof CoinType) { setDestination((CoinType) entry.accountOrCoinType, true); } else { // Should not happen throw new IllegalStateException("Unexpected class: " + entry.accountOrCoinType.getClass()); } }
private void startOrStopMarketRatePolling() { if (address != null && !account.isType(address)) { String pair = ShapeShift.getPair(account.getCoinType(), address.getType()); if (timer == null) { startPolling(pair); } else { pollTask.updatePair(pair); } } else if (timer != null) { stopPolling(); } }
boolean canExchange = false; for (WalletAccount account : app.getAllAccounts()) { if (!account.isType(type) && account.getBalance().isPositive()) { addPayWithAccountRow(exchangeAccounts, account, uri); canExchange = true;