diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index f957b3882..1666c7278 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 86cc0c2fd..89f49875c 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/app/build.gradle b/app/build.gradle index 247ab6aad..5fab39d57 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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, diff --git a/app/src/main/java/com/wagerrwallet/WagerrApp.java b/app/src/main/java/com/wagerrwallet/WagerrApp.java index fe1359e96..e62633306 100644 --- a/app/src/main/java/com/wagerrwallet/WagerrApp.java +++ b/app/src/main/java/com/wagerrwallet/WagerrApp.java @@ -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 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) { diff --git a/app/src/main/java/com/wagerrwallet/presenter/activities/EventsActivity.java b/app/src/main/java/com/wagerrwallet/presenter/activities/EventsActivity.java index 3926229a8..c6310e62f 100644 --- a/app/src/main/java/com/wagerrwallet/presenter/activities/EventsActivity.java +++ b/app/src/main/java/com/wagerrwallet/presenter/activities/EventsActivity.java @@ -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 diff --git a/app/src/main/java/com/wagerrwallet/presenter/fragments/FragmentEventDetails.java b/app/src/main/java/com/wagerrwallet/presenter/fragments/FragmentEventDetails.java index e75543404..bc98ae17c 100644 --- a/app/src/main/java/com/wagerrwallet/presenter/fragments/FragmentEventDetails.java +++ b/app/src/main/java/com/wagerrwallet/presenter/fragments/FragmentEventDetails.java @@ -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);