Skip to content
Permalink
Browse files

fix min bet amount bug, add balance listener to EventsActivity, fixed…

… random ConcurrentModificationException b 248
  • Loading branch information
MIPPL
MIPPL committed Nov 5, 2019
1 parent f256959 commit 26c5a3bc3603b1513e2faf5678afaf22001e12c7
Binary file not shown.
BIN +15 Bytes (100%) .idea/caches/gradle_models.ser
Binary file not shown.
@@ -7,8 +7,8 @@ android {
applicationId = 'com.wagerrwallet'
minSdkVersion 23
targetSdkVersion 28
versionCode 247
versionName "247"
versionCode 248
versionName "248"
multiDexEnabled true

// Similar to other properties in the defaultConfig block,
@@ -23,6 +23,7 @@
import com.google.firebase.crash.FirebaseCrash;

import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -226,7 +227,14 @@ public static void setBreadContext(Activity app) {
public static synchronized void fireListeners() {
if (listeners == null) return;
List<OnAppBackgrounded> copy = listeners;
for (OnAppBackgrounded lis : copy) if (lis != null) lis.onBackgrounded();

for (OnAppBackgrounded lis : copy) {
try {
if (lis != null) lis.onBackgrounded();
}
catch (ConcurrentModificationException e) {
}
}
}

public static void addOnBackgroundedListener(OnAppBackgrounded listener) {
@@ -66,6 +66,7 @@
import com.wagerrwallet.tools.util.Utils;
import com.wagerrwallet.wallet.WalletsMaster;
import com.wagerrwallet.wallet.abstracts.BaseWalletManager;
import com.wagerrwallet.wallet.abstracts.OnBalanceChangedListener;
import com.wagerrwallet.wallet.abstracts.OnEventTxListModified;
import com.wagerrwallet.wallet.abstracts.OnTxListModified;
import com.wagerrwallet.wallet.abstracts.SyncListener;
@@ -293,6 +294,12 @@ public void onClick(View v) {
BRDialog.showSimpleDialog(this, getString(R.string.Dialog_screenAlteringTitle), getString(R.string.Dialog_screenAlteringMessage));
}

WalletsMaster.getInstance(this).getCurrentWallet(this).addBalanceChangedListener(new OnBalanceChangedListener() {
@Override
public void onBalanceChanged(String iso, long newBalance) {
updateBalance();
}
});
}

public boolean isSearchActive() {
@@ -455,6 +462,19 @@ private void updateUi() {

// String fiatIso = BRSharedPrefs.getPreferredFiatIso(this);

updateBalance();

mToolbar.setBackgroundColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mSendButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mBuyButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mReceiveButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));

EventTxManager.getInstance().updateTxList(EventsActivity.this);
}

protected void updateBalance() {
final BaseWalletManager wallet = WalletsMaster.getInstance(this).getCurrentWallet(this);

String fiatExchangeRate = CurrencyUtils.getFormattedAmount(this, BRSharedPrefs.getPreferredFiatIso(this), wallet.getFiatExchangeRate(this));
String fiatBalance = CurrencyUtils.getFormattedAmount(this, BRSharedPrefs.getPreferredFiatIso(this), wallet.getFiatBalance(this));
String cryptoBalance = CurrencyUtils.getFormattedAmount(this, wallet.getIso(this), new BigDecimal(wallet.getCachedBalance(this)));
@@ -463,12 +483,6 @@ private void updateUi() {
mCurrencyPriceUsd.setText(String.format("%s per %s", fiatExchangeRate, wallet.getIso(this)));
mBalancePrimary.setText(fiatBalance);
mBalanceSecondary.setText(cryptoBalance);
mToolbar.setBackgroundColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mSendButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mBuyButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));
//mReceiveButton.setColor(Color.parseColor(wallet.getUiConfiguration().colorHex));

EventTxManager.getInstance().updateTxList(EventsActivity.this);
}

// This method checks if a screen altering app(such as Twightlight) is currently running
@@ -333,7 +333,7 @@ public void afterTextChanged(Editable s) {
mAmountWhenSent = rootView.findViewById(R.id.amount_when_sent);

mTxNoBetBalance = rootView.findViewById(R.id.tx_no_bet_balance);
boolean canBet = ((int)(walletManager.getWallet().getBalance()/UNIT_MULTIPLIER) > getContext().getResources().getInteger(R.integer.min_bet_amount));
boolean canBet = (((float)walletManager.getWallet().getBalance())/UNIT_MULTIPLIER) > getContext().getResources().getInteger(R.integer.min_bet_amount);

if (canBet) {
mTxHomeOdds.setOnClickListener(this);

0 comments on commit 26c5a3b

Please sign in to comment.
You can’t perform that action at this time.