List of usage examples for android.text.util Linkify ALL
int ALL
To view the source code for android.text.util Linkify ALL.
Click Source Link
Note:
#MAP_ADDRESSES is deprecated.From source file:mobi.omegacentauri.ptimer.PTimerEditActivity.java
private void handleFatalError(final CharSequence errorInternalName, final CharSequence errorString, final Exception exception) { Log.i("Ringdroid", "handleFatalError"); SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); int failureCount = prefs.getInt(PREF_ERROR_COUNT, 0); final SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_ERROR_COUNT, failureCount + 1); prefsEditor.commit();//from w ww . j a va 2 s.c o m // Check if we already have a pref for whether or not we can // contact the server. int serverAllowed = prefs.getInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_UNKNOWN); if (serverAllowed == SERVER_ALLOWED_NO) { Log.i("Ringdroid", "ERR: SERVER_ALLOWED_NO"); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } if (serverAllowed == SERVER_ALLOWED_YES) { Log.i("Ringdroid", "SERVER_ALLOWED_YES"); new AlertDialog.Builder(PTimerEditActivity.this).setTitle(R.string.alert_title_failure) .setMessage(errorString) .setPositiveButton(R.string.alert_ok_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sendErrToServerAndFinish(errorInternalName, exception); return; } }).setCancelable(false).show(); return; } // The number of times the user must have had a failure before // we'll ask them. Defaults to 1, and each time they click "Later" // we double and add 1. final int allowServerCheckIndex = prefs.getInt(PREF_ERR_SERVER_CHECK, 1); if (failureCount < allowServerCheckIndex) { Log.i("Ringdroid", "failureCount " + failureCount + " is less than " + allowServerCheckIndex); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } final SpannableString message = new SpannableString( errorString + ". " + getResources().getText(R.string.error_server_prompt)); Linkify.addLinks(message, Linkify.ALL); AlertDialog dialog = new AlertDialog.Builder(this).setTitle(R.string.alert_title_failure) .setMessage(message).setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); sendErrToServerAndFinish(errorInternalName, exception); } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_CHECK, 1 + allowServerCheckIndex * 2); Log.i("Ringdroid", "Won't check again until " + (1 + allowServerCheckIndex * 2) + " errors."); prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.android.mms.ui.ComposeMessageActivity.java
private final void addCallAndContactMenuItems(ContextMenu menu, MsgListMenuClickListener l, MessageItem msgItem) {//from w w w .j a va2 s. co m if (TextUtils.isEmpty(msgItem.mBody)) { return; } SpannableString msg = new SpannableString(msgItem.mBody); Linkify.addLinks(msg, Linkify.ALL); ArrayList<String> uris = MessageUtils.extractUris(msg.getSpans(0, msg.length(), URLSpan.class)); // Remove any dupes so they don't get added to the menu multiple times HashSet<String> collapsedUris = new HashSet<String>(); for (String uri : uris) { collapsedUris.add(uri.toLowerCase()); } for (String uriString : collapsedUris) { String prefix = null; int sep = uriString.indexOf(":"); if (sep >= 0) { prefix = uriString.substring(0, sep); uriString = uriString.substring(sep + 1); } Uri contactUri = null; boolean knownPrefix = true; if ("mailto".equalsIgnoreCase(prefix)) { contactUri = getContactUriForEmail(uriString); } else if ("tel".equalsIgnoreCase(prefix)) { contactUri = getContactUriForPhoneNumber(uriString); } else { knownPrefix = false; } if (knownPrefix && contactUri == null) { Intent intent = ConversationList.createAddContactIntent(uriString); String addContactString = getString(R.string.menu_add_address_to_contacts, uriString); menu.add(0, MENU_ADD_ADDRESS_TO_CONTACTS, 0, addContactString).setOnMenuItemClickListener(l) .setIntent(intent); } } }
From source file:com.SpeechEd.SpeechEdEditActivity.java
private void handleFatalError(final CharSequence errorInternalName, final CharSequence errorString, final Exception exception) { Log.i("Speech-Ed", "handleFatalError"); SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); int failureCount = prefs.getInt(PREF_ERROR_COUNT, 0); final SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_ERROR_COUNT, failureCount + 1); prefsEditor.commit();/*from w w w . j av a 2 s . c o m*/ // Check if we already have a pref for whether or not we can // contact the server. int serverAllowed = prefs.getInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_UNKNOWN); if (serverAllowed == SERVER_ALLOWED_NO) { Log.i("Speech-Ed", "ERR: SERVER_ALLOWED_NO"); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } if (serverAllowed == SERVER_ALLOWED_YES) { Log.i("Speech-Ed", "SERVER_ALLOWED_YES"); new AlertDialog.Builder(SpeechEdEditActivity.this).setTitle(R.string.alert_title_failure) .setMessage(errorString) .setPositiveButton(R.string.alert_ok_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sendErrToServerAndFinish(errorInternalName, exception); return; } }).setCancelable(false).show(); return; } // The number of times the user must have had a failure before // we'll ask them. Defaults to 1, and each time they click "Later" // we double and add 1. final int allowServerCheckIndex = prefs.getInt(PREF_ERR_SERVER_CHECK, 1); if (failureCount < allowServerCheckIndex) { Log.i("Speech-Ed", "failureCount " + failureCount + " is less than " + allowServerCheckIndex); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } final SpannableString message = new SpannableString( errorString + ". " + getResources().getText(R.string.error_server_prompt)); Linkify.addLinks(message, Linkify.ALL); AlertDialog dialog = new AlertDialog.Builder(this).setTitle(R.string.alert_title_failure) .setMessage(message).setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); sendErrToServerAndFinish(errorInternalName, exception); } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_CHECK, 1 + allowServerCheckIndex * 2); Log.i("Speech-Ed", "Won't check again until " + (1 + allowServerCheckIndex * 2) + " errors."); prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.Beat.RingdroidEditActivity.java
private void handleFatalError(final CharSequence errorInternalName, final CharSequence errorString, final Exception exception) { Log.i("Ringdroid", "handleFatalError"); SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); int failureCount = prefs.getInt(PREF_ERROR_COUNT, 0); final SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_ERROR_COUNT, failureCount + 1); prefsEditor.commit();// w w w .ja v a 2 s. c o m // Check if we already have a pref for whether or not we can // contact the server. int serverAllowed = prefs.getInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_UNKNOWN); if (serverAllowed == SERVER_ALLOWED_NO) { Log.i("Ringdroid", "ERR: SERVER_ALLOWED_NO"); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } if (serverAllowed == SERVER_ALLOWED_YES) { Log.i("Ringdroid", "SERVER_ALLOWED_YES"); new AlertDialog.Builder(RingdroidEditActivity.this).setTitle(R.string.alert_title_failure) .setMessage(errorString) .setPositiveButton(R.string.alert_ok_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sendErrToServerAndFinish(errorInternalName, exception); return; } }).setCancelable(false).show(); return; } // The number of times the user must have had a failure before // we'll ask them. Defaults to 1, and each time they click "Later" // we double and add 1. final int allowServerCheckIndex = prefs.getInt(PREF_ERR_SERVER_CHECK, 1); if (failureCount < allowServerCheckIndex) { Log.i("Ringdroid", "failureCount " + failureCount + " is less than " + allowServerCheckIndex); // Just show a simple "write error" message showFinalAlert(exception, errorString); return; } final SpannableString message = new SpannableString( errorString + ". " + getResources().getText(R.string.error_server_prompt)); Linkify.addLinks(message, Linkify.ALL); AlertDialog dialog = new AlertDialog.Builder(this).setTitle(R.string.alert_title_failure) .setMessage(message).setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); sendErrToServerAndFinish(errorInternalName, exception); } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_CHECK, 1 + allowServerCheckIndex * 2); Log.i("Ringdroid", "Won't check again until " + (1 + allowServerCheckIndex * 2) + " errors."); prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:mobi.omegacentauri.ptimer.PTimerEditActivity.java
void showServerPrompt(final boolean userInitiated) { final SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); final SpannableString message = new SpannableString(getResources().getText(R.string.server_prompt)); Linkify.addLinks(message, Linkify.ALL); final AlertDialog dialog = new AlertDialog.Builder(PTimerEditActivity.this).setTitle(R.string.server_title) .setMessage(message).setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); if (userInitiated) { finish();//from ww w .jav a 2s. co m } else { sendStatsToServerAndFinish(); } } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int allowServerCheckIndex = prefs.getInt(PREF_STATS_SERVER_CHECK, 2); int successCount = prefs.getInt(PREF_SUCCESS_COUNT, 0); SharedPreferences.Editor prefsEditor = prefs.edit(); if (userInitiated) { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, successCount + 2); } else { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, allowServerCheckIndex * 2); } prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_NO); if (userInitiated) { // If the user initiated, err on the safe side and disable // sending crash reports too. There's no way to turn them // back on now aside from clearing data from this app, but // it doesn't matter, we don't need error reports from every // user ever. prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); } prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.SpeechEd.SpeechEdEditActivity.java
void showServerPrompt(final boolean userInitiated) { final SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); final SpannableString message = new SpannableString(getResources().getText(R.string.server_prompt)); Linkify.addLinks(message, Linkify.ALL); final AlertDialog dialog = new AlertDialog.Builder(SpeechEdEditActivity.this) .setTitle(R.string.server_title).setMessage(message) .setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); if (userInitiated) { finish();/*from w ww . j a va 2s. co m*/ } else { sendStatsToServerAndFinish(); } } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int allowServerCheckIndex = prefs.getInt(PREF_STATS_SERVER_CHECK, 2); int successCount = prefs.getInt(PREF_SUCCESS_COUNT, 0); SharedPreferences.Editor prefsEditor = prefs.edit(); if (userInitiated) { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, successCount + 2); } else { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, allowServerCheckIndex * 2); } prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_NO); if (userInitiated) { // If the user initiated, err on the safe side and disable // sending crash reports too. There's no way to turn them // back on now aside from clearing data from this app, but // it doesn't matter, we don't need error reports from every // user ever. prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); } prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.zertinteractive.wallpaper.MainActivity.java
public void helpDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater inflater = getLayoutInflater(); builder.setView(inflater.inflate(R.layout.info_dialog, null)); AlertDialog ad = builder.create();// ww w . j a va2s. c o m ad.setTitle("Mood Wallpaper"); ad.setButton(AlertDialog.BUTTON_NEGATIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); ad.show(); TextView noteView = (TextView) ad.findViewById(R.id.web_link); noteView.setText("www.somthing.com/zert"); Linkify.addLinks(noteView, Linkify.ALL); TextView email = (TextView) ad.findViewById(R.id.email_zert); email.setText("zert@gmail.com"); Linkify.addLinks(email, Linkify.EMAIL_ADDRESSES); }
From source file:com.Beat.RingdroidEditActivity.java
void showServerPrompt(final boolean userInitiated) { final SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); final SpannableString message = new SpannableString(getResources().getText(R.string.server_prompt)); Linkify.addLinks(message, Linkify.ALL); final AlertDialog dialog = new AlertDialog.Builder(RingdroidEditActivity.this) .setTitle(R.string.server_title).setMessage(message) .setPositiveButton(R.string.server_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_YES); prefsEditor.commit(); if (userInitiated) { finish();//from w ww . ja v a2 s . co m } else { sendStatsToServerAndFinish(); } } }).setNeutralButton(R.string.server_later, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int allowServerCheckIndex = prefs.getInt(PREF_STATS_SERVER_CHECK, 2); int successCount = prefs.getInt(PREF_SUCCESS_COUNT, 0); SharedPreferences.Editor prefsEditor = prefs.edit(); if (userInitiated) { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, successCount + 2); } else { prefsEditor.putInt(PREF_STATS_SERVER_CHECK, allowServerCheckIndex * 2); } prefsEditor.commit(); finish(); } }).setNegativeButton(R.string.server_never, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putInt(PREF_STATS_SERVER_ALLOWED, SERVER_ALLOWED_NO); if (userInitiated) { // If the user initiated, err on the safe side and disable // sending crash reports too. There's no way to turn them // back on now aside from clearing data from this app, but // it doesn't matter, we don't need error reports from every // user ever. prefsEditor.putInt(PREF_ERR_SERVER_ALLOWED, SERVER_ALLOWED_NO); } prefsEditor.commit(); finish(); } }).setCancelable(false).show(); // Make links clicky ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }