mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-26 15:52:28 +00:00
Fix sendAll bug
This commit is contained in:
parent
569e1e5f5b
commit
6674f894b7
1 changed files with 5 additions and 4 deletions
|
@ -56,21 +56,22 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
});
|
||||
|
||||
sendButton.setOnClickListener(view1 -> {
|
||||
boolean sendAll = sendingMax.getValue() != null ? sendingMax.getValue() : false;
|
||||
String address = addressEditText.getText().toString().trim();
|
||||
String amount = amountEditText.getText().toString().trim();
|
||||
boolean validAddress = Wallet.isAddressValid(address);
|
||||
if (validAddress && !amount.isEmpty()) {
|
||||
if (validAddress && (!amount.isEmpty() || sendAll)) {
|
||||
long amountRaw = Wallet.getAmountFromString(amount);
|
||||
long balance = BalanceService.getInstance().getUnlockedBalanceRaw();
|
||||
if(amountRaw >= balance || amountRaw <= 0) {
|
||||
if((amountRaw >= balance || amountRaw <= 0) && !sendAll) {
|
||||
Toast.makeText(getActivity(), getString(R.string.send_amount_invalid), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
sendButton.setEnabled(false);
|
||||
boolean sendAll = sendingMax.getValue() != null ? sendingMax.getValue() : false;
|
||||
TxService.getInstance().sendTx(address, amount, sendAll);
|
||||
} else if (!validAddress) {
|
||||
Toast.makeText(getActivity(), getString(R.string.send_address_invalid), Toast.LENGTH_SHORT).show();
|
||||
} else if (amount.isEmpty()) {
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.send_amount_empty), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue