Example usage for android.support.v4.app AlertDialog.Builder setTitle

List of usage examples for android.support.v4.app AlertDialog.Builder setTitle

Introduction

In this page you can find the example usage for android.support.v4.app AlertDialog.Builder setTitle.

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:de.mkrtchyan.recoverytools.SettingsFragment.java

public static void showChangelog(Context AppContext) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(AppContext);
    dialog.setTitle(R.string.changelog);
    WebView changes = new WebView(AppContext);
    changes.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    changes.setWebViewClient(new WebViewClient());
    changes.loadUrl(Constants.CHANGELOG_URL);
    changes.clearCache(true);/* w  ww .  j a va  2 s.co  m*/
    dialog.setView(changes);
    dialog.show();
}

From source file:org.quantumbadger.redreader.activities.PostListingActivity.java

public static void onSearchPosts(final PostListingController controller, final Activity activity) {

    final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity);
    final LinearLayout layout = (LinearLayout) activity.getLayoutInflater().inflate(R.layout.dialog_editbox);
    final EditText editText = (EditText) layout.findViewById(R.id.dialog_editbox_edittext);

    editText.requestFocus();// w  w w.  ja  v a2  s  .  c  om

    alertBuilder.setView(layout);
    alertBuilder.setTitle(R.string.action_search);

    alertBuilder.setPositiveButton(R.string.action_search, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

            final String query = editText.getText().toString().toLowerCase().trim();

            final RedditURLParser.SearchPostListURL url;

            if (controller != null && controller.isSubreddit()) {
                url = RedditURLParser.SearchPostListURL.build(controller.subredditCanonicalName(), query);
            } else {
                url = RedditURLParser.SearchPostListURL.build(null, query);
            }

            final Intent intent = new Intent(activity, PostListingActivity.class);
            intent.setData(url.generateJsonUri());
            activity.startActivity(intent);
        }
    });

    alertBuilder.setNegativeButton(R.string.dialog_cancel, null);

    final AlertDialog alertDialog = alertBuilder.create();
    alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    alertDialog.show();
}

From source file:org.lol.reddit.activities.PostListingActivity.java

public static void onSearchPosts(final PostListingController controller, final Activity activity) {

    final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity);
    final LinearLayout layout = (LinearLayout) activity.getLayoutInflater().inflate(R.layout.dialog_editbox);
    final EditText editText = (EditText) layout.findViewById(R.id.dialog_editbox_edittext);

    editText.requestFocus();//from   w w w .j  a v a  2 s .  com

    alertBuilder.setView(layout);
    alertBuilder.setTitle(R.string.action_search);

    alertBuilder.setPositiveButton(R.string.action_search, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

            final String query = editText.getText().toString().toLowerCase().trim();

            final SearchPostListURL url;

            if (controller != null && controller.isSubreddit()) {
                url = SearchPostListURL.build(controller.subredditCanonicalName(), query);
            } else {
                url = SearchPostListURL.build(null, query);
            }

            final Intent intent = new Intent(activity, PostListingActivity.class);
            intent.setData(url.generateJsonUri());
            activity.startActivity(intent);
        }
    });

    alertBuilder.setNegativeButton(R.string.dialog_cancel, null);

    final AlertDialog alertDialog = alertBuilder.create();
    alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    alertDialog.show();
}

From source file:com.urbantamil.projmadurai.OKCancelDialog.java

@Override
public AlertDialog getDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    builder.setTitle("Delete Confirmation Dialog");
    builder.setMessage("Do you want to delete this item ?");

    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override//from  w w  w.  j  ava2  s . c o  m
        public void onClick(DialogInterface dialog, int which) {
            m_OK = true;
        }
    });

    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            m_OK = false;
        }
    });

    m_ald = builder.create();
    return m_ald;
}

From source file:com.geekandroid.sdk.sample.crop.CropBaseActivity.java

/**
 * This method shows dialog with given title & message.
 * Also there is an option to pass onClickListener for positive & negative button.
 *
 * @param title                         - dialog title
 * @param message                       - dialog message
 * @param onPositiveButtonClickListener - listener for positive button
 * @param positiveText                  - positive button text
 * @param onNegativeButtonClickListener - listener for negative button
 * @param negativeText                  - negative button text
 */// ww w  .  j  a  v  a 2s  .co m
protected void showAlertDialog(@Nullable String title, @Nullable String message,
        @Nullable DialogInterface.OnClickListener onPositiveButtonClickListener, @NonNull String positiveText,
        @Nullable DialogInterface.OnClickListener onNegativeButtonClickListener, @NonNull String negativeText) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setPositiveButton(positiveText, onPositiveButtonClickListener);
    builder.setNegativeButton(negativeText, onNegativeButtonClickListener);
    mAlertDialog = builder.show();
}

