List of usage examples for android.widget TextView setMovementMethod
public final void setMovementMethod(MovementMethod movement)
From source file:de.da_sense.moses.client.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mThisInstance = this; if (container == null) { return null; } else {/*from w w w. j av a 2s . c o m*/ container.setBackgroundColor(getResources().getColor(android.R.color.background_light)); // get the arguments final String appname; String description; String startDate, endDate, apkVersion; ArrayList<Integer> sensors; // if this gets started as a fragment if (savedInstanceState == null) { Log.d(LOG_TAG, "savedInstance == null"); savedInstanceState = getArguments(); Log.d(LOG_TAG, "NOW savedInstance = " + savedInstanceState); } // supposed to show a placeholder? String placeholder = savedInstanceState.getString("de.da_sense.moses.client.placeholder"); if (placeholder != null && placeholder.equals("yes")) { // inflate the placeholder Log.d(LOG_TAG, "onCreateView about to inflate PLACEHOLDER"); mDetailFragmentView = inflater.inflate(R.layout.app_info_placeholder, container, false); } else { // normal display of details // retrieve the arguments mIndex = savedInstanceState.getInt("de.da_sense.moses.client.index"); mBelongsTo = savedInstanceState.getInt(WelcomeActivity.KEY_BELONGS_TO); appname = savedInstanceState.getString("de.da_sense.moses.client.appname"); description = savedInstanceState.getString("de.da_sense.moses.client.description"); sensors = savedInstanceState.getIntegerArrayList("de.da_sense.moses.client.sensors"); mAPKID = savedInstanceState.getString(ExternalApplication.KEY_APK_ID); apkVersion = savedInstanceState.getString("de.da_sense.moses.client.apkVersion"); startDate = savedInstanceState.getString("de.da_sense.moses.client.startDate"); endDate = savedInstanceState.getString("de.da_sense.moses.client.endDate"); Log.d(LOG_TAG, "\nretrieved index = " + mIndex + "\nretrieved belongsTo = " + mBelongsTo + "\nretrieved appname = " + appname + "\nretireved description = " + description + "\nretireved sensors = " + sensors + "\nretireved apkid = " + mAPKID + "\nretireved startDate = " + startDate + "\nretireved endDate = " + endDate + "\nretireved apkVersion = " + apkVersion); if (appname != null) { // inflate the detail view Log.d(LOG_TAG, "onCreateView about to inflate View"); mDetailFragmentView = inflater.inflate(R.layout.app_info, container, false); // insert app name TextView t = (TextView) mDetailFragmentView.findViewById(R.id.usname); t.setText(appname); // insert description t = (TextView) mDetailFragmentView.findViewById(R.id.description); t.setMovementMethod(ScrollingMovementMethod.getInstance()); t.setText(description); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_startdate); t.setText(startDate); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_enddate); t.setText(endDate); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_apkversion); t.setText(apkVersion); } else { Log.e(LOG_TAG, "User study's informations are missing"); return null; } } return mDetailFragmentView; } }
From source file:com.razza.apps.iosched.myschedule.MyScheduleActivity.java
private void showAnnouncementDialogIfNeeded(Intent intent) { final String title = intent.getStringExtra(EXTRA_DIALOG_TITLE); final String message = intent.getStringExtra(EXTRA_DIALOG_MESSAGE); if (!mShowedAnnouncementDialog && !TextUtils.isEmpty(title) && !TextUtils.isEmpty(message)) { LogUtils.LOGD(TAG, "showAnnouncementDialogIfNeeded, title: " + title); LogUtils.LOGD(TAG, "showAnnouncementDialogIfNeeded, message: " + message); final String yes = intent.getStringExtra(EXTRA_DIALOG_YES); LogUtils.LOGD(TAG, "showAnnouncementDialogIfNeeded, yes: " + yes); final String no = intent.getStringExtra(EXTRA_DIALOG_NO); LogUtils.LOGD(TAG, "showAnnouncementDialogIfNeeded, no: " + no); final String url = intent.getStringExtra(EXTRA_DIALOG_URL); LogUtils.LOGD(TAG, "showAnnouncementDialogIfNeeded, url: " + url); final SpannableString spannable = new SpannableString(message == null ? "" : message); Linkify.addLinks(spannable, Linkify.WEB_URLS); AlertDialog.Builder builder = new AlertDialog.Builder(this); if (!TextUtils.isEmpty(title)) { builder.setTitle(title);/* ww w .j av a 2 s.co m*/ } builder.setMessage(spannable); if (!TextUtils.isEmpty(no)) { builder.setNegativeButton(no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); } if (!TextUtils.isEmpty(yes)) { builder.setPositiveButton(yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); } }); } final AlertDialog dialog = builder.create(); dialog.show(); final TextView messageView = (TextView) dialog.findViewById(android.R.id.message); if (messageView != null) { // makes the embedded links in the text clickable, if there are any messageView.setMovementMethod(LinkMovementMethod.getInstance()); } mShowedAnnouncementDialog = true; } }
From source file:com.anysoftkeyboard.ui.settings.AboutAnySoftKeyboardFragment.java
@Override public void onViewStateRestored(Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); TextView additionalSoftware = (TextView) getView().findViewById(R.id.about_legal_stuff_link); SpannableStringBuilder sb = new SpannableStringBuilder(additionalSoftware.getText()); sb.clearSpans();//removing any previously (from instance-state) set click spans. sb.setSpan(new ClickableSpan() { @Override//from ww w . j a v a2s.c o m public void onClick(View widget) { FragmentChauffeurActivity activity = (FragmentChauffeurActivity) getActivity(); activity.addFragmentToUi(new AdditionalSoftwareLicensesFragment(), FragmentChauffeurActivity.FragmentUiContext.DeeperExperience); } }, 0, additionalSoftware.getText().length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); additionalSoftware.setMovementMethod(LinkMovementMethod.getInstance()); additionalSoftware.setText(sb); }
From source file:com.kyakujin.android.autoeco.ui.MainActivity.java
/** * About//from w w w . ja va2s.c om */ private void showAboutDialog() { PackageManager pm = this.getPackageManager(); String packageName = this.getPackageName(); String versionName; try { PackageInfo info = pm.getPackageInfo(packageName, 0); versionName = info.versionName; } catch (PackageManager.NameNotFoundException e) { versionName = "N/A"; } SpannableStringBuilder aboutBody = new SpannableStringBuilder(); SpannableString mailAddress = new SpannableString(getString(R.string.mailto)); mailAddress.setSpan(new ClickableSpan() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse(getString(R.string.description_mailto))); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.description_mail_subject)); startActivity(intent); } }, 0, mailAddress.length(), 0); aboutBody.append(Html.fromHtml(getString(R.string.about_body, versionName))); aboutBody.append("\n"); aboutBody.append(mailAddress); LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.fragment_about_dialog, null); aboutBodyView.setText(aboutBody); aboutBodyView.setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog dlg = new AlertDialog.Builder(this).setTitle(R.string.alert_title_about).setView(aboutBodyView) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); dlg.show(); }
From source file:com.amaze.filemanager.fragments.preference_fragments.Preffrag.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceUtils.reset();// w w w. java2s . co m // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); final int th1 = Integer.parseInt(sharedPref.getString("theme", "0")); theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1; findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { ((com.amaze.filemanager.activities.Preferences) getActivity()).donate(); return false; } }); findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { final String[] sort = getResources().getStringArray(R.array.columns); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.gridcolumnno); int current = Integer.parseInt(sharedPref.getString("columns", "-1")); current = current == -1 ? 0 : current; if (current != 0) current = current - 1; a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit(); dialog.dismiss(); return true; } }); a.build().show(); return true; } }); findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] sort = getResources().getStringArray(R.array.theme); int current = Integer.parseInt(sharedPref.getString("theme", "0")); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("theme", "" + which).commit(); dialog.dismiss(); restartPC(getActivity()); return true; } }); a.title(R.string.theme); a.build().show(); return true; } }); findPreference("colors").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { ((com.amaze.filemanager.activities.Preferences) getActivity()).selectItem(1); return true; } }); final CheckBx rootmode = (CheckBx) findPreference("rootmode"); rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { boolean b = sharedPref.getBoolean("rootmode", false); if (b) { if (RootTools.isAccessGiven()) { rootmode.setChecked(true); } else { rootmode.setChecked(false); Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure), Toast.LENGTH_LONG).show(); } } else { rootmode.setChecked(false); } return false; } }); // Authors Preference preference4 = (Preference) findPreference("authors"); preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); skin = PreferenceUtils.getPrimaryColorString(sharedPref); int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref)); if (theme == 1) a.theme(Theme.DARK); a.positiveText(R.string.close); a.positiveColor(fab_skin); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(R.layout.authors, null); a.customView(view, true); a.title(R.string.authors); a.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { materialDialog.cancel(); } @Override public void onNegative(MaterialDialog materialDialog) { } }); /*a.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } });*/ a.build().show(); final Intent intent = new Intent(Intent.ACTION_VIEW); TextView googlePlus1 = (TextView) view.findViewById(R.id.googlePlus1); googlePlus1.setTextColor(Color.parseColor(skin)); TextView googlePlus2 = (TextView) view.findViewById(R.id.googlePlus2); googlePlus2.setTextColor(Color.parseColor(skin)); TextView git1 = (TextView) view.findViewById(R.id.git1); git1.setTextColor(Color.parseColor(skin)); TextView git2 = (TextView) view.findViewById(R.id.git2); git2.setTextColor(Color.parseColor(skin)); googlePlus1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://plus.google.com/u/0/110424067388738907251/")); startActivity(intent); } }); googlePlus2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://plus.google.com/+VishalNehra/")); startActivity(intent); } }); git1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://github.com/arpitkh96")); startActivity(intent); } }); git2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://github.com/vishal0071")); startActivity(intent); } }); // icon credits TextView textView = (TextView) view.findViewById(R.id.icon_credits); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setLinksClickable(true); textView.setText(Html.fromHtml(getActivity().getString(R.string.icon_credits))); return false; } }); // Changelog Preference preference1 = (Preference) findPreference("changelog"); preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.changelog); a.content(Html.fromHtml(getActivity().getString(R.string.changelog_version_9) + getActivity().getString(R.string.changelog_change_9) + getActivity().getString(R.string.changelog_version_8) + getActivity().getString(R.string.changelog_change_8) + getActivity().getString(R.string.changelog_version_7) + getActivity().getString(R.string.changelog_change_7) + getActivity().getString(R.string.changelog_version_6) + getActivity().getString(R.string.changelog_change_6) + getActivity().getString(R.string.changelog_version_5) + getActivity().getString(R.string.changelog_change_5) + getActivity().getString(R.string.changelog_version_4) + getActivity().getString(R.string.changelog_change_4) + getActivity().getString(R.string.changelog_version_3) + getActivity().getString(R.string.changelog_change_3) + getActivity().getString(R.string.changelog_version_2) + getActivity().getString(R.string.changelog_change_2) + getActivity().getString(R.string.changelog_version_1) + getActivity().getString(R.string.changelog_change_1))); a.negativeText(R.string.close); a.positiveText(R.string.fullChangelog); int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref)); a.positiveColor(fab_skin); a.negativeColor(fab_skin); a.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/arpitkh96/AmazeFileManager/commits/master")); startActivity(intent); } @Override public void onNegative(MaterialDialog materialDialog) { materialDialog.cancel(); } }).build().show(); return false; } }); // Open Source Licenses Preference preference2 = (Preference) findPreference("os"); //Defining dialog layout final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar); //dialog.setTitle("Open-Source Licenses"); LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE); final View dialog_view = inflater.inflate(R.layout.open_source_licenses, null); dialog.setContentView(dialog_view); preference2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { WebView wv = (WebView) dialog_view.findViewById(R.id.webView1); PreferenceUtils preferenceUtils = new PreferenceUtils(); wv.loadData(PreferenceUtils.LICENCE_TERMS, "text/html", null); dialog.show(); return false; } }); // Feedback Preference preference3 = (Preference) findPreference("feedback"); preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "arpitkh96@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager"); Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show(); File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt"); if (f.exists()) { emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); } startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback))); return false; } }); // rate Preference preference5 = (Preference) findPreference("rate"); preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=com.amaze.filemanager")); startActivity(intent1); return false; } }); // studio Preference studio = findPreference("studio"); studio.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { COUNT++; if (COUNT >= 5) { if (toast != null) toast.cancel(); toast = Toast.makeText(getActivity(), "Studio Mode : " + COUNT, Toast.LENGTH_SHORT); toast.show(); sharedPref.edit().putInt("studio", Integer.parseInt(Integer.toString(COUNT) + "000")).apply(); } else { sharedPref.edit().putInt("studio", 0).apply(); } return false; } }); // G+ gplus = (CheckBx) findPreference("plus_pic"); gplus.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (gplus.isChecked()) { boolean b = checkGplusPermission(); if (!b) requestGplusPermission(); } return false; } }); if (BuildConfig.IS_VERSION_FDROID) gplus.setEnabled(false); // Colored navigation bar }
From source file:com.r.raul.tools.MainActivity.java
private void msgTraductor() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); LayoutInflater inflater = getLayoutInflater(); final View dialogView = inflater.inflate(R.layout.dialog_idiomas, null); dialogBuilder.setView(dialogView);/*from w w w. ja va 2 s . com*/ final TextView txt0 = (TextView) dialogView.findViewById(R.id.titu0); final TextView txt1 = (TextView) dialogView.findViewById(R.id.titu1); final TextView txt2 = (TextView) dialogView.findViewById(R.id.titu2); String urlM = "<a href=" + getString(R.string.url1_idiomas) + ">" + getString(R.string.p2_idiomas) + "</a>"; String urlD = "<a href='" + getString(R.string.url2_idiomas) + "'>" + getString(R.string.p3_idiomas) + "</a>"; dialogBuilder.setTitle(R.string.titu_idiomas); //Idiomas Languages txt0.setText(R.string.p1_idiomas); txt1.setMovementMethod(LinkMovementMethod.getInstance()); txt2.setMovementMethod(LinkMovementMethod.getInstance()); txt1.setText(Html.fromHtml(urlM)); txt2.setText(Html.fromHtml(urlD)); dialogBuilder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); AlertDialog b = dialogBuilder.create(); b.show(); }
From source file:org.uguess.android.sysinfo.NetStateManager.java
static void showIpInfo(final IpInfo info, final Activity context) { if (info != null && !TextUtils.isEmpty(info.latitude) && !TextUtils.isEmpty(info.longitude)) { OnClickListener listener = new OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent it = new Intent(Intent.ACTION_VIEW); it.setData(Uri.parse("geo:0,0?q=" //$NON-NLS-1$ + info.latitude + "," //$NON-NLS-1$ + info.longitude + "&z=8")); //$NON-NLS-1$ it = Intent.createChooser(it, null); context.startActivity(it); }// w w w . j a v a2 s .co m }; TextView txt = new TextView(context); txt.setPadding(15, 0, 15, 0); txt.setTextAppearance(context, android.R.style.TextAppearance_Medium); txt.setText(Html.fromHtml(context.getString( R.string.location_info, info.ip, info.host == null ? "" //$NON-NLS-1$ : ("<a href=\"http://" //$NON-NLS-1$ + info.host + "\">" //$NON-NLS-1$ + info.host + "</a><br>"), //$NON-NLS-1$ info.country == null ? "" : info.country, //$NON-NLS-1$ info.region == null ? "" : info.region, //$NON-NLS-1$ info.city == null ? "" : info.city))); //$NON-NLS-1$ txt.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(context).setTitle(R.string.ip_location) .setPositiveButton(R.string.view_map, listener).setNegativeButton(R.string.close, null) .setView(txt).create().show(); } else { Util.shortToast(context, R.string.no_ip_info); } }
From source file:org.odk.collect.android.widgets.QuestionWidget.java
private MediaLayout createQuestionMediaLayout(FormEntryPrompt prompt) { String promptText = prompt.getLongText(); // Add the text view. Textview always exists, regardless of whether there's text. TextView questionText = new TextView(getContext()); questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize); questionText.setTypeface(null, Typeface.BOLD); questionText.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor)); questionText.setPadding(0, 0, 0, 7); questionText.setText(promptText == null ? "" : TextUtils.textToHtml(promptText)); questionText.setMovementMethod(LinkMovementMethod.getInstance()); // Wrap to the size of the parent view questionText.setHorizontallyScrolling(false); if (promptText == null || promptText.length() == 0) { questionText.setVisibility(GONE); }// w ww .jav a 2 s . com String imageURI = prompt.getImageText(); String audioURI = prompt.getAudioText(); String videoURI = prompt.getSpecialFormQuestionText("video"); // shown when image is clicked String bigImageURI = prompt.getSpecialFormQuestionText("big-image"); // Create the layout for audio, image, text MediaLayout questionMediaLayout = new MediaLayout(getContext(), player); questionMediaLayout.setId(ViewIds.generateViewId()); // assign random id questionMediaLayout.setAVT(prompt.getIndex(), "", questionText, audioURI, imageURI, videoURI, bigImageURI); questionMediaLayout.setAudioListener(this); String playColorString = prompt.getFormElement().getAdditionalAttribute(null, "playColor"); if (playColorString != null) { try { playColor = Color.parseColor(playColorString); } catch (IllegalArgumentException e) { Timber.e(e, "Argument %s is incorrect", playColorString); } } questionMediaLayout.setPlayTextColor(playColor); String playBackgroundColorString = prompt.getFormElement().getAdditionalAttribute(null, "playBackgroundColor"); if (playBackgroundColorString != null) { try { playBackgroundColor = Color.parseColor(playBackgroundColorString); } catch (IllegalArgumentException e) { Timber.e(e, "Argument %s is incorrect", playBackgroundColorString); } } questionMediaLayout.setPlayTextBackgroundColor(playBackgroundColor); return questionMediaLayout; }
From source file:com.lloydtorres.stately.helpers.SparkleHelper.java
/** * Stylify text view to primary colour and no underline * @param c App context//from www .ja va 2 s .c o m * @param t TextView */ public static void styleLinkifiedTextView(Context c, TextView t) { // Get individual spans and replace them with clickable ones. Spannable s = new SpannableString(t.getText()); URLSpan[] spans = s.getSpans(0, s.length(), URLSpan.class); for (URLSpan span : spans) { int start = s.getSpanStart(span); int end = s.getSpanEnd(span); s.removeSpan(span); span = new URLSpanNoUnderline(c, span.getURL()); s.setSpan(span, start, end, 0); } t.setText(s); // Need to set this to allow for clickable TextView links. if (!(t instanceof HtmlTextView)) { t.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:es.farfuteam.vncpp.controller.ActivityTabs.java
/** * @return The new dialog//from w w w . ja v a 2 s . c o m * @brief Shows the dialog to indicate about info * @details Shows the dialog to indicate about info */ private Dialog createAboutDialog() { //necesario para poder clicar en los links final TextView message = new TextView(this); final SpannableString s = new SpannableString(this.getText(R.string.about_message)); Linkify.addLinks(s, Linkify.WEB_URLS); message.setText(s); message.setMovementMethod(LinkMovementMethod.getInstance()); return new AlertDialog.Builder(this).setTitle(R.string.about_title).setView(message) .setPositiveButton(R.string.about_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Auto-generated method stub } }).show(); }