use of android.support.v7.app.AlertDialog in project MyApp by MatthewDevelop.
the class MobileSafeActivity method showPasswordSetDialog.
/**
* 密码设置对话框
*/
private void showPasswordSetDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final AlertDialog dialog = builder.create();
View view = View.inflate(this, R.layout.dialog_set_password, null);
dialog.setView(view, 0, 0, 0, 0);
Button btOk = view.findViewById(R.id.bt_ok);
Button btCancel = view.findViewById(R.id.bt_cancel);
final EditText etPassword = view.findViewById(R.id.et_password);
final EditText etPasswordConfirm = view.findViewById(R.id.et_password_confirm);
btCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
btOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String password = etPassword.getText().toString();
String passwordConfirm = etPasswordConfirm.getText().toString();
// 判空 null和""
if (!TextUtils.isEmpty(password) && !TextUtils.isEmpty(passwordConfirm)) {
if (password.equals(passwordConfirm)) {
Toast.makeText(MobileSafeActivity.this, "密码设置成功", Toast.LENGTH_SHORT).show();
preferences.edit().putString("password", MD5Util.encode(password)).commit();
dialog.dismiss();
startActivity(new Intent(MobileSafeActivity.this, LostFindActivity.class));
} else {
Toast.makeText(MobileSafeActivity.this, "两次密码不一致", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(MobileSafeActivity.this, "密码不为空哟!", Toast.LENGTH_SHORT).show();
}
}
});
dialog.show();
}
use of android.support.v7.app.AlertDialog in project MyApp by MatthewDevelop.
the class MobileSafeActivity method showPasswordInputDialog.
/**
* 密码验证对话框
*/
private void showPasswordInputDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final AlertDialog dialog = builder.create();
View view = View.inflate(this, R.layout.dialog_input_password, null);
dialog.setView(view, 0, 0, 0, 0);
Button btOk = view.findViewById(R.id.bt_ok);
Button btCancel = view.findViewById(R.id.bt_cancel);
final EditText etPassword = view.findViewById(R.id.et_password);
btCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
btOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String localPassword = preferences.getString("password", null);
String password = etPassword.getText().toString();
// 判空 null和""
if (!TextUtils.isEmpty(password)) {
if (MD5Util.encode(password).equals(localPassword)) {
Toast.makeText(MobileSafeActivity.this, "登录成功!", Toast.LENGTH_SHORT).show();
dialog.dismiss();
startActivity(new Intent(MobileSafeActivity.this, LostFindActivity.class));
} else {
Toast.makeText(MobileSafeActivity.this, "密码错误", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(MobileSafeActivity.this, "密码不为空哟!", Toast.LENGTH_SHORT).show();
}
}
});
dialog.show();
}
use of android.support.v7.app.AlertDialog in project GomoTest by suReZj.
the class EditImageActivity method onBackPressed.
// end inner class
@Override
public void onBackPressed() {
switch(mode) {
case MODE_STICKERS:
mStickerFragment.backToMain(EditImageActivity.this);
return;
case // 滤镜编辑状态
MODE_FILTER:
// 保存滤镜贴图
mFilterListFragment.backToMain(EditImageActivity.this);
return;
case // 剪切图片保存
MODE_CROP:
mCropFragment.backToMain(EditImageActivity.this);
return;
case // 旋转图片保存
MODE_ROTATE:
mRotateFragment.backToMain(EditImageActivity.this);
return;
case MODE_TEXT:
mAddTextFragment.backToMain(EditImageActivity.this);
return;
case MODE_PAINT:
mPaintFragment.backToMain(EditImageActivity.this);
return;
case // 从美颜模式中返回
MODE_BEAUTY:
mBeautyFragment.backToMain(EditImageActivity.this);
return;
}
if (canAutoExit()) {
onSaveTaskDone();
} else {
// 图片还未被保存 弹出提示框确认
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage(R.string.exit_without_save).setCancelable(false).setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mContext.finish();
}
}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
use of android.support.v7.app.AlertDialog in project VirtualXposed by android-hacker.
the class AboutActivity method getThanksElement.
Element getThanksElement() {
Element thanks = new Element();
thanks.setTitle(getResources().getString(R.string.about_thanks));
thanks.setOnClickListener(v -> {
AlertDialog alertDialog = new AlertDialog.Builder(this, R.style.Theme_AppCompat_DayNight_Dialog_Alert).setTitle(R.string.thanks_dialog_title).setMessage(R.string.thanks_dialog_content).setPositiveButton(R.string.about_icon_yes, null).create();
try {
alertDialog.show();
} catch (Throwable ignored) {
// BadTokenException.
}
});
return thanks;
}
use of android.support.v7.app.AlertDialog in project gh4a by slapperwan.
the class UserPasswordLoginDialogFragment method onResume.
@Override
public void onResume() {
super.onResume();
final AlertDialog d = (AlertDialog) getDialog();
mOkButton = d != null ? d.getButton(DialogInterface.BUTTON_POSITIVE) : null;
if (mOkButton != null) {
mOkButton.setOnClickListener(this);
updateOkButtonState();
}
}
Aggregations