Updated on 2026-08-14

This commit is contained in:
Tangem 2018-10-04 13:11:02 +03:00
commit 23ed2c949c
13 changed files with 50 additions and 86 deletions

View file

@ -11,6 +11,7 @@ import com.tangem.presentation.activity.ConfirmPaymentActivity;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -29,15 +30,11 @@ public class ConnectFeeTask extends FeeTask {
for (FeeRequest request : requests) { for (FeeRequest request : requests) {
if (request.error == null) { if (request.error == null) {
long minFeeRate = 0; BigDecimal Fee = BigDecimal.ZERO;
try { try {
try { try {
String tmpAnswer = request.getAsString(); String tmpAnswer = request.getAsString();
BigDecimal minFeeBD = new BigDecimal(tmpAnswer); Fee = new BigDecimal(tmpAnswer); // BTC per 1 kb
BigDecimal multiplicator = new BigDecimal("100000000");
minFeeBD = minFeeBD.multiply(multiplicator);
BigInteger minFeeBI = minFeeBD.toBigInteger();
minFeeRate = minFeeBI.longValue();
} catch (Exception e) { } catch (Exception e) {
if (sharedCounter != null) { if (sharedCounter != null) {
@ -57,7 +54,7 @@ public class ConnectFeeTask extends FeeTask {
return; return;
} }
if (minFeeRate == 0) { if (Fee.equals(BigDecimal.ZERO)) {
confirmPaymentActivity.getProgressBar().setVisibility(View.INVISIBLE); confirmPaymentActivity.getProgressBar().setVisibility(View.INVISIBLE);
confirmPaymentActivity.finishActivityWithError(Activity.RESULT_CANCELED, "Cannot calculate fee! Wrong data received from the node"); confirmPaymentActivity.finishActivityWithError(Activity.RESULT_CANCELED, "Cannot calculate fee! Wrong data received from the node");
return; return;
@ -66,9 +63,9 @@ public class ConnectFeeTask extends FeeTask {
long inputCount = request.txSize; long inputCount = request.txSize;
if (inputCount != 0) { if (inputCount != 0) {
minFeeRate = minFeeRate * inputCount; Fee = Fee.multiply(new BigDecimal(inputCount)).divide(new BigDecimal(1024)); // per Kb -> per byte
} else { } else {
minFeeRate = minFeeRate * 256; confirmPaymentActivity.finishActivityWithError(Activity.RESULT_CANCELED, "Cannot calculate fee! Tx length unknown");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -87,17 +84,19 @@ public class ConnectFeeTask extends FeeTask {
confirmPaymentActivity.getProgressBar().setVisibility(View.INVISIBLE); confirmPaymentActivity.getProgressBar().setVisibility(View.INVISIBLE);
float finalFee = (float) minFeeRate / (float) 10000; DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(7);
finalFee = Math.round(finalFee) / (float) 10000; df.setMinimumFractionDigits(3);
df.setGroupingUsed(false);
String strFee = df.format(Fee);
if ((request.getBlockCount() == FeeRequest.MINIMAL) && (confirmPaymentActivity.getMinFee() == null)) { if ((request.getBlockCount() == FeeRequest.MINIMAL) && (confirmPaymentActivity.getMinFee() == null)) {
confirmPaymentActivity.setMinFee(String.valueOf(finalFee)); confirmPaymentActivity.setMinFee(strFee);
confirmPaymentActivity.setMinFeeInInternalUnits(confirmPaymentActivity.getCard().internalUnitsFromString(String.valueOf(finalFee))); confirmPaymentActivity.setMinFeeInInternalUnits(confirmPaymentActivity.getCard().internalUnitsFromString(strFee));
} else if ((request.getBlockCount() == FeeRequest.NORMAL) && (confirmPaymentActivity.getNormalFee() == null)) { } else if ((request.getBlockCount() == FeeRequest.NORMAL) && (confirmPaymentActivity.getNormalFee() == null)) {
confirmPaymentActivity.setNormalFee(String.valueOf(finalFee)); confirmPaymentActivity.setNormalFee(strFee);
} else if ((request.getBlockCount() == FeeRequest.PRIORITY) && (confirmPaymentActivity.getMaxFee() == null)) { } else if ((request.getBlockCount() == FeeRequest.PRIORITY) && (confirmPaymentActivity.getMaxFee() == null)) {
confirmPaymentActivity.setMaxFee(String.valueOf(finalFee)); confirmPaymentActivity.setMaxFee(strFee);
} }
confirmPaymentActivity.doSetFee(confirmPaymentActivity.getRgFee().getCheckedRadioButtonId()); confirmPaymentActivity.doSetFee(confirmPaymentActivity.getRgFee().getCheckedRadioButtonId());

View file

@ -230,7 +230,7 @@ public class BtcCashEngine extends CoinEngine {
public String getBalanceValue(TangemCard mCard) { public String getBalanceValue(TangemCard mCard) {
if (mCard.hasBalanceInfo()) { if (mCard.hasBalanceInfo()) {
Double balance = mCard.getBalance() / (mCard.getBlockchain().getMultiplier() / 1000.0); Double balance = mCard.getBalance() / (mCard.getBlockchain().getMultiplier());
String output = FormatUtil.DoubleToString(balance); String output = FormatUtil.DoubleToString(balance);
//String pattern = "#0.000"; // If you like 4 zeros //String pattern = "#0.000"; // If you like 4 zeros
@ -283,7 +283,7 @@ public class BtcCashEngine extends CoinEngine {
public String convertByteArrayToAmount(TangemCard mCard, byte[] bytes) throws Exception { public String convertByteArrayToAmount(TangemCard mCard, byte[] bytes) throws Exception {
byte[] reversed = new byte[bytes.length]; byte[] reversed = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) reversed[i] = bytes[bytes.length - i - 1]; for (int i = 0; i < bytes.length; i++) reversed[i] = bytes[bytes.length - i - 1];
return FormatUtil.DoubleToString(1000.0 * mCard.AmountFromInternalUnits(Util.byteArrayToLong(reversed))); return FormatUtil.DoubleToString(mCard.AmountFromInternalUnits(Util.byteArrayToLong(reversed)));
} }
@Override @Override
@ -296,7 +296,7 @@ public class BtcCashEngine extends CoinEngine {
@Override @Override
public String getAmountDescription(TangemCard mCard, String amount) throws Exception { public String getAmountDescription(TangemCard mCard, String amount) throws Exception {
return mCard.getAmountDescription(Double.parseDouble(amount) / 1000.0); return mCard.getAmountDescription(Double.parseDouble(amount));
} }
public static String getAmountEquivalentDescriptionBTC(Double amount, float rate) { public static String getAmountEquivalentDescriptionBTC(Double amount, float rate) {
@ -308,7 +308,7 @@ public class BtcCashEngine extends CoinEngine {
} }
public String getAmountEquivalentDescriptor(TangemCard mCard, String value) { public String getAmountEquivalentDescriptor(TangemCard mCard, String value) {
return getAmountEquivalentDescriptionBTC(Double.parseDouble(value) / 1000.0, mCard.getRate()); return getAmountEquivalentDescriptionBTC(Double.parseDouble(value), mCard.getRate());
} }
public byte[] sign(String feeValue, String amountValue, boolean IncFee, String toValue, TangemCard mCard, CardProtocol protocol) throws Exception { public byte[] sign(String feeValue, String amountValue, boolean IncFee, String toValue, TangemCard mCard, CardProtocol protocol) throws Exception {

View file

@ -276,7 +276,7 @@ public class BtcEngine extends CoinEngine {
} }
public String getBalanceCurrency(TangemCard card) { public String getBalanceCurrency(TangemCard card) {
return "mBTC"; return "BTC";
} }
public boolean checkUnspentTransaction(TangemCard mCard) { public boolean checkUnspentTransaction(TangemCard mCard) {
@ -284,7 +284,7 @@ public class BtcEngine extends CoinEngine {
} }
public String getFeeCurrency() { public String getFeeCurrency() {
return "mBTC"; return "BTC";
} }
public boolean validateAddress(String address, TangemCard card) { public boolean validateAddress(String address, TangemCard card) {
@ -413,7 +413,7 @@ public class BtcEngine extends CoinEngine {
public String getBalanceValue(TangemCard mCard) { public String getBalanceValue(TangemCard mCard) {
if (mCard.hasBalanceInfo()) { if (mCard.hasBalanceInfo()) {
Double balance = mCard.getBalance() / (mCard.getBlockchain().getMultiplier() / 1000.0); Double balance = mCard.getBalance() / (mCard.getBlockchain().getMultiplier());
String output = FormatUtil.DoubleToString(balance); String output = FormatUtil.DoubleToString(balance);
//String pattern = "#0.000"; // If you like 4 zeros //String pattern = "#0.000"; // If you like 4 zeros
@ -467,7 +467,7 @@ public class BtcEngine extends CoinEngine {
if (bytes == null) return ""; if (bytes == null) return "";
byte[] reversed = new byte[bytes.length]; byte[] reversed = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) reversed[i] = bytes[bytes.length - i - 1]; for (int i = 0; i < bytes.length; i++) reversed[i] = bytes[bytes.length - i - 1];
return FormatUtil.DoubleToString(1000.0 * mCard.AmountFromInternalUnits(Util.byteArrayToLong(reversed))); return FormatUtil.DoubleToString(mCard.AmountFromInternalUnits(Util.byteArrayToLong(reversed)));
} }
@Override @Override
@ -480,7 +480,7 @@ public class BtcEngine extends CoinEngine {
@Override @Override
public String getAmountDescription(TangemCard mCard, String amount) throws Exception { public String getAmountDescription(TangemCard mCard, String amount) throws Exception {
return mCard.getAmountDescription(Double.parseDouble(amount) / 1000.0); return mCard.getAmountDescription(Double.parseDouble(amount));
} }
public static String getAmountEquivalentDescriptionBTC(Double amount, float rate) { public static String getAmountEquivalentDescriptionBTC(Double amount, float rate) {
@ -492,7 +492,7 @@ public class BtcEngine extends CoinEngine {
} }
public String getAmountEquivalentDescriptor(TangemCard mCard, String value) { public String getAmountEquivalentDescriptor(TangemCard mCard, String value) {
return getAmountEquivalentDescriptionBTC(Double.parseDouble(value) / 1000.0, mCard.getRate()); return getAmountEquivalentDescriptionBTC(Double.parseDouble(value), mCard.getRate());
} }
public byte[] sign(String feeValue, String amountValue, boolean IncFee, String toValue, TangemCard mCard, CardProtocol protocol) throws Exception { public byte[] sign(String feeValue, String amountValue, boolean IncFee, String toValue, TangemCard mCard, CardProtocol protocol) throws Exception {

View file

@ -193,23 +193,8 @@ public class TangemCard {
} }
public String getAmountDescription(Double amount) { public String getAmountDescription(Double amount) {
if (amount < 10) { String output = FormatUtil.DoubleToString(amount);
amount *= 1000.0; //todo: really? return output + " " + getBlockchain().getCurrency();
//String pattern = "#0.000"; // If you like 4 zeros
//DecimalFormat myFormatter = new DecimalFormat(pattern);
//String output = myFormatter.format(amount);
String output = FormatUtil.DoubleToString(amount);
return output + " m" + getBlockchain().getCurrency();
//return String.format("%.3f m%s", amount, getBlockchain().getCurrency());
} else {
//return String.format("%.3f %s", amount, getBlockchain().getCurrency());
String output = FormatUtil.DoubleToString(amount);
return output + " " + getBlockchain().getCurrency();
}
} }
public String getAmountEquivalentDescription(Double amount) { public String getAmountEquivalentDescription(Double amount) {

View file

@ -264,7 +264,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
minFee = minFeeInGwei minFee = minFeeInGwei
normalFee = normalFeeInGwei normalFee = normalFeeInGwei
maxFee = maxFeeInGwei maxFee = maxFeeInGwei
etFee!!.setText(normalFeeInGwei) etFee!!.setText(normalFeeInGwei.replace(',','.'))
etFee!!.error = null etFee!!.error = null
btnSend!!.visibility = View.VISIBLE btnSend!!.visibility = View.VISIBLE
feeRequestSuccess = true feeRequestSuccess = true
@ -449,23 +449,25 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
} }
fun doSetFee(checkedRadioButtonId: Int) { fun doSetFee(checkedRadioButtonId: Int) {
var txtFee = ""
when (checkedRadioButtonId) { when (checkedRadioButtonId) {
R.id.rbMinimalFee -> R.id.rbMinimalFee ->
if (minFee != null) if (minFee != null)
etFee!!.setText(minFee) txtFee = minFee.toString()
else else
etFee!!.setText("?") finishActivityWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
R.id.rbNormalFee -> R.id.rbNormalFee ->
if (normalFee != null) if (normalFee != null)
etFee!!.setText(normalFee) txtFee = normalFee.toString()
else else
etFee!!.setText("?") finishActivityWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
R.id.rbMaximumFee -> R.id.rbMaximumFee ->
if (maxFee != null) if (maxFee != null)
etFee!!.setText(maxFee) txtFee = maxFee.toString()
else else
etFee!!.setText("?") finishActivityWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
} }
etFee!!.setText(txtFee.replace(',','.'))
} }
} }

View file

@ -30,7 +30,6 @@ class PrepareCryptonitOtherAPIWithdrawalActivity : AppCompatActivity(), NfcAdapt
private const val REQUEST_CODE_SCAN_QR_USER_ID = 3 private const val REQUEST_CODE_SCAN_QR_USER_ID = 3
} }
private var useCurrencyX1000: Boolean = false
private var card: TangemCard? = null private var card: TangemCard? = null
private var nfcManager: NfcManager? = null private var nfcManager: NfcManager? = null
private var cryptonit: Cryptonit_OtherAPI? = null private var cryptonit: Cryptonit_OtherAPI? = null
@ -61,16 +60,12 @@ class PrepareCryptonitOtherAPIWithdrawalActivity : AppCompatActivity(), NfcAdapt
when (card!!.blockchain) { when (card!!.blockchain) {
Blockchain.Ethereum, Blockchain.EthereumTestNet -> { Blockchain.Ethereum, Blockchain.EthereumTestNet -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
Blockchain.Bitcoin, Blockchain.BitcoinTestNet, Blockchain.BitcoinCash, Blockchain.BitcoinCashTestNet -> { Blockchain.Bitcoin, Blockchain.BitcoinTestNet, Blockchain.BitcoinCash, Blockchain.BitcoinCashTestNet -> {
tvCurrency.text = "m" + card!!.blockchain.currency tvCurrency.text = card!!.blockchain.currency
useCurrencyX1000 = true
} }
else -> { else -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
} }
@ -94,7 +89,6 @@ class PrepareCryptonitOtherAPIWithdrawalActivity : AppCompatActivity(), NfcAdapt
// if (!engine.checkAmount(card, strAmount)) // if (!engine.checkAmount(card, strAmount))
// etAmount.error = getString(R.string.unknown_amount_format) // etAmount.error = getString(R.string.unknown_amount_format)
var dblAmount: Double = strAmount.toDouble() var dblAmount: Double = strAmount.toDouble()
if (useCurrencyX1000) dblAmount /= 1000.0
rlProgressBar.visibility = View.VISIBLE rlProgressBar.visibility = View.VISIBLE
tvProgressDescription.text = getString(R.string.cryptonit_request_withdrawal) tvProgressDescription.text = getString(R.string.cryptonit_request_withdrawal)

View file

@ -29,7 +29,6 @@ class PrepareCryptonitWithdrawalActivity : AppCompatActivity(), NfcAdapter.Reade
val TAG: String = PrepareCryptonitWithdrawalActivity::class.java.simpleName val TAG: String = PrepareCryptonitWithdrawalActivity::class.java.simpleName
} }
private var useCurrencyX1000: Boolean = false
private var card: TangemCard? = null private var card: TangemCard? = null
private var nfcManager: NfcManager? = null private var nfcManager: NfcManager? = null
private var cryptonit: Cryptonit? = null private var cryptonit: Cryptonit? = null
@ -60,16 +59,12 @@ class PrepareCryptonitWithdrawalActivity : AppCompatActivity(), NfcAdapter.Reade
when (card!!.blockchain) { when (card!!.blockchain) {
Blockchain.Ethereum -> { Blockchain.Ethereum -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
Blockchain.Bitcoin, Blockchain.BitcoinCash -> { Blockchain.Bitcoin, Blockchain.BitcoinCash -> {
tvCurrency.text = "m" + card!!.blockchain.currency tvCurrency.text = card!!.blockchain.currency
useCurrencyX1000 = true
} }
else -> { else -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
} }
tvFeeCurrency.text = tvCurrency.text tvFeeCurrency.text = tvCurrency.text
@ -109,10 +104,6 @@ class PrepareCryptonitWithdrawalActivity : AppCompatActivity(), NfcAdapter.Reade
val strFee: String = etFee.text.toString().replace(",", ".") val strFee: String = etFee.text.toString().replace(",", ".")
var dblAmount: Double = strAmount.toDouble() var dblAmount: Double = strAmount.toDouble()
var dblFee: Double = strFee.toDouble() var dblFee: Double = strFee.toDouble()
if (useCurrencyX1000){
dblAmount /= 1000.0
dblFee /= 1000.0
}
cryptonit!!.fee=strFee cryptonit!!.fee=strFee
rlProgressBar.visibility = View.VISIBLE rlProgressBar.visibility = View.VISIBLE

View file

@ -37,7 +37,6 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
private const val REQUEST_CODE_SCAN_QR = 1 private const val REQUEST_CODE_SCAN_QR = 1
} }
private var useCurrencyX1000: Boolean = false
private var card: TangemCard? = null private var card: TangemCard? = null
private var nfcManager: NfcManager? = null private var nfcManager: NfcManager? = null
private var kraken: Kraken? = null private var kraken: Kraken? = null
@ -67,16 +66,13 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
when (card!!.blockchain) { when (card!!.blockchain) {
Blockchain.Ethereum, Blockchain.EthereumTestNet -> { Blockchain.Ethereum, Blockchain.EthereumTestNet -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
Blockchain.Bitcoin, Blockchain.BitcoinTestNet, Blockchain.BitcoinCash, Blockchain.BitcoinCashTestNet -> { Blockchain.Bitcoin, Blockchain.BitcoinTestNet, Blockchain.BitcoinCash, Blockchain.BitcoinCashTestNet -> {
tvCurrency.text = "m" + card!!.blockchain.currency tvCurrency.text = card!!.blockchain.currency
useCurrencyX1000 = true
} }
else -> { else -> {
tvCurrency.text = engine.getBalanceCurrency(card) tvCurrency.text = engine.getBalanceCurrency(card)
useCurrencyX1000 = false
} }
} }
@ -110,8 +106,6 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
val strAmount: String = etAmount.text.toString().replace(",", ".") val strAmount: String = etAmount.text.toString().replace(",", ".")
var dblAmount: Double = strAmount.toDouble() var dblAmount: Double = strAmount.toDouble()
if (useCurrencyX1000) dblAmount /= 1000.0
rlProgressBar.visibility = View.VISIBLE rlProgressBar.visibility = View.VISIBLE
tvProgressDescription.text = getString(R.string.kraken_request_withdrawal) tvProgressDescription.text = getString(R.string.kraken_request_withdrawal)
@ -206,7 +200,6 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
val strAmount: String = etAmount.text.toString().replace(",", ".") val strAmount: String = etAmount.text.toString().replace(",", ".")
var dblAmount: Double = strAmount.toDouble() var dblAmount: Double = strAmount.toDouble()
if (useCurrencyX1000) dblAmount /= 1000.0
dblAmount+=fee!!.toDouble() dblAmount+=fee!!.toDouble()

View file

@ -72,8 +72,8 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
// Bitcoin BitcoinTestNet // Bitcoin BitcoinTestNet
else if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) { else if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) {
val balance = engine.getBalanceLong(card)!! / (card!!.blockchain.multiplier / 1000.0) val balance = engine.getBalanceLong(card)!! / (card!!.blockchain.multiplier)
tvCurrency.text = "m" + card!!.blockchain.currency tvCurrency.text = card!!.blockchain.currency
useCurrency = true useCurrency = true
val output = FormatUtil.DoubleToString(balance) val output = FormatUtil.DoubleToString(balance)
etAmount.setText(output) etAmount.setText(output)
@ -81,8 +81,8 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
// BitcoinCash BitcoinCashTestNet // BitcoinCash BitcoinCashTestNet
else if (card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) { else if (card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) {
val balance = engine.getBalanceLong(card)!! / (card!!.blockchain.multiplier / 1000.0) val balance = engine.getBalanceLong(card)!! / (card!!.blockchain.multiplier)
tvCurrency.text = "m" + card!!.blockchain.currency tvCurrency.text = card!!.blockchain.currency
useCurrency = true useCurrency = true
val output = FormatUtil.DoubleToString(balance) val output = FormatUtil.DoubleToString(balance)
} else { } else {
@ -92,7 +92,7 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
} }
if (card!!.blockchain == Blockchain.Bitcoin) if (card!!.blockchain == Blockchain.Bitcoin)
etAmount.filters = arrayOf<InputFilter>(DecimalDigitsInputFilter(5)) etAmount.filters = arrayOf<InputFilter>(DecimalDigitsInputFilter(8))
if (card!!.blockchain == Blockchain.BitcoinCash) if (card!!.blockchain == Blockchain.BitcoinCash)
etAmount.filters = arrayOf<InputFilter>(DecimalDigitsInputFilter(8)) etAmount.filters = arrayOf<InputFilter>(DecimalDigitsInputFilter(8))

View file

@ -25,7 +25,7 @@ public class FormatUtil {
DecimalFormatSymbols symbols = new DecimalFormatSymbols(); DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator('.'); symbols.setDecimalSeparator('.');
String pattern = "#0.######"; String pattern = "#0.########";
// DecimalFormat myFormatter = new DecimalFormat(pattern, symbols); // DecimalFormat myFormatter = new DecimalFormat(pattern, symbols);
DecimalFormat myFormatter = new DecimalFormat(pattern); DecimalFormat myFormatter = new DecimalFormat(pattern);
@ -77,7 +77,7 @@ public class FormatUtil {
public static long ConvertStringToLong(String caption) throws Exception { public static long ConvertStringToLong(String caption) throws Exception {
// BigDecimal d = new BigDecimal(caption); // BigDecimal d = new BigDecimal(caption);
BigDecimal d = stringToBigDecimal(caption,Locale.US); BigDecimal d = stringToBigDecimal(caption,Locale.US);
d = d.multiply(new BigDecimal(100000)); d = d.multiply(new BigDecimal(100000000));
d = d.setScale(5); d = d.setScale(5);
BigInteger b = d.toBigInteger(); BigInteger b = d.toBigInteger();
long l = b.longValue(); long l = b.longValue();

View file

@ -75,7 +75,7 @@
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/text_size_medium" android:textSize="@dimen/text_size_medium"
android:textStyle="bold" android:textStyle="bold"
tools:text="4.51735 mBTC" /> tools:text="4.51735 BTC" />
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -275,7 +275,7 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="150dp"/> app:layout_constraintWidth_min="150dp" />
<TextView <TextView
android:id="@+id/tvCurrency2" android:id="@+id/tvCurrency2"

View file

@ -85,7 +85,7 @@
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/text_size_medium" android:textSize="@dimen/text_size_medium"
android:textStyle="bold" android:textStyle="bold"
tools:text="4.51735 mBtc"/> tools:text="4.51735 Btc"/>
</LinearLayout> </LinearLayout>

View file

@ -41,7 +41,7 @@
<string name="send_to_wallet">Send to wallet</string> <string name="send_to_wallet">Send to wallet</string>
<string name="amount">Amount</string> <string name="amount">Amount</string>
<!--<string name="including_fee">(including fee)</string>--> <!--<string name="including_fee">(including fee)</string>-->
<string name="m_btc">mBTC</string> <string name="m_btc">BTC</string>
<string name="scan_again_to_verify_the_card">Scan again to verify the card</string> <string name="scan_again_to_verify_the_card">Scan again to verify the card</string>
<string name="smart_cash_ag">Smart Cash AG</string> <string name="smart_cash_ag">Smart Cash AG</string>
<string name="wallet">Wallet</string> <string name="wallet">Wallet</string>