mirror of
https://github.com/m2049r/xmrwallet
synced 2025-04-30 09:07:21 +02:00
Bugfixes & UI tweaks (#149)
* cancel button + avoid crash if exchanging * max check fix
This commit is contained in:
parent
82c32d4442
commit
51876f788f
app/src/main
java/com/m2049r/xmrwallet
res/values
@ -115,10 +115,11 @@ public class SendAmountWizardFragment extends SendWizardFragment {
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
final long funds = getTotalFunds();
|
||||
maxFunds = funds / 1000000000000L;
|
||||
maxFunds = 1.0 * funds / 1000000000000L;
|
||||
tvFunds.setText(getString(R.string.send_available,
|
||||
Wallet.getDisplayAmount(funds)));
|
||||
if (evAmount.getAmount().isEmpty()) {
|
||||
// getAmount is null if exchange is in progress
|
||||
if ((evAmount.getAmount() != null) && evAmount.getAmount().isEmpty()) {
|
||||
final BarcodeData data = sendListener.popBarcodeData();
|
||||
if ((data != null) && (data.amount > 0)) {
|
||||
evAmount.setAmount(Wallet.getDisplayAmount(data.amount));
|
||||
|
@ -198,10 +198,10 @@ public class SendFragment extends Fragment
|
||||
super.onResume();
|
||||
Timber.d("onResume");
|
||||
activityCallback.setSubtitle(getString(R.string.send_title));
|
||||
if (getConfirmFragment() != null) {
|
||||
if (spendViewPager.getCurrentItem() == SpendPagerAdapter.POS_SUCCESS) {
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_NONE);
|
||||
} else {
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,10 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
||||
onDisposeRequest();
|
||||
onBackPressed();
|
||||
break;
|
||||
case Toolbar.BUTTON_CANCEL:
|
||||
onDisposeRequest();
|
||||
WalletActivity.super.onBackPressed();
|
||||
break;
|
||||
case Toolbar.BUTTON_CLOSE:
|
||||
finish();
|
||||
break;
|
||||
|
@ -58,6 +58,11 @@ public class ExchangeTextView extends LinearLayout
|
||||
}
|
||||
|
||||
public boolean validate(double max) {
|
||||
Timber.d("inProgress=%b", isExchangeInProgress());
|
||||
if (isExchangeInProgress()) {
|
||||
shakeExchangeField();
|
||||
return false;
|
||||
}
|
||||
boolean ok = true;
|
||||
if (xmrAmount != null) {
|
||||
try {
|
||||
@ -86,6 +91,10 @@ public class ExchangeTextView extends LinearLayout
|
||||
tvAmountA.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||
}
|
||||
|
||||
void shakeExchangeField() {
|
||||
tvAmountB.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||
}
|
||||
|
||||
public void setAmount(String xmrAmount) {
|
||||
if (xmrAmount != null) {
|
||||
setCurrencyA(0);
|
||||
|
@ -117,6 +117,7 @@ public class Toolbar extends android.support.v7.widget.Toolbar {
|
||||
public final static int BUTTON_BACK = 1;
|
||||
public final static int BUTTON_CLOSE = 2;
|
||||
public final static int BUTTON_DONATE = 3;
|
||||
public final static int BUTTON_CANCEL = 4;
|
||||
|
||||
int buttonType = BUTTON_DONATE;
|
||||
|
||||
@ -140,6 +141,12 @@ public class Toolbar extends android.support.v7.widget.Toolbar {
|
||||
bDonate.setText(R.string.label_donate);
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case BUTTON_CANCEL:
|
||||
Timber.d("BUTTON_CANCEL");
|
||||
bDonate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_close_white_24dp, 0, 0, 0);
|
||||
bDonate.setText(R.string.label_cancel);
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case BUTTON_NONE:
|
||||
default:
|
||||
Timber.d("BUTTON_NONE");
|
||||
|
@ -18,6 +18,7 @@
|
||||
<string name="label_login_wallets">Wallets</string>
|
||||
<string name="label_donate">Donate</string>
|
||||
<string name="label_close">Close</string>
|
||||
<string name="label_cancel">Cancel</string>
|
||||
<string name="label_wallet_advanced_details">Touch for detailed information</string>
|
||||
|
||||
<string name="label_send_success">Success!</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user