Java Code Examples for android.app.Dialog#OnClickListener

The following examples show how to use android.app.Dialog#OnClickListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Dialogs.java    From Aegis with GNU General Public License v3.0 6 votes vote down vote up
public static void showTimeSyncWarningDialog(Context context, Dialog.OnClickListener listener) {
    Preferences prefs = new Preferences(context);
    View view = LayoutInflater.from(context).inflate(R.layout.dialog_time_sync, null);
    CheckBox checkBox = view.findViewById(R.id.check_warning_disable);

    showSecureDialog(new AlertDialog.Builder(context)
            .setTitle(R.string.time_sync_warning_title)
            .setView(view)
            .setCancelable(false)
            .setPositiveButton(R.string.yes, (dialog, which) -> {
                if (checkBox.isChecked()) {
                    prefs.setIsTimeSyncWarningEnabled(false);
                }
                if (listener != null) {
                    listener.onClick(dialog, which);
                }
            })
            .setNegativeButton(R.string.no, (dialog, which) -> {
                if (checkBox.isChecked()) {
                    prefs.setIsTimeSyncWarningEnabled(false);
                }
            })
            .create());
}
 
Example 2
Source File: RationaleDialogConfig.java    From BaseProject with MIT License 5 votes vote down vote up
AlertDialog createSupportDialog(Context context, Dialog.OnClickListener listener) {
    AlertDialog.Builder builder;
    if (theme > 0) {
        builder = new AlertDialog.Builder(context, theme);
    } else {
        builder = new AlertDialog.Builder(context);
    }
    return builder
            .setCancelable(false)
            .setPositiveButton(positiveButton, listener)
            .setNegativeButton(negativeButton, listener)
            .setMessage(rationaleMsg)
            .create();
}
 
Example 3
Source File: RationaleDialogConfig.java    From BaseProject with MIT License 5 votes vote down vote up
android.app.AlertDialog createFrameworkDialog(Context context, Dialog.OnClickListener listener) {
    android.app.AlertDialog.Builder builder;
    if (theme > 0) {
        builder = new android.app.AlertDialog.Builder(context, theme);
    } else {
        builder = new android.app.AlertDialog.Builder(context);
    }
    return builder
            .setCancelable(false)
            .setPositiveButton(positiveButton, listener)
            .setNegativeButton(negativeButton, listener)
            .setMessage(rationaleMsg)
            .create();
}
 
Example 4
Source File: OtrAndroidKeyManagerImpl.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
public static void importOtrKeyStore (final File fileOtrKeyStore, final Activity activity)
{

    try
    {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());

        prefs.edit().putString("keystoreimport", fileOtrKeyStore.getCanonicalPath()).apply();
    }
    catch (IOException ioe)
    {
        Log.e("TAG","problem importing key store",ioe);
        return;
    }

    Dialog.OnClickListener ocl = new Dialog.OnClickListener ()
    {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            //launch QR code intent
         //   new IntentIntegrator(activity).initiateScan();

        }
    };


    new AlertDialog.Builder(activity).setTitle(R.string.confirm)
              .setMessage(R.string.detected_Otr_keystore_import)
              .setPositiveButton(R.string.yes, ocl) // default button
              .setNegativeButton(R.string.no, null).setCancelable(true).show();


}
 
Example 5
Source File: RationaleDialogConfig.java    From easypermissions with Apache License 2.0 5 votes vote down vote up
AlertDialog createSupportDialog(Context context, Dialog.OnClickListener listener) {
    AlertDialog.Builder builder;
    if (theme > 0) {
        builder = new AlertDialog.Builder(context, theme);
    } else {
        builder = new AlertDialog.Builder(context);
    }
    return builder
            .setCancelable(false)
            .setPositiveButton(positiveButton, listener)
            .setNegativeButton(negativeButton, listener)
            .setMessage(rationaleMsg)
            .create();
}
 
Example 6
Source File: RationaleDialogConfig.java    From easypermissions with Apache License 2.0 5 votes vote down vote up
android.app.AlertDialog createFrameworkDialog(Context context, Dialog.OnClickListener listener) {
    android.app.AlertDialog.Builder builder;
    if (theme > 0) {
        builder = new android.app.AlertDialog.Builder(context, theme);
    } else {
        builder = new android.app.AlertDialog.Builder(context);
    }
    return builder
            .setCancelable(false)
            .setPositiveButton(positiveButton, listener)
            .setNegativeButton(negativeButton, listener)
            .setMessage(rationaleMsg)
            .create();
}
 
Example 7
Source File: MizLib.java    From Mizuu with Apache License 2.0 5 votes vote down vote up
public static void showSelectFileDialog(Context context, ArrayList<Filepath> paths, final Dialog.OnClickListener listener) {
    String[] items = new String[paths.size()];
    for (int i = 0; i < paths.size(); i++)
        items[i] = paths.get(i).getFilepath();

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(context.getString(R.string.selectFile));
    builder.setItems(items, listener);
    builder.show();
}
 
Example 8
Source File: ChooseDialog.java    From SimpleProject with MIT License 4 votes vote down vote up
public ChooseDialog setOnItemClickListener(Dialog.OnClickListener listener) {
	this.itemListener = listener;
	return this;
}
 
Example 9
Source File: LovelyDialogCompat.java    From LovelyDialog with Apache License 2.0 2 votes vote down vote up
/**
 * If you don't want to change implemented interfaces when migrating from standard dialogs
 * to LovelyDialogs - use this method.
 */
public static View.OnClickListener wrap(Dialog.OnClickListener listener) {
    return new DialogOnClickListenerAdapter(listener);
}