Skip to content

Commit

Permalink
some bugfixes (#119)
Browse files Browse the repository at this point in the history
* avoid IllegalStateException in rare cases

* clear error state on edit

* new version

* ignore error if fragment unloaded
  • Loading branch information
m2049r authored Nov 7, 2017
1 parent 62695af commit f5ad07c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 25
versionCode 41
versionName "1.2.1"
versionCode 42
versionName "1.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ public void onNewAmount(String xmr) {
evAmount.setOnFailedExchangeListener(new ExchangeView.OnFailedExchangeListener() {
@Override
public void onFailedExchange() {
clearQR();
Toast.makeText(getActivity(), getString(R.string.message_exchange_failed), Toast.LENGTH_LONG).show();
if (isAdded()) {
clearQR();
Toast.makeText(getActivity(), getString(R.string.message_exchange_failed), Toast.LENGTH_LONG).show();
}
}
});

Expand Down
38 changes: 36 additions & 2 deletions app/src/main/java/com/m2049r/xmrwallet/SendFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -137,6 +139,21 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
}
});

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() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
Expand All @@ -150,6 +167,21 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
}
});

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() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -234,7 +266,8 @@ public void onItemSelected(final AdapterView<?> parentView, View selectedItemVie
parentView.post(new Runnable() {
@Override
public void run() {
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
if (isAdded())
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
}
});
}
Expand All @@ -250,7 +283,8 @@ public void onItemSelected(final AdapterView<?> parentView, View selectedItemVie
parentView.post(new Runnable() {
@Override
public void run() {
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
if (isAdded())
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
}
});
}
Expand Down

0 comments on commit f5ad07c

Please sign in to comment.