Disable autodissmiss on password dialog.
Add profile name to password dialog.
This commit is contained in:
parent
fe040595db
commit
e35069a39f
|
@ -231,7 +231,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||
|
||||
private void requestChangeProfile(final Profile profile) {
|
||||
|
||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, new MaterialDialog.ButtonCallback() {
|
||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, profile.getName(), new MaterialDialog.ButtonCallback() {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
@ -406,7 +406,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
||||
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
||||
} else {
|
||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, new MaterialDialog.ButtonCallback() {
|
||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, profile.getName(), new MaterialDialog.ButtonCallback() {
|
||||
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
|
|
@ -80,12 +80,12 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void loginWallet() {
|
||||
GeneralUtil.showProfilePasswordRequestDialog(LoginActivity.this, new MaterialDialog.ButtonCallback() {
|
||||
final Profile profile = ProfileManager.getCurrentProfile();
|
||||
GeneralUtil.showProfilePasswordRequestDialog(LoginActivity.this, profile.getName(), new MaterialDialog.ButtonCallback() {
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
View view = dialog.getCustomView();
|
||||
EditText passwordText = (EditText) view.findViewById(R.id.et_pass);
|
||||
Profile profile = ProfileManager.getCurrentProfile();
|
||||
String password = passwordText.getText().toString();
|
||||
if (profile.checkPassword(password)) {
|
||||
dialog.dismiss();
|
||||
|
|
|
@ -150,7 +150,7 @@ public final class GeneralUtil {
|
|||
GeneralUtil.showKeyBoard(name, context);
|
||||
}
|
||||
|
||||
public static void showProfilePasswordRequestDialog(final Context context, MaterialDialog.ButtonCallback callback) {
|
||||
public static void showProfilePasswordRequestDialog(final Context context, String profileName, MaterialDialog.ButtonCallback callback) {
|
||||
|
||||
if (callback == null) {
|
||||
callback = new MaterialDialog.ButtonCallback() {
|
||||
|
@ -166,11 +166,12 @@ public final class GeneralUtil {
|
|||
};
|
||||
}
|
||||
MaterialDialog dialog = new MaterialDialog.Builder(context)
|
||||
.title(R.string.request_profile_password)
|
||||
.title((profileName != null ? profileName + " " : "") + context.getResources().getString(R.string.request_profile_password))
|
||||
.positiveText(R.string.ok)
|
||||
.negativeText(R.string.cancel)
|
||||
.customView(R.layout.profile_password, true)
|
||||
.callback(callback)
|
||||
.autoDismiss(false)
|
||||
.show();
|
||||
EditText name = (EditText) dialog.findViewById(R.id.et_pass);
|
||||
GeneralUtil.showKeyBoard(name, context);
|
||||
|
|
Loading…
Reference in New Issue