- Fixed Toast when trying to upgrade account

- Now the CryptoNetRequests are deleted when carry out
This commit is contained in:
Javier Varona 2018-06-10 20:10:55 -04:00
parent 42e8637d11
commit 574b61d2b7
2 changed files with 31 additions and 7 deletions

View file

@ -17,6 +17,7 @@ import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.vincent.filepicker.Constant; import com.vincent.filepicker.Constant;
import com.vincent.filepicker.activity.AudioPickActivity; import com.vincent.filepicker.activity.AudioPickActivity;
@ -125,13 +126,35 @@ public class BitsharesSettingsFragment extends Fragment {
request.setListener(new CryptoNetInfoRequestListener() { request.setListener(new CryptoNetInfoRequestListener() {
@Override @Override
public void onCarryOut() { public void onCarryOut() {
switch (request.getStatus()){ getActivity().runOnUiThread(new Runnable() {
case SUCCEEDED: @Override
tvUpgradeToLtm.setVisibility(View.GONE); public void run() {
btnUpgradeToLtm.setVisibility(View.GONE); Toast toast;
tvAlreadyLtm.setVisibility(View.VISIBLE);
break; switch (request.getStatus()){
} case SUCCEEDED:
tvUpgradeToLtm.setVisibility(View.GONE);
btnUpgradeToLtm.setVisibility(View.GONE);
tvAlreadyLtm.setVisibility(View.VISIBLE);
break;
case NO_INTERNET:
case NO_SERVER_CONNECTION:
toast = Toast.makeText(getContext(), "There was an error connecting to the server. Please try again.", Toast.LENGTH_SHORT);
toast.show();
break;
case NO_FUNDS:
toast = Toast.makeText(getContext(), "Not enough funds to make the upgrade.", Toast.LENGTH_SHORT);
toast.show();
break;
case NO_ASSET_INFO_DB:
case NO_ASSET_INFO:
case PETITION_FAILED:
default:
toast = Toast.makeText(getContext(), "There was an error with the request. Please try again.", Toast.LENGTH_SHORT);
toast.show();
}
}
});
} }
}); });

View file

@ -29,5 +29,6 @@ public abstract class CryptoNetInfoRequest {
protected void _fireOnCarryOutEvent(){ protected void _fireOnCarryOutEvent(){
listener.onCarryOut(); listener.onCarryOut();
CryptoNetInfoRequests.getInstance().removeRequest(this);
} }
} }