Exchange activities fix
- Refresh balance after exchange update - Invalid HitBTC accounts are now disabled after balance refresh
This commit is contained in:
parent
34ff605de2
commit
b919e164e5
@ -17,6 +17,7 @@ import android.widget.Spinner;
|
|||||||
|
|
||||||
import com.herbron.moodl.DataManagers.DatabaseManager;
|
import com.herbron.moodl.DataManagers.DatabaseManager;
|
||||||
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
|
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
|
||||||
|
import com.herbron.moodl.DataManagers.PreferencesManager;
|
||||||
import com.herbron.moodl.R;
|
import com.herbron.moodl.R;
|
||||||
|
|
||||||
public class AddExchangeActivity extends AppCompatActivity {
|
public class AddExchangeActivity extends AppCompatActivity {
|
||||||
@ -115,6 +116,9 @@ public class AddExchangeActivity extends AppCompatActivity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
||||||
{
|
{
|
||||||
|
PreferencesManager preferencesManager = new PreferencesManager(getBaseContext());
|
||||||
|
preferencesManager.setMustUpdateSummary(true);
|
||||||
|
|
||||||
databaseManager.deleteExchangeAccountFromId(exchangeInfos.getId());
|
databaseManager.deleteExchangeAccountFromId(exchangeInfos.getId());
|
||||||
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
||||||
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
||||||
@ -139,6 +143,9 @@ public class AddExchangeActivity extends AppCompatActivity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
||||||
{
|
{
|
||||||
|
PreferencesManager preferencesManager = new PreferencesManager(getBaseContext());
|
||||||
|
preferencesManager.setMustUpdateSummary(true);
|
||||||
|
|
||||||
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
||||||
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
||||||
, secretKeyEditText.getText().toString());
|
, secretKeyEditText.getText().toString());
|
||||||
|
@ -123,6 +123,7 @@ public class BalanceManager {
|
|||||||
|
|
||||||
for(int i = 0; i < hitBtcManagers.size(); i++)
|
for(int i = 0; i < hitBtcManagers.size(); i++)
|
||||||
{
|
{
|
||||||
|
final HitBtcManager hitBtcManager = hitBtcManagers.get(i);
|
||||||
hitBtcManagers.get(i).updateGlobalBalance(new HitBtcManager.HitBtcCallBack() {
|
hitBtcManagers.get(i).updateGlobalBalance(new HitBtcManager.HitBtcCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -131,6 +132,7 @@ public class BalanceManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
|
databaseManager.disableExchangeAccount(hitBtcManager.getId());
|
||||||
dataNotifierInterface.onBalanceError(error);
|
dataNotifierInterface.onBalanceError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user