From source file:com.softminds.matrixcalculator.OperationFragments.TransposeFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("TRANSPOSE_PROMPT", true)
            && ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(position)
                    .isSquareMatrix()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        builder.setTitle(R.string.TransposePrompt);
        builder.setPositiveButton(R.string.Yup, new DialogInterface.OnClickListener() {
            @Override/*  w w w  . j a  v a2  s . c  om*/
            public void onClick(DialogInterface dialogInterface, int i) {
                ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(ClickPos)
                        .transposeEquals();
                Toast.makeText(getActivity(), R.string.SuccessTranspose, Toast.LENGTH_SHORT).show();
                dialogInterface.dismiss();
            }
        });
        builder.setNegativeButton(R.string.Nope, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
                Intent i2 = new Intent(getContext(), ShowResult.class);
                MatrixV2 original = ((GlobalValues) getActivity().getApplication()).GetCompleteList()
                        .get(ClickPos);
                i2.putExtras(original.transpose().getDataBundled());
                startActivity(i2);
            }
        });
        builder.setMessage(R.string.SquareTransPrompt);
        builder.show();
    } else //Non Square MatrixV2 to transpose
    {
        Intent i2 = new Intent(getContext(), ShowResult.class);
        MatrixV2 original = ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(ClickPos);
        i2.putExtras(original.transpose().getDataBundled());
        startActivity(i2);
    }

}

From source file:com.nextgis.maplibui.mapui.NGWWebMapLayerUI.java

public void showLayersDialog(final MapView map, final Context context) {
    CharSequence[] names = new CharSequence[mChildren.size()];
    final boolean[] visible = new boolean[mChildren.size()];
    for (int i = 0; i < mChildren.size(); i++) {
        names[i] = mChildren.get(i).getName();
        visible[i] = mChildren.get(i).isVisible();
    }// w  w  w.j a  v  a2 s . c o  m

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.track_list)
            .setMultiChoiceItems(names, visible, new DialogInterface.OnMultiChoiceClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i, boolean b) {
                    mChildren.get(i).setVisible(b);
                }
            }).setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    String oldUrl = getURL();
                    String newUrl = updateURL();

                    if (!oldUrl.equals(newUrl)) {
                        DialogInterface.OnDismissListener listener = new DialogInterface.OnDismissListener() {
                            @Override
                            public void onDismiss(DialogInterface dialogInterface) {
                                if (mBitmapCache != null)
                                    mBitmapCache.clear();

                                map.drawMapDrawable();
                            }
                        };

                        new ClearCacheTask(context, listener).execute(getPath());
                        save();
                    }
                }
            });

    builder.show();
}

From source file:com.rizal.lovins.smartkasir.activity.SettingsActivity.java

public void menuLogout() {
    AlertDialog.Builder builder = new AlertDialog.Builder(SettingsActivity.this);
    builder.setTitle("Logout");
    builder.setMessage("Apakah Anda yakin ingin keluar?");
    builder.setCancelable(true);/*from w w  w  .  j ava 2 s  .  com*/
    builder.setPositiveButton("Ya", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            PreferenceUtil.logout(SettingsActivity.this);
            startActivity(new Intent(SettingsActivity.this, LoginActivity.class));
            finishAffinity();
        }
    });

    builder.setNegativeButton("Tidak", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:org.mozilla.focus.fragment.DownloadDialogFragment.java

public AlertDialog onCreateDialog(Bundle bundle) {
    final String fileName = getArguments().getString("fileName");
    final Download pendingDownload = getArguments().getParcelable("download");

    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), R.style.DialogStyle);
    builder.setCancelable(true);/*  w w  w. j av  a 2  s.  c  o  m*/
    builder.setTitle(getString(R.string.download_dialog_title));

    final LayoutInflater inflater = getActivity().getLayoutInflater();
    final View dialogView = inflater.inflate(R.layout.download_dialog, null);
    builder.setView(dialogView);

    final ImageView downloadDialogIcon = (ImageView) dialogView.findViewById(R.id.download_dialog_icon);
    final TextView downloadDialogMessage = (TextView) dialogView.findViewById(R.id.download_dialog_file_name);
    final Button downloadDialogCancelButton = (Button) dialogView.findViewById(R.id.download_dialog_cancel);
    final Button downloadDialogDownloadButton = (Button) dialogView.findViewById(R.id.download_dialog_download);
    final TextView downloadDialogWarningMessage = (TextView) dialogView
            .findViewById(R.id.download_dialog_warning);

    downloadDialogIcon.setImageResource(R.drawable.ic_download);
    downloadDialogMessage.setText(fileName);
    downloadDialogCancelButton.setText(getString(R.string.download_dialog_action_cancel));
    downloadDialogDownloadButton.setText(getString(R.string.download_dialog_action_download));
    downloadDialogWarningMessage
            .setText(getSpannedTextFromHtml(R.string.download_dialog_warning, R.string.app_name));

    final AlertDialog alert = builder.create();

    setButtonOnClickListener(downloadDialogCancelButton, pendingDownload, false);
    setButtonOnClickListener(downloadDialogDownloadButton, pendingDownload, true);

    return alert;
}

From source file:com.nexus.nsnik.randomno.view.fragments.dailogFragments.AboutDialogFragment.java

private void showLibrariesList() {
    if (getActivity() != null) {
        AlertDialog.Builder choosePath = new AlertDialog.Builder(getActivity());
        choosePath.setTitle(getActivity().getResources().getString(R.string.aboutLibrariesHead));
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(),
                android.R.layout.simple_list_item_1);
        for (LibraryObject libraryObject : mLibraryList) {
            arrayAdapter.add(libraryObject.libraryName());
        }/*from   w  ww .  ja va  2  s . co  m*/
        choosePath.setAdapter(arrayAdapter,
                (dialog, position) -> openUrl(mLibraryList.get(position).libraryLink()));
        choosePath.create().show();
    }
}