List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:pl.bcichecki.rms.client.android.dialogs.InboxMessageDetailsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (message == null) { throw new IllegalStateException("Message has not been set!"); }//from ww w. j a v a 2s. c o m if (messagesRestClient == null) { throw new IllegalStateException("MessagesRestClient has not been set!"); } if (inboxMessagesListAdapter == null) { throw new IllegalStateException("InboxMessagesListAdapter has not been set!"); } context = getActivity(); markRead(); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); dialogBuilder.setTitle(R.string.dialog_inbox_message_details_title); dialogBuilder .setView(getActivity().getLayoutInflater().inflate(R.layout.dialog_inbox_message_details, null)); dialogBuilder.setNeutralButton(R.string.dialog_inbox_message_details_reply, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { MessageRecipent messageRecipent = new MessageRecipent(); messageRecipent.setRecipent(message.getSender()); HashSet<MessageRecipent> messageRecipents = new HashSet<MessageRecipent>(); messageRecipents.add(messageRecipent); Message replyMessage = new Message(); replyMessage.setSubject( getString(R.string.dialog_inbox_message_details_re) + ": " + message.getSubject()); replyMessage.setRecipents(messageRecipents); Log.d(getTag(), "Starting reply message activity..."); Intent newMessageIntent = new Intent(context, NewMessageActivity.class); newMessageIntent.putExtra(MESSAGE_EXTRA, replyMessage); startActivityForResult(newMessageIntent, REQUEST_CODE_SEND_MESSAGE); } }); dialogBuilder.setPositiveButton(R.string.general_close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Nothing to do... } }); AlertDialog dialog = dialogBuilder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { TextView subjectTextView = (TextView) ((AlertDialog) dialog) .findViewById(R.id.dialog_inbox_message_details_subject_text); subjectTextView.setText(message.getSubject()); StringBuilder sender = new StringBuilder(); if (message.getSender().getAddress() != null && message.getSender().getAddress().getFirstName() != null && message.getSender().getAddress().getLastName() != null) { sender.append(message.getSender().getAddress().getFirstName()).append(" ") .append(message.getSender().getAddress().getLastName()); } else { sender.append(message.getSender().getUsername()); } TextView senderTextView = (TextView) ((AlertDialog) dialog) .findViewById(R.id.dialog_inbox_message_details_sender_text); senderTextView.setText(sender.toString()); TextView receivedDataTextView = (TextView) ((AlertDialog) dialog) .findViewById(R.id.dialog_inbox_message_details_received_date_text); receivedDataTextView .setText(AppUtils.getFormattedDateAsString(message.getDate(), Locale.getDefault())); TextView contentTextView = (TextView) ((AlertDialog) dialog) .findViewById(R.id.dialog_inbox_message_details_content_text); contentTextView.setText(message.getContent()); } }); return dialog; }
From source file:com.abid_mujtaba.bitcoin.tracker.MainActivity.java
private void change_sampling_window() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Choose Sampling window"); builder.setSingleChoiceItems(window_strings, mChosenWindowIndex, windowListener); windowDialog = builder.create();// ww w .jav a2 s .c o m windowDialog.show(); }
From source file:com.abid_mujtaba.bitcoin.tracker.MainActivity.java
private void change_sampling_interval() // Method called when the user clicks the "Change Interval" button on the ActionBar menu { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Choose Sampling Interval"); builder.setSingleChoiceItems(intervals, mChosenIntervalIndex, intervalListener); // We set items in the dialog as well as the item to be shown chosen intervalDialog = builder.create();//from w ww. j av a 2 s. c om intervalDialog.show(); }
From source file:com.doomy.decode.ResultDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater mLayoutInflater = LayoutInflater.from(getActivity()); View mView = mLayoutInflater.inflate(R.layout.view_result, null); TextView mTextViewFormat = (TextView) mView.findViewById(R.id.textViewFormat); TextView mTextViewContent = (TextView) mView.findViewById(R.id.textViewContent); if (mTitle.equals("EAN 13") && mMessage.startsWith("978")) { GetResponseTask mGetResponseTask = new GetResponseTask(); mGetResponseTask.execute(mMessage); try {//from ww w . ja va2 s. c o m if (mGetResponseTask.get().equals("")) { mTitle = "ISBN"; mTextViewContent.setText(mMessage); } else { mTitle = "ISBN"; mMessage = mGetResponseTask.get(); SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(makeURLSearch(mMessage)); } }); } } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } else if (mTitle.equals("ISBN")) { if (!mMessage.startsWith("978")) { SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(makeURLSearch(mMessage)); } }); } else { mTextViewContent.setText(mMessage); } } else if (mMessage.startsWith("www") || mMessage.startsWith("http://") || mMessage.startsWith("https://")) { SpannableString mSpan = new SpannableString(mMessage); mSpan.setSpan(new UnderlineSpan(), 0, mMessage.length(), 0); mTextViewContent.setText(mSpan); mTextViewContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createURLIntent(mMessage); } }); } else { mTextViewContent.setText(mMessage); } if (mKey) { SimpleDateFormat mDateFormat = new SimpleDateFormat("dd/MM/yyyy-HH:mm"); String mDate = mDateFormat.format(new Date()); Scan mScan = new Scan(mTitle, mMessage, mDate); mDB.addOne(mScan); } mTextViewFormat.setText(mTitle); AlertDialog.Builder mAlertBuilder = new AlertDialog.Builder(getActivity(), Utils.setThemeDialog()); mAlertBuilder.setTitle(getString(R.string.info)).setView(mView).setPositiveButton(getString(R.string.okay), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (mListener != null) { mListener.onDialogPositiveClick(ResultDialogFragment.this); } } }); return mAlertBuilder.create(); }
From source file:com.jonbanjo.cupsprint.CertificateActivity.java
private void displayCert(final String alias) { X509Certificate cert;/*from ww w . j a v a 2s . c om*/ try { cert = (X509Certificate) trustStore.getCertificate(alias); } catch (KeyStoreException e) { showToast(e.toString()); return; } String certString = cert.toString(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Certificate").setMessage(certString) .setPositiveButton("Remove", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { removeCert(alias); } }).setNegativeButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:com.jonbanjo.cupsprint.CertificateActivity.java
private void removeCert(final String alias) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Remove Certificate?").setMessage(alias) .setPositiveButton("Remove", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { try { trustStore.deleteEntry(alias); FileOutputStream outputStream = openFileOutput(JfSSLScheme.trustfile, MODE_PRIVATE); trustStore.store(outputStream, JfSSLScheme.password.toCharArray()); outputStream.flush(); outputStream.close(); certListAdaptor.remove(alias); } catch (Exception e) { System.out.println(e.toString()); }//w ww. j av a 2s .c o m } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:com.locution.hereyak.LoginActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_legalnotices: String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();/*w w w . j av a 2s .c o m*/ return true; } return super.onOptionsItemSelected(item); }
From source file:com.googlecode.android_scripting.ZipExtractorTask.java
private Replace showDialog(final String name) { final FutureResult<Replace> mResult = new FutureResult<Replace>(); MainThread.run(mContext, new Runnable() { @Override//from w w w. ja va 2s. c om public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(String.format("Script \"%s\" already exist.", name)); builder.setMessage(String.format("Do you want to replace script \"%s\" ?", name)); DialogInterface.OnClickListener buttonListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Replace result = Replace.SKIPALL; switch (which) { case DialogInterface.BUTTON_POSITIVE: result = Replace.YES; break; case DialogInterface.BUTTON_NEGATIVE: result = Replace.NO; break; case DialogInterface.BUTTON_NEUTRAL: result = Replace.YESTOALL; break; } mResult.set(result); dialog.dismiss(); } }; builder.setNegativeButton("Skip", buttonListener); builder.setPositiveButton("Replace", buttonListener); builder.setNeutralButton("Replace All", buttonListener); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mResult.set(Replace.SKIPALL); dialog.dismiss(); } }); builder.show(); } }); try { return mResult.get(); } catch (InterruptedException e) { Log.e(e); } return null; }
From source file:in.shick.diode.common.Common.java
/** * Helper function to display a list of URLs. * @param theContext The current application context. * @param settings The settings to use regarding the browser component. * @param theItem The ThingInfo item to get URLs from. *//*from w ww . ja v a 2 s . co m*/ public static void showLinksDialog(final Context theContext, final RedditSettings settings, final ThingInfo theItem) { assert (theContext != null); assert (theItem != null); assert (settings != null); final ArrayList<String> urls = new ArrayList<String>(); final ArrayList<MarkdownURL> vtUrls = theItem.getUrls(); for (MarkdownURL vtUrl : vtUrls) { urls.add(vtUrl.url); } ArrayAdapter<MarkdownURL> adapter = new ArrayAdapter<MarkdownURL>(theContext, android.R.layout.select_dialog_item, vtUrls) { public View getView(int position, View convertView, ViewGroup parent) { TextView tv; if (convertView == null) { tv = (TextView) ((LayoutInflater) theContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(android.R.layout.select_dialog_item, null); } else { tv = (TextView) convertView; } String url = getItem(position).url; String anchorText = getItem(position).anchorText; // if (Constants.LOGGING) Log.d(TAG, "links url="+url + " anchorText="+anchorText); Drawable d = null; try { d = theContext.getPackageManager() .getActivityIcon(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } catch (PackageManager.NameNotFoundException ignore) { } if (d != null) { d.setBounds(0, 0, d.getIntrinsicHeight(), d.getIntrinsicHeight()); tv.setCompoundDrawablePadding(10); tv.setCompoundDrawables(d, null, null, null); } final String telPrefix = "tel:"; if (url.startsWith(telPrefix)) { url = PhoneNumberUtils.formatNumber(url.substring(telPrefix.length())); } if (anchorText != null) tv.setText(Html.fromHtml("<span>" + anchorText + "</span><br /><small>" + url + "</small>")); else tv.setText(Html.fromHtml(url)); return tv; } }; AlertDialog.Builder b = new AlertDialog.Builder( new ContextThemeWrapper(theContext, settings.getDialogTheme())); DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() { public final void onClick(DialogInterface dialog, int which) { if (which >= 0) { Common.launchBrowser(settings, theContext, urls.get(which), Util.createThreadUri(theItem).toString(), false, false, settings.isUseExternalBrowser(), settings.isSaveHistory()); } } }; b.setTitle(R.string.select_link_title); b.setCancelable(true); b.setAdapter(adapter, click); b.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public final void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); b.show(); }
From source file:edu.cwru.apo.Home.java
public void onRestRequestComplete(Methods method, JSONObject result) { if (method == Methods.phone) { if (result != null) { try { String requestStatus = result.getString("requestStatus"); if (requestStatus.compareTo("success") == 0) { SharedPreferences.Editor editor = getSharedPreferences(APO.PREF_FILE_NAME, MODE_PRIVATE) .edit();/* ww w . jav a2 s. com*/ editor.putLong("updateTime", result.getLong("updateTime")); editor.commit(); int numbros = result.getInt("numBros"); JSONArray caseID = result.getJSONArray("caseID"); JSONArray first = result.getJSONArray("first"); JSONArray last = result.getJSONArray("last"); JSONArray phone = result.getJSONArray("phone"); JSONArray family = result.getJSONArray("family"); ContentValues values; for (int i = 0; i < numbros; i++) { values = new ContentValues(); values.put("_id", caseID.getString(i)); values.put("first", first.getString(i)); values.put("last", last.getString(i)); values.put("phone", phone.getString(i)); values.put("family", family.getString(i)); database.replace("phoneDB", null, values); } } else if (requestStatus.compareTo("timestamp invalid") == 0) { Toast msg = Toast.makeText(this, "Invalid timestamp. Please try again.", Toast.LENGTH_LONG); msg.show(); } else if (requestStatus.compareTo("HMAC invalid") == 0) { Auth.loggedIn = false; Toast msg = Toast.makeText(this, "You have been logged out by the server. Please log in again.", Toast.LENGTH_LONG); msg.show(); finish(); } else { Toast msg = Toast.makeText(this, "Invalid requestStatus", Toast.LENGTH_LONG); msg.show(); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else if (method == Methods.checkAppVersion) { if (result != null) { try { String requestStatus = result.getString("requestStatus"); if (requestStatus.compareTo("success") == 0) { String appVersion = result.getString("version"); String appDate = result.getString("date"); final String appUrl = result.getString("url"); PackageInfo pinfo = this.getPackageManager().getPackageInfo(getPackageName(), 0); ; if (appVersion.compareTo(pinfo.versionName) != 0) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Upgrade"); builder.setMessage("Update available, ready to upgrade?"); builder.setIcon(R.drawable.icon); builder.setCancelable(false); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent promptInstall = new Intent("android.intent.action.VIEW", Uri.parse("https://apo.case.edu:8090/app/" + appUrl)); startActivity(promptInstall); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } else { Toast msg = Toast.makeText(this, "No updates found", Toast.LENGTH_LONG); msg.show(); } } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }