Example usage for android.app AlertDialog findViewById

List of usage examples for android.app AlertDialog findViewById

Introduction

In this page you can find the example usage for android.app AlertDialog findViewById.

Prototype

@Nullable
public <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID or null if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via #show() or #create() ).

Usage

From source file:Main.java

public static void showOkDialog(String title, String msg, Activity act) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(act);
    if (title != null) {

        TextView dialogTitle = new TextView(act);
        dialogTitle.setText(title);/*w  w w . j a  va  2s.co m*/
        dialogTitle.setPadding(10, 10, 10, 10);
        dialogTitle.setGravity(Gravity.CENTER);
        dialogTitle.setTextColor(Color.WHITE);
        dialogTitle.setTextSize(20);
        dialog.setCustomTitle(dialogTitle);

    }
    if (msg != null) {
        dialog.setMessage(msg);
    }
    dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            dialog.dismiss();
        }
    });
    AlertDialog dlg = dialog.show();
    TextView messageText = (TextView) dlg.findViewById(android.R.id.message);
    messageText.setGravity(Gravity.CENTER);

}

From source file:com.landenlabs.allperfimages.ui.Ui.java

public static AlertDialog ShowMessage(Activity activity, String message) {
    AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(message).setPositiveButton("More", null)
            .setNegativeButton("Close", null).show();
    dialog.setCanceledOnTouchOutside(true);
    TextView textView = (TextView) dialog.findViewById(android.R.id.message);
    textView.setSingleLine(false);//from w  w w . ja v  a  2  s. c o m
    textView.setTextSize(20);
    return dialog;
}

From source file:com.cw.litenote.folder.FolderUi.java

static void editFolder(final AppCompatActivity act, final int position,
        final SimpleDragSortCursorAdapter folderAdapter) {
    DB_drawer db = new DB_drawer(act);

    // insert when table is empty, activated only for the first time
    final String folderTitle = db.getFolderTitle(position, true);

    final EditText editText = new EditText(act);
    editText.setText(folderTitle);//from   w w w  .  j  ava2s  .  c  om
    editText.setSelection(folderTitle.length()); // set edit text start position

    //update tab info
    Builder builder = new Builder(act);
    builder.setTitle(R.string.edit_folder_title).setMessage(R.string.edit_folder_message).setView(editText)
            .setNegativeButton(R.string.btn_Cancel, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    /*cancel*/}
            }).setNeutralButton(R.string.edit_page_button_delete, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // delete
                    Util util = new Util(act);
                    util.vibrate();

                    Builder builder1 = new Builder(act);
                    builder1.setTitle(R.string.confirm_dialog_title)
                            .setMessage(R.string.confirm_dialog_message_folder)
                            .setNegativeButton(R.string.confirm_dialog_button_no, new OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog1, int which1) {
                                    /*nothing to do*/}
                            }).setPositiveButton(R.string.confirm_dialog_button_yes, new OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog1, int which1) {
                                    deleteFolder(act, position, folderAdapter);
                                }
                            }).show();
                }
            }).setPositiveButton(R.string.edit_page_button_update, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    DB_drawer db_drawer = new DB_drawer(act);
                    // save
                    int drawerId = (int) db_drawer.getFolderId(position, true);
                    int drawerTabInfoTableId = db_drawer.getFolderTableId(position, true);
                    db_drawer.updateFolder(drawerId, drawerTabInfoTableId, editText.getText().toString(), true);
                    // update
                    folderAdapter.notifyDataSetChanged();
                    act.getSupportActionBar().setTitle(editText.getText().toString());

                }
            }).setIcon(android.R.drawable.ic_menu_edit);

    AlertDialog d1 = builder.create();
    d1.show();
    // android.R.id.button1 for positive: save
    ((Button) d1.findViewById(android.R.id.button1))
            .setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_save, 0, 0, 0);

    // android.R.id.button2 for negative: cancel
    ((Button) d1.findViewById(android.R.id.button2))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_menu_close_clear_cancel, 0, 0, 0);

    // android.R.id.button3 for neutral: delete
    ((Button) d1.findViewById(android.R.id.button3))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_delete, 0, 0, 0);
}

From source file:org.rm3l.ddwrt.mgmt.AbstractRouterMgmtDialogFragment.java

private static Router buildRouter(AlertDialog d) throws IOException {
    @NotNull//  w  w  w. j a  va2s  .co m
    final Router router = new Router();
    final String uuid = ((TextView) d.findViewById(R.id.router_add_uuid)).getText().toString();
    if (!isNullOrEmpty(uuid)) {
        router.setUuid(uuid);
    }
    router.setName(((EditText) d.findViewById(R.id.router_add_name)).getText().toString());
    router.setRemoteIpAddress(((EditText) d.findViewById(R.id.router_add_ip)).getText().toString());
    router.setRemotePort(
            Integer.parseInt(((EditText) d.findViewById(R.id.router_add_port)).getText().toString()));
    router.setRouterConnectionProtocol(Router.RouterConnectionProtocol
            .valueOf((((Spinner) d.findViewById(R.id.router_add_proto))).getSelectedItem().toString()));
    router.setUsername(((EditText) d.findViewById(R.id.router_add_username)).getText().toString(), true);
    router.setStrictHostKeyChecking(
            ((CheckBox) d.findViewById(R.id.router_add_is_strict_host_key_checking)).isChecked());

    final String password = ((EditText) d.findViewById(R.id.router_add_password)).getText().toString();
    final String privkey = ((TextView) d.findViewById(R.id.router_add_privkey_path)).getText().toString();
    if (!isNullOrEmpty(password)) {
        router.setPassword(password, true);
    }
    if (!isNullOrEmpty(privkey)) {

        //            //Convert privkey into a format accepted by JSCh
        //Causes a build issue with SpongyCastle
        //            final PEMParser pemParser = new PEMParser(new StringReader(privkey));
        //            Object object = pemParser.readObject();
        //            PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder().build(nullToEmpty(password).toCharArray());
        //            JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("SC");
        //            KeyPair kp;
        //            if (object instanceof PEMEncryptedKeyPair) {
        //                Log.d(LOG_TAG, "Encrypted key - we will use provided password");
        //                kp = converter.getKeyPair(((PEMEncryptedKeyPair) object).decryptKeyPair(decProv));
        //            } else {
        //                Log.d(LOG_TAG, "Unencrypted key - no password needed");
        //                kp = converter.getKeyPair((PEMKeyPair) object);
        //            }
        //            final PrivateKey privateKey = kp.getPrivate();
        //            StringWriter stringWriter = new StringWriter();
        //            JcaPEMWriter pemWriter = new JcaPEMWriter(stringWriter);
        //            pemWriter.writeObject(privateKey);
        //            pemWriter.close();

        router.setPrivKey(privkey, true);
    }
    return router;
}

From source file:com.cw.litenote.tabs.TabsHost.java

/**
 * edit page title/*from www  .j a v a2  s. c o m*/
 *
 */
static void editPageTitle(final int tabPos, final AppCompatActivity act) {
    final DB_folder mDbFolder = mTabsPagerAdapter.dbFolder;

    // get tab name
    String title = mDbFolder.getPageTitle(tabPos, true);

    final EditText editText1 = new EditText(act.getBaseContext());
    editText1.setText(title);
    editText1.setSelection(title.length()); // set edit text start position
    editText1.setTextColor(Color.BLACK);

    //update tab info
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
    builder.setTitle(R.string.edit_page_tab_title).setMessage(R.string.edit_page_tab_message).setView(editText1)
            .setNegativeButton(R.string.btn_Cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    /*cancel*/}
            }).setNeutralButton(R.string.edit_page_button_delete, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // delete
                    Util util = new Util(act);
                    util.vibrate();

                    AlertDialog.Builder builder1 = new AlertDialog.Builder(act);
                    builder1.setTitle(R.string.confirm_dialog_title)
                            .setMessage(R.string.confirm_dialog_message_page)
                            .setNegativeButton(R.string.confirm_dialog_button_no,
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog1, int which1) {
                                            /*nothing to do*/}
                                    })
                            .setPositiveButton(R.string.confirm_dialog_button_yes,
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog1, int which1) {
                                            deletePage(tabPos, act);
                                            FolderUi.selectFolder(act, FolderUi.getFocus_folderPos());
                                        }
                                    })
                            .show();
                }
            }).setPositiveButton(R.string.edit_page_button_update, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // save
                    final int pageId = mDbFolder.getPageId(tabPos, true);
                    final int pageTableId = mDbFolder.getPageTableId(tabPos, true);

                    int tabStyle = mDbFolder.getPageStyle(tabPos, true);
                    mDbFolder.updatePage(pageId, editText1.getText().toString(), pageTableId, tabStyle, true);

                    FolderUi.startTabsHostRun();
                }
            }).setIcon(android.R.drawable.ic_menu_edit);

    AlertDialog d1 = builder.create();
    d1.show();
    // android.R.id.button1 for positive: save
    ((Button) d1.findViewById(android.R.id.button1))
            .setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_save, 0, 0, 0);

    // android.R.id.button2 for negative: color
    ((Button) d1.findViewById(android.R.id.button2))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_menu_close_clear_cancel, 0, 0, 0);

    // android.R.id.button3 for neutral: delete
    ((Button) d1.findViewById(android.R.id.button3))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_delete, 0, 0, 0);

}

From source file:de.wikilab.android.friendica01.Max.java

public static void alert(Context ctx, String text, String title, String okButtonText) {
    AlertDialog ad = new AlertDialog.Builder(ctx).create();
    ad.setCancelable(false); // This blocks the 'BACK' button  
    ad.setMessage(Html.fromHtml(text));//  w ww .  j  a v a  2  s .  c  o  m
    ad.setTitle(title);
    ad.setButton(okButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    ad.show();
    ((TextView) ad.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:de.baumann.quitsmoking.about.About_content.java

static MaterialAboutList createMaterialAboutList(final Context c) {
    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();

    // Add items to card

    appCardBuilder.addItem(//  w  w w  .  j a va 2s.c o m
            new MaterialAboutTitleItem.Builder().text(R.string.app_name).icon(R.mipmap.ic_launcher).build());

    try {

        appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                ContextCompat.getDrawable(c, R.drawable.earth2), "Version", false));

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_changelog)
                    .subText(R.string.about_changelog_summary).icon(R.drawable.format_list_bulleted)
                    .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c,
                            Uri.parse("https://github.com/scoute-dich/QuitSmoking/blob/master/CHANGELOG.md")))
                    .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license)
            .subText(R.string.about_license_summary).icon(R.drawable.copyright)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    SpannableString s;

                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
                        s = new SpannableString(
                                Html.fromHtml(c.getString(R.string.about_text), Html.FROM_HTML_MODE_LEGACY));
                    } else {
                        //noinspection deprecation
                        s = new SpannableString(Html.fromHtml(c.getString(R.string.about_text)));
                    }

                    Linkify.addLinks(s, Linkify.WEB_URLS);

                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(s).setPositiveButton(c.getString(R.string.yes),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_intro)
            .subText(R.string.about_intro_summary).icon(R.drawable.information_outline_dark)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    Intent intent = new Intent(c, Activity_intro.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    c.startActivity(intent);
                }
            }).build());

    MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
    authorCardBuilder.title(R.string.about_title_dev);

    authorCardBuilder.addItem(
            new MaterialAboutActionItem.Builder().text(R.string.about_dev).subText(R.string.about_dev_summary)
                    .icon(R.drawable.gaukler_faun).setOnClickListener(ConvenienceBuilder
                            .createWebsiteOnClickAction(c, Uri.parse("https://github.com/scoute-dich/")))
                    .build());

    authorCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_donate)
            .subText(R.string.about_donate_summary).icon(R.drawable.coin)
            .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NP6TGYDYP9SHY")))
            .build());

    MaterialAboutCard.Builder authorCardBuilder2 = new MaterialAboutCard.Builder();
    authorCardBuilder2.title(R.string.about_title_ext);

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Neofaum")
            .subText(R.string.about_title_ext3).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/naofum")))
            .build());

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Primokorn")
            .subText(R.string.about_title_ext4).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/Primokorn")))
            .build());

    MaterialAboutCard.Builder convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Onboarder")
                    .subText(R.string.about_license_3).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Onboarder", "https://github.com/chyrta/AndroidOnboarder", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Glide")
            .subText(R.string.about_license_9).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Glide",
                    "https://github.com/bumptech/glide", true, false))
            .build());

    convenienceCardBuilder
            .addItem(
                    new MaterialAboutActionItem.Builder().text("Image Picker").subText(R.string.about_license_1)
                            .icon(R.drawable.github_circle)
                            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                                    "Image Picker", "https://github.com/Mariovc/ImagePicker", true, false))
                            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material About Library")
            .subText(R.string.about_license_7).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material About Library",
                    "https://github.com/daniel-stoneuk/material-about-library", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Date Time Picker")
            .subText(R.string.about_license_2).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Date Time Picker",
                            "https://github.com/wdullaer/MaterialDateTimePicker", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Design Icons")
            .subText(R.string.about_license_8).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Design Icons",
                    "https://github.com/Templarian/MaterialDesign", true, false))
            .build());

    return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(), authorCardBuilder2.build(),
            convenienceCardBuilder.build());
}

From source file:com.pdftron.pdf.utils.Utils.java

public static void showAlertDialogWithLink(Context context, String message, String title) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    builder.setMessage(Html.fromHtml(message)).setCancelable(true).setPositiveButton(R.string.ok,
            new DialogInterface.OnClickListener() {

                @Override/*  w ww .j  a va2  s .c o  m*/
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
    if (title.length() > 0) {
        builder.setTitle(title);
    }
    final AlertDialog d = builder.create();
    d.show();

    // Make the textview clickable. Must be called after show()
    ((TextView) d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:de.baumann.hhsmoodle.about.About_content.java

static MaterialAboutList createMaterialAboutList(final Context c) {
    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();

    // Add items to card

    appCardBuilder.addItem(/*  w w w.  j  a  v  a2  s . co m*/
            new MaterialAboutTitleItem.Builder().text(R.string.app_name).icon(R.mipmap.ic_launcher).build());

    try {

        appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                ContextCompat.getDrawable(c, R.drawable.school), "Version", false));

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_changelog)
            .subText(R.string.about_changelog_summary).icon(R.drawable.format_list_bulleted)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                    c.getString(R.string.about_changelog),
                    "https://github.com/scoute-dich/HHSMoodle/blob/master/CHANGELOG.md", true, false))
            .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license)
            .subText(R.string.about_license_summary).icon(R.drawable.copyright)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.about_text)))
                            .setPositiveButton(c.getString(R.string.toast_yes),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    appCardBuilder.addItem(ConvenienceBuilder.createEmailItem(c, ContextCompat.getDrawable(c, R.drawable.bug),
            c.getString(R.string.action_problem_summary), true, "juergen.baumann@huebsch.karlsruhe.de",
            "HHS Moodle"));

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_intro)
            .subText(R.string.about_intro_summary).icon(R.drawable.information_outline)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    Intent intent = new Intent(c, Activity_intro.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    c.startActivity(intent);
                }
            }).build());

    MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
    authorCardBuilder.title(R.string.about_title_dev);

    authorCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_dev)
                    .subText(R.string.about_dev_summary).icon(R.drawable.gaukler_faun)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            c.getString(R.string.about_dev), "https://github.com/scoute-dich/", true, false))
                    .build());

    MaterialAboutCard.Builder convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Onboarder")
                    .subText(R.string.about_license_3).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Onboarder", "https://github.com/chyrta/AndroidOnboarder", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Encrypted Userprefs")
            .subText(R.string.about_license_5).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Encrypted Userprefs",
                    "https://github.com/sveinungkb/encrypted-userprefs", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Glide")
            .subText(R.string.about_license_9).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Glide",
                    "https://github.com/bumptech/glide", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material About Library")
            .subText(R.string.about_license_7).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material About Library",
                    "https://github.com/daniel-stoneuk/material-about-library", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Design Icons")
            .subText(R.string.about_license_8).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Design Icons",
                    "https://github.com/Templarian/MaterialDesign", true, false))
            .build());

    return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(),
            convenienceCardBuilder.build());
}

From source file:de.baumann.sieben.about.About_content.java

static MaterialAboutList createMaterialAboutList(final Context c) {
    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();

    // Add items to card

    appCardBuilder.addItem(/*from   w  w w . j  a  va2  s  .  c  o  m*/
            new MaterialAboutTitleItem.Builder().text(R.string.app_name).icon(R.mipmap.ic_launcher).build());

    try {

        appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                ContextCompat.getDrawable(c, R.drawable.earth2), "Version", false));

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_changelog)
            .subText(R.string.about_changelog_summary).icon(R.drawable.format_list_bulleted)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                    c.getString(R.string.about_changelog),
                    "https://github.com/scoute-dich/Sieben/blob/master/CHANGELOG.md", true, false))
            .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license)
            .subText(R.string.about_license_summary).icon(R.drawable.copyright)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {

                    SpannableString s;

                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
                        s = new SpannableString(
                                Html.fromHtml(c.getString(R.string.about_text), Html.FROM_HTML_MODE_LEGACY));
                    } else {
                        //noinspection deprecation
                        s = new SpannableString(Html.fromHtml(c.getString(R.string.about_text)));
                    }

                    Linkify.addLinks(s, Linkify.WEB_URLS);

                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(s).setPositiveButton(c.getString(R.string.app_ok),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_intro)
            .subText(R.string.about_intro_summary).icon(R.drawable.information_outline)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    Intent intent = new Intent(c, Activity_intro.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    c.startActivity(intent);
                }
            }).build());

    MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
    authorCardBuilder.title(R.string.about_title_dev);

    authorCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_dev)
                    .subText(R.string.about_dev_summary).icon(R.drawable.gaukler_faun)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            c.getString(R.string.about_dev), "https://github.com/scoute-dich/", true, false))
                    .build());

    authorCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_donate)
            .subText(R.string.about_donate_summary).icon(R.drawable.coin)
            .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NP6TGYDYP9SHY")))
            .build());

    MaterialAboutCard.Builder authorCardBuilder2 = new MaterialAboutCard.Builder();
    authorCardBuilder2.title(R.string.about_title_ext);

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Gilles Coulais")
            .subText(R.string.about_title_ext1).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/Djiko")))
            .build());

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("jeberger")
            .subText(R.string.about_title_ext1).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/jeberger")))
            .build());

    authorCardBuilder2.addItem(
            new MaterialAboutActionItem.Builder().text("Maurits Cornelis").subText(R.string.about_title_ext4)
                    .icon(R.drawable.github_circle).setOnClickListener(ConvenienceBuilder
                            .createWebsiteOnClickAction(c, Uri.parse("https://github.com/MauritsCornelis")))
                    .build());

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Mathias Lux")
            .subText(R.string.about_title_ext2).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/dermotte")))
            .build());

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Neofaum")
            .subText(R.string.about_title_ext3).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/naofum")))
            .build());

    MaterialAboutCard.Builder convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license_1_title)
            .subText(R.string.about_license_1).icon(R.drawable.earth2)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Workout images",
                    "http://almostfearless.com/the-21-minute-workout-or-7-minutes-if-youre-really-fit", true,
                    false))
            .build());

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license_2_title)
                    .subText(R.string.about_license_2).icon(R.drawable.earth2)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Whistle",
                            "http://freesound.org/people/MentalSanityOff/sounds/218318/", true, false))
                    .build());

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Onboarder")
                    .subText(R.string.about_license_3).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Onboarder", "https://github.com/chyrta/AndroidOnboarder", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material About Library")
            .subText(R.string.about_license_7).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material About Library",
                    "https://github.com/daniel-stoneuk/material-about-library", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Design Icons")
            .subText(R.string.about_license_8).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Design Icons",
                    "https://github.com/Templarian/MaterialDesign", true, false))
            .build());

    return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(), authorCardBuilder2.build(),
            convenienceCardBuilder.build());
}