Search in sources :

Example 76 with AlertDialog

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) Button(android.widget.Button) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 77 with AlertDialog

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) Button(android.widget.Button) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 78 with AlertDialog

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();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.view.View.OnClickListener)

Example 79 with AlertDialog

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;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Element(mehdi.sakout.aboutpage.Element)

Example 80 with AlertDialog

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();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog)

Aggregations

AlertDialog (android.support.v7.app.AlertDialog)410 DialogInterface (android.content.DialogInterface)274 View (android.view.View)219 TextView (android.widget.TextView)165 Intent (android.content.Intent)117 EditText (android.widget.EditText)86 ImageView (android.widget.ImageView)69 Button (android.widget.Button)68 LayoutInflater (android.view.LayoutInflater)59 RecyclerView (android.support.v7.widget.RecyclerView)54 NonNull (android.support.annotation.NonNull)52 AdapterView (android.widget.AdapterView)51 SuppressLint (android.annotation.SuppressLint)50 ArrayList (java.util.ArrayList)49 Bundle (android.os.Bundle)47 ListView (android.widget.ListView)42 Context (android.content.Context)35 SharedPreferences (android.content.SharedPreferences)35 Uri (android.net.Uri)32 LinearLayout (android.widget.LinearLayout)30