Display the unconfirmed amount in the chosen currency (#844)

Changed the translations accordingly
This commit is contained in:
Kartal Kaan Bozdoğan 2022-10-22 11:59:25 +03:00 committed by GitHub
parent ef3ddbac71
commit 3610781f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 50 additions and 46 deletions

View File

@ -118,9 +118,9 @@ public class WalletFragment extends Fragment
tvProgress = view.findViewById(R.id.tvProgress); tvProgress = view.findViewById(R.id.tvProgress);
pbProgress = view.findViewById(R.id.pbProgress); pbProgress = view.findViewById(R.id.pbProgress);
tvBalance = view.findViewById(R.id.tvBalance); tvBalance = view.findViewById(R.id.tvBalance);
showBalance(Helper.getDisplayAmount(0)); showBalance();
tvUnconfirmedAmount = view.findViewById(R.id.tvUnconfirmedAmount); tvUnconfirmedAmount = view.findViewById(R.id.tvUnconfirmedAmount);
showUnconfirmed(0); showUnconfirmed();
ivSynced = view.findViewById(R.id.ivSynced); ivSynced = view.findViewById(R.id.ivSynced);
sCurrency = view.findViewById(R.id.sCurrency); sCurrency = view.findViewById(R.id.sCurrency);
@ -205,7 +205,18 @@ public class WalletFragment extends Fragment
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
} }
void showBalance(String balance) { String amountToString(double amount) {
if (!Helper.BASE_CRYPTO.equals(balanceCurrency)) { // not XMR
double amountB = amount * balanceRate;
return Helper.getFormattedAmount(amountB, false);
} else { // XMR
return Helper.getFormattedAmount(amount, true);
}
}
void showBalance() {
double amountA = Helper.getDecimalAmount(unlockedBalance).doubleValue();
String balance = amountToString(amountA);
tvBalance.setText(balance); tvBalance.setText(balance);
final boolean streetMode = activityCallback.isStreetMode(); final boolean streetMode = activityCallback.isStreetMode();
if (!streetMode) { if (!streetMode) {
@ -218,13 +229,14 @@ public class WalletFragment extends Fragment
setStreetModeBackground(streetMode); setStreetModeBackground(streetMode);
} }
void showUnconfirmed(double unconfirmedAmount) { void showUnconfirmed() {
double unconfirmedAmount = Helper.getDecimalAmount(balance - unlockedBalance).doubleValue();
if (activityCallback.isStreetMode() || unconfirmedAmount == 0) { if (activityCallback.isStreetMode() || unconfirmedAmount == 0) {
tvUnconfirmedAmount.setText(null); tvUnconfirmedAmount.setText(null);
tvUnconfirmedAmount.setVisibility(View.GONE); tvUnconfirmedAmount.setVisibility(View.GONE);
} else { } else {
String unconfirmed = Helper.getFormattedAmount(unconfirmedAmount, true); String unconfirmed = amountToString(unconfirmedAmount);
tvUnconfirmedAmount.setText(getResources().getString(R.string.xmr_unconfirmed_amount, unconfirmed)); tvUnconfirmedAmount.setText(getResources().getString(R.string.xmr_unconfirmed_amount, unconfirmed, balanceCurrency));
tvUnconfirmedAmount.setVisibility(View.VISIBLE); tvUnconfirmedAmount.setVisibility(View.VISIBLE);
} }
} }
@ -232,15 +244,8 @@ public class WalletFragment extends Fragment
void updateBalance() { void updateBalance() {
if (isExchanging) return; // wait for exchange to finish - it will fire this itself then. if (isExchanging) return; // wait for exchange to finish - it will fire this itself then.
// at this point selection is XMR in case of error // at this point selection is XMR in case of error
String displayB; showBalance();
double amountA = Helper.getDecimalAmount(unlockedBalance).doubleValue(); showUnconfirmed();
if (!Helper.BASE_CRYPTO.equals(balanceCurrency)) { // not XMR
double amountB = amountA * balanceRate;
displayB = Helper.getFormattedAmount(amountB, false);
} else { // XMR
displayB = Helper.getFormattedAmount(amountA, true);
}
showBalance(displayB);
} }
String balanceCurrency = Helper.BASE_CRYPTO; String balanceCurrency = Helper.BASE_CRYPTO;
@ -249,11 +254,11 @@ public class WalletFragment extends Fragment
private final ExchangeApi exchangeApi = ServiceHelper.getExchangeApi(); private final ExchangeApi exchangeApi = ServiceHelper.getExchangeApi();
void refreshBalance() { void refreshBalance() {
double unconfirmedXmr = Helper.getDecimalAmount(balance - unlockedBalance).doubleValue();
showUnconfirmed(unconfirmedXmr);
if (sCurrency.getSelectedItemPosition() == 0) { // XMR if (sCurrency.getSelectedItemPosition() == 0) { // XMR
double amountXmr = Helper.getDecimalAmount(unlockedBalance).doubleValue(); balanceCurrency = Helper.BASE_CRYPTO;
showBalance(Helper.getFormattedAmount(amountXmr, true)); balanceRate = 1.0;
showBalance();
showUnconfirmed();
} else { // not XMR } else { // not XMR
String currency = (String) sCurrency.getSelectedItem(); String currency = (String) sCurrency.getSelectedItem();
Timber.d(currency); Timber.d(currency);
@ -298,8 +303,7 @@ public class WalletFragment extends Fragment
public void exchangeFailed() { public void exchangeFailed() {
sCurrency.setSelection(0, true); // default to XMR sCurrency.setSelection(0, true); // default to XMR
double amountXmr = Helper.getDecimalAmount(unlockedBalance).doubleValue(); showBalance();
showBalance(Helper.getFormattedAmount(amountXmr, true));
hideExchanging(); hideExchanging();
} }

View File

@ -134,7 +134,7 @@
<string name="label_wallet_receive">Rebre</string> <string name="label_wallet_receive">Rebre</string>
<string name="label_wallet_send">Enviar</string> <string name="label_wallet_send">Enviar</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR sense confirmar</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s sense confirmar</string>
<string name="service_description">Servei de monerujo</string> <string name="service_description">Servei de monerujo</string>

View File

@ -135,7 +135,7 @@
<string name="label_wallet_receive">Empfange</string> <string name="label_wallet_receive">Empfange</string>
<string name="label_wallet_send">Sende</string> <string name="label_wallet_send">Sende</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR unbestätigt</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s unbestätigt</string>
<string name="service_description">monerujo Service</string> <string name="service_description">monerujo Service</string>

View File

@ -123,7 +123,7 @@
<string name="label_wallet_receive">Λήψη</string> <string name="label_wallet_receive">Λήψη</string>
<string name="label_wallet_send">Αποστολή</string> <string name="label_wallet_send">Αποστολή</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR μη επιβεβαιωμένα</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s μη επιβεβαιωμένα</string>
<string name="service_description">Υπηρεσία monerujo</string> <string name="service_description">Υπηρεσία monerujo</string>

View File

@ -134,7 +134,7 @@
<string name="label_wallet_receive">Ricevi</string> <string name="label_wallet_receive">Ricevi</string>
<string name="label_wallet_send">Doni</string> <string name="label_wallet_send">Doni</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR nekonfirmite</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s nekonfirmite</string>
<string name="service_description">monerujo Servo</string> <string name="service_description">monerujo Servo</string>

View File

@ -86,7 +86,7 @@
<string name="label_wallet_receive">Recibir</string> <string name="label_wallet_receive">Recibir</string>
<string name="label_wallet_send">Enviar</string> <string name="label_wallet_send">Enviar</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR sin confirmar</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s sin confirmar</string>
<string name="service_description">Servicio de Monerujo</string> <string name="service_description">Servicio de Monerujo</string>

View File

@ -132,7 +132,7 @@
<string name="label_wallet_receive">Küsi raha</string> <string name="label_wallet_receive">Küsi raha</string>
<string name="label_wallet_send">Saada</string> <string name="label_wallet_send">Saada</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR kinnitamata</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s kinnitamata</string>
<string name="service_description">monerujo teenus</string> <string name="service_description">monerujo teenus</string>

View File

@ -232,7 +232,7 @@
<string name="xmr_unconfirmed_amount"> <string name="xmr_unconfirmed_amount">
مقدار مقدار
+%1$s XMR +%1$s %2$s
تایید نشده است تایید نشده است
</string> </string>

View File

@ -134,7 +134,7 @@
<string name="label_wallet_receive">Recevoir</string> <string name="label_wallet_receive">Recevoir</string>
<string name="label_wallet_send">Envoyer</string> <string name="label_wallet_send">Envoyer</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR non confirmés</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s non confirmés</string>
<string name="service_description">Service monerujo</string> <string name="service_description">Service monerujo</string>

View File

@ -132,7 +132,7 @@
<string name="label_wallet_receive">Fogadás</string> <string name="label_wallet_receive">Fogadás</string>
<string name="label_wallet_send">Küldés</string> <string name="label_wallet_send">Küldés</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR függőben</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s függőben</string>
<string name="service_description">monerujo szolgáltatás</string> <string name="service_description">monerujo szolgáltatás</string>

View File

@ -134,7 +134,7 @@
<string name="label_wallet_receive">Ricevi</string> <string name="label_wallet_receive">Ricevi</string>
<string name="label_wallet_send">Invia</string> <string name="label_wallet_send">Invia</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR non confermati</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s non confermati</string>
<string name="service_description">Servizio monerujo</string> <string name="service_description">Servizio monerujo</string>

View File

@ -134,7 +134,7 @@
<string name="label_wallet_receive">受取り</string> <string name="label_wallet_receive">受取り</string>
<string name="label_wallet_send">送金</string> <string name="label_wallet_send">送金</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR が未承認</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s が未承認</string>
<string name="service_description">monerujo のサービス</string> <string name="service_description">monerujo のサービス</string>

View File

@ -132,7 +132,7 @@
<string name="label_wallet_receive">Motta</string> <string name="label_wallet_receive">Motta</string>
<string name="label_wallet_send">Gi</string> <string name="label_wallet_send">Gi</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR ubekrefta</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s ubekrefta</string>
<string name="service_description">monerujo tjeneste</string> <string name="service_description">monerujo tjeneste</string>

View File

@ -132,7 +132,7 @@
<string name="label_wallet_receive">Ontvangen</string> <string name="label_wallet_receive">Ontvangen</string>
<string name="label_wallet_send">Geven</string> <string name="label_wallet_send">Geven</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR onbevestigd</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s onbevestigd</string>
<string name="service_description">monerujo-service</string> <string name="service_description">monerujo-service</string>

View File

@ -133,7 +133,7 @@
<string name="label_wallet_receive">Receber</string> <string name="label_wallet_receive">Receber</string>
<string name="label_wallet_send">Enviar</string> <string name="label_wallet_send">Enviar</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR não confirmado</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s não confirmado</string>
<string name="service_description">Serviço monerujo</string> <string name="service_description">Serviço monerujo</string>

View File

@ -130,7 +130,7 @@
<string name="label_wallet_receive">Receber</string> <string name="label_wallet_receive">Receber</string>
<string name="label_wallet_send">Enviar</string> <string name="label_wallet_send">Enviar</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR não confirmado</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s não confirmado</string>
<string name="service_description">Serviço monerujo</string> <string name="service_description">Serviço monerujo</string>

View File

@ -123,7 +123,7 @@
<string name="label_wallet_receive">Primește</string> <string name="label_wallet_receive">Primește</string>
<string name="label_wallet_send">Trimite</string> <string name="label_wallet_send">Trimite</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR neconfirmat</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s neconfirmat</string>
<string name="service_description">Serviciul monerujo</string> <string name="service_description">Serviciul monerujo</string>

View File

@ -133,7 +133,7 @@
<string name="label_wallet_receive">Получить</string> <string name="label_wallet_receive">Получить</string>
<string name="label_wallet_send">Передать</string> <string name="label_wallet_send">Передать</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR неподтвержденно</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s неподтвержденно</string>
<string name="service_description">Служба Monerujo</string> <string name="service_description">Служба Monerujo</string>

View File

@ -133,7 +133,7 @@
<string name="label_wallet_receive">Prijať</string> <string name="label_wallet_receive">Prijať</string>
<string name="label_wallet_send">Poslať</string> <string name="label_wallet_send">Poslať</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR nepotvrdených</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s nepotvrdených</string>
<string name="service_description">monerujo Service</string> <string name="service_description">monerujo Service</string>

View File

@ -135,7 +135,7 @@
<string name="label_wallet_receive">Primljeno</string> <string name="label_wallet_receive">Primljeno</string>
<string name="label_wallet_send">Daj</string> <string name="label_wallet_send">Daj</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR nepotvrđeno</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s nepotvrđeno</string>
<string name="service_description">monerujo Servis</string> <string name="service_description">monerujo Servis</string>

View File

@ -131,7 +131,7 @@
<string name="label_wallet_receive">Ta emot</string> <string name="label_wallet_receive">Ta emot</string>
<string name="label_wallet_send">Ge</string> <string name="label_wallet_send">Ge</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR obekräftade</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s obekräftade</string>
<string name="service_description">monerujo-tjänsten</string> <string name="service_description">monerujo-tjänsten</string>

View File

@ -136,7 +136,7 @@
<string name="label_wallet_receive">பெறு</string> <string name="label_wallet_receive">பெறு</string>
<string name="label_wallet_send">அனுப்பு</string> <string name="label_wallet_send">அனுப்பு</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR உறுதிப்படுத்தப்படவில்லை</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s உறுதிப்படுத்தப்படவில்லை</string>
<string name="service_description">monerujo சேவை</string> <string name="service_description">monerujo சேவை</string>

View File

@ -133,7 +133,7 @@
<string name="label_wallet_receive">Отримати</string> <string name="label_wallet_receive">Отримати</string>
<string name="label_wallet_send">Відправити</string> <string name="label_wallet_send">Відправити</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR непідтверджено</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s непідтверджено</string>
<string name="service_description">Служба monerujo</string> <string name="service_description">Служба monerujo</string>

View File

@ -99,7 +99,7 @@
<string name="label_watchonly">(只读)</string> <string name="label_watchonly">(只读)</string>
<string name="label_wallet_receive">收款</string> <string name="label_wallet_receive">收款</string>
<string name="label_wallet_send">发送</string> <string name="label_wallet_send">发送</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR未确认</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s未确认</string>
<string name="service_description">monerujo服务</string> <string name="service_description">monerujo服务</string>
<string name="status_synced">已同步:</string> <string name="status_synced">已同步:</string>
<string name="status_remaining">区块剩余</string> <string name="status_remaining">区块剩余</string>

View File

@ -133,7 +133,7 @@
<string name="label_wallet_receive">接收</string> <string name="label_wallet_receive">接收</string>
<string name="label_wallet_send">發送</string> <string name="label_wallet_send">發送</string>
<string name="xmr_unconfirmed_amount">+ %1$s 未確認的 XMR </string> <string name="xmr_unconfirmed_amount">+ %1$s 未確認的 %2$s </string>
<string name="service_description">monerujo 服務</string> <string name="service_description">monerujo 服務</string>

View File

@ -139,7 +139,7 @@
<string name="label_wallet_receive">Receive</string> <string name="label_wallet_receive">Receive</string>
<string name="label_wallet_send">Give</string> <string name="label_wallet_send">Give</string>
<string name="xmr_unconfirmed_amount">+ %1$s XMR unconfirmed</string> <string name="xmr_unconfirmed_amount">+ %1$s %2$s unconfirmed</string>
<string name="service_description">monerujo Service</string> <string name="service_description">monerujo Service</string>