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) {
|
private void requestChangeProfile(final Profile profile) {
|
||||||
|
|
||||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, new MaterialDialog.ButtonCallback() {
|
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, profile.getName(), new MaterialDialog.ButtonCallback() {
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
@ -406,7 +406,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
||||||
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
||||||
} else {
|
} else {
|
||||||
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, new MaterialDialog.ButtonCallback() {
|
GeneralUtil.showProfilePasswordRequestDialog(BaseActivity.this, profile.getName(), new MaterialDialog.ButtonCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
|
|
@ -80,12 +80,12 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loginWallet() {
|
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
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
View view = dialog.getCustomView();
|
View view = dialog.getCustomView();
|
||||||
EditText passwordText = (EditText) view.findViewById(R.id.et_pass);
|
EditText passwordText = (EditText) view.findViewById(R.id.et_pass);
|
||||||
Profile profile = ProfileManager.getCurrentProfile();
|
|
||||||
String password = passwordText.getText().toString();
|
String password = passwordText.getText().toString();
|
||||||
if (profile.checkPassword(password)) {
|
if (profile.checkPassword(password)) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
|
@ -150,7 +150,7 @@ public final class GeneralUtil {
|
||||||
GeneralUtil.showKeyBoard(name, context);
|
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) {
|
if (callback == null) {
|
||||||
callback = new MaterialDialog.ButtonCallback() {
|
callback = new MaterialDialog.ButtonCallback() {
|
||||||
|
@ -166,11 +166,12 @@ public final class GeneralUtil {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
MaterialDialog dialog = new MaterialDialog.Builder(context)
|
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)
|
.positiveText(R.string.ok)
|
||||||
.negativeText(R.string.cancel)
|
.negativeText(R.string.cancel)
|
||||||
.customView(R.layout.profile_password, true)
|
.customView(R.layout.profile_password, true)
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
.autoDismiss(false)
|
||||||
.show();
|
.show();
|
||||||
EditText name = (EditText) dialog.findViewById(R.id.et_pass);
|
EditText name = (EditText) dialog.findViewById(R.id.et_pass);
|
||||||
GeneralUtil.showKeyBoard(name, context);
|
GeneralUtil.showKeyBoard(name, context);
|
||||||
|
|
Loading…
Reference in New Issue