mirror of https://github.com/m2049r/xmrwallet.git
call fail() if password cancelled (#726)
This commit is contained in:
parent
3329636d32
commit
1b680344b1
|
@ -376,7 +376,7 @@ public class LoginActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(String walletName1, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else { // this cannot really happen as we prefilter choices
|
} else { // this cannot really happen as we prefilter choices
|
||||||
|
@ -412,7 +412,7 @@ public class LoginActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else { // this cannot really happen as we prefilter choices
|
} else { // this cannot really happen as we prefilter choices
|
||||||
|
@ -1400,7 +1400,7 @@ public class LoginActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -337,7 +337,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -854,7 +854,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
bSend.setEnabled(sendCountdown > 0); // allow to try again
|
bSend.setEnabled(sendCountdown > 0); // allow to try again
|
||||||
});
|
});
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fail(String walletName, String password, boolean fingerprintUsed) {
|
public void fail(String walletName) {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
bSend.setEnabled(true); // allow to try again
|
bSend.setEnabled(true); // allow to try again
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,6 @@ import android.content.ClipData;
|
||||||
import android.content.ClipDescription;
|
import android.content.ClipDescription;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
@ -484,7 +483,6 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
if (etPassword.getError() != null) {
|
if (etPassword.getError() != null) {
|
||||||
|
@ -508,17 +506,16 @@ public class Helper {
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(context.getString(R.string.label_ok), null)
|
.setPositiveButton(context.getString(R.string.label_ok), null)
|
||||||
.setNegativeButton(context.getString(R.string.label_cancel),
|
.setNegativeButton(context.getString(R.string.label_cancel),
|
||||||
new DialogInterface.OnClickListener() {
|
(dialog, id) -> {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
action.fail(wallet);
|
||||||
Helper.hideKeyboardAlways((Activity) context);
|
Helper.hideKeyboardAlways((Activity) context);
|
||||||
cancelSignal.cancel();
|
cancelSignal.cancel();
|
||||||
if (passwordTask != null) {
|
if (passwordTask != null) {
|
||||||
passwordTask.cancel(true);
|
passwordTask.cancel(true);
|
||||||
passwordTask = null;
|
passwordTask = null;
|
||||||
}
|
|
||||||
dialog.cancel();
|
|
||||||
openDialog = null;
|
|
||||||
}
|
}
|
||||||
|
dialog.cancel();
|
||||||
|
openDialog = null;
|
||||||
});
|
});
|
||||||
openDialog = alertDialogBuilder.create();
|
openDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
|
@ -561,45 +558,37 @@ public class Helper {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
openDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
openDialog.setOnShowListener(dialog -> {
|
||||||
@Override
|
if (fingerprintAuthAllowed && fingerprintAuthCallback != null) {
|
||||||
public void onShow(DialogInterface dialog) {
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icFingerprint, null, null, null);
|
||||||
if (fingerprintAuthAllowed && fingerprintAuthCallback != null) {
|
tvOpenPrompt.setText(context.getText(R.string.prompt_fingerprint_auth));
|
||||||
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icFingerprint, null, null, null);
|
tvOpenPrompt.setVisibility(View.VISIBLE);
|
||||||
tvOpenPrompt.setText(context.getText(R.string.prompt_fingerprint_auth));
|
FingerprintHelper.authenticate(context, cancelSignal, fingerprintAuthCallback);
|
||||||
tvOpenPrompt.setVisibility(View.VISIBLE);
|
} else {
|
||||||
FingerprintHelper.authenticate(context, cancelSignal, fingerprintAuthCallback);
|
etPassword.requestFocus();
|
||||||
} else {
|
|
||||||
etPassword.requestFocus();
|
|
||||||
}
|
|
||||||
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
|
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
|
||||||
if (passwordTask == null) {
|
|
||||||
passwordTask = new PasswordTask(pass, false);
|
|
||||||
passwordTask.execute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
|
button.setOnClickListener(view -> {
|
||||||
|
String pass = etPassword.getEditText().getText().toString();
|
||||||
|
if (passwordTask == null) {
|
||||||
|
passwordTask = new PasswordTask(pass, false);
|
||||||
|
passwordTask.execute();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// accept keyboard "ok"
|
// accept keyboard "ok"
|
||||||
etPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
etPassword.getEditText().setOnEditorActionListener((v, actionId, event) -> {
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
|| (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||||
|| (actionId == EditorInfo.IME_ACTION_DONE)) {
|
String pass = etPassword.getEditText().getText().toString();
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
if (passwordTask == null) {
|
||||||
if (passwordTask == null) {
|
passwordTask = new PasswordTask(pass, false);
|
||||||
passwordTask = new PasswordTask(pass, false);
|
passwordTask.execute();
|
||||||
passwordTask.execute();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Helper.preventScreenshot()) {
|
if (Helper.preventScreenshot()) {
|
||||||
|
@ -613,7 +602,7 @@ public class Helper {
|
||||||
public interface PasswordAction {
|
public interface PasswordAction {
|
||||||
void act(String walletName, String password, boolean fingerprintUsed);
|
void act(String walletName, String password, boolean fingerprintUsed);
|
||||||
|
|
||||||
void fail(String walletName, String password, boolean fingerprintUsed);
|
void fail(String walletName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private boolean processPasswordEntry(Context context, String walletName, String pass, boolean fingerprintUsed, PasswordAction action) {
|
static private boolean processPasswordEntry(Context context, String walletName, String pass, boolean fingerprintUsed, PasswordAction action) {
|
||||||
|
@ -622,7 +611,7 @@ public class Helper {
|
||||||
action.act(walletName, walletPassword, fingerprintUsed);
|
action.act(walletName, walletPassword, fingerprintUsed);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
action.fail(walletName, walletPassword, fingerprintUsed);
|
action.fail(walletName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue