From a11f74f6a5dd2f55ad40b9091904f2ce8ae00357 Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Tue, 13 Nov 2018 22:30:51 -0400 Subject: [PATCH] - Now the send fragment reads bitcoin alike URI --- .../fragments/SendTransactionFragment.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index d60a221..be671e9 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -68,6 +68,7 @@ import cy.agorise.crystalwallet.enums.CryptoCoin; import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.requestmanagers.BitcoinSendRequest; +import cy.agorise.crystalwallet.requestmanagers.BitcoinUriParseRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; @@ -809,18 +810,21 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat } //Is not a bitshares QR - /*BitcoinUriParseRequest bitcoinUriParseRequest = new BitcoinUriParseRequest(result.getText()); + CryptoCoin cryptoCoin = CryptoCoin.getByCryptoNet(this.cryptoNetAccount.getCryptoNet()).get(0); + final BitcoinUriParseRequest bitcoinUriParseRequest = new BitcoinUriParseRequest(result.getText(), cryptoCoin); bitcoinUriParseRequest.setListener(new CryptoNetInfoRequestListener() { @Override public void onCarryOut() { if (bitcoinUriParseRequest.getAddress() != null) { - try { - crystalDialog.dismiss(); - thisFragment.dismiss(); - //thisFragment.finalize(); - } catch (Throwable throwable) { - throwable.printStackTrace(); + if (!bitcoinUriParseRequest.getAddress().equals("")) { + etTo.setText(bitcoinUriParseRequest.getAddress()); + } + if (bitcoinUriParseRequest.getAmount() > 0) { + etAmount.setText(bitcoinUriParseRequest.getAmount().toString()); + } + if (!bitcoinUriParseRequest.getMemo().equals("")) { + etMemo.setText(bitcoinUriParseRequest.getMemo()); } } else { Toast.makeText(getContext(), "Not a valid QR info", Toast.LENGTH_LONG); @@ -828,6 +832,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat } }); - CryptoNetInfoRequests.getInstance().addRequest(bitcoinUriParseRequest);*/ + CryptoNetInfoRequests.getInstance().addRequest(bitcoinUriParseRequest); } } \ No newline at end of file