some bugfixes (#119)

* avoid IllegalStateException in rare cases

* clear error state on edit

* new version

* ignore error if fragment unloaded
This commit is contained in:
m2049r 2017-11-07 23:22:09 +01:00 committed by GitHub
parent 62695af9c6
commit f5ad07c2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 6 deletions

View File

@ -8,8 +8,8 @@ android {
applicationId "com.m2049r.xmrwallet" applicationId "com.m2049r.xmrwallet"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 25 targetSdkVersion 25
versionCode 41 versionCode 42
versionName "1.2.1" versionName "1.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild { externalNativeBuild {
cmake { cmake {

View File

@ -116,9 +116,11 @@ public class ReceiveFragment extends Fragment {
evAmount.setOnFailedExchangeListener(new ExchangeView.OnFailedExchangeListener() { evAmount.setOnFailedExchangeListener(new ExchangeView.OnFailedExchangeListener() {
@Override @Override
public void onFailedExchange() { public void onFailedExchange() {
if (isAdded()) {
clearQR(); clearQR();
Toast.makeText(getActivity(), getString(R.string.message_exchange_failed), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getString(R.string.message_exchange_failed), Toast.LENGTH_LONG).show();
} }
}
}); });
etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() { etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {

View File

@ -24,7 +24,9 @@ import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout; import android.support.design.widget.TextInputLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -137,6 +139,21 @@ public class SendFragment extends Fragment {
} }
}); });
etAddress.getEditText().addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
etAddress.setError(null);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() { etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
@ -150,6 +167,21 @@ public class SendFragment extends Fragment {
} }
}); });
etPaymentId.getEditText().addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
etPaymentId.setError(null);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
bPrepareSend.setOnClickListener(new View.OnClickListener() { bPrepareSend.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -234,6 +266,7 @@ public class SendFragment extends Fragment {
parentView.post(new Runnable() { parentView.post(new Runnable() {
@Override @Override
public void run() { public void run() {
if (isAdded())
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
} }
}); });
@ -250,6 +283,7 @@ public class SendFragment extends Fragment {
parentView.post(new Runnable() { parentView.post(new Runnable() {
@Override @Override
public void run() { public void run() {
if (isAdded())
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray)); ((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
} }
}); });