List of usage examples for android.text Html fromHtml
@Deprecated public static Spanned fromHtml(String source)
From source file:com.yonisamlan.android.metaqr.AttributionsActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView textView = new TextView(this); setContentView(textView);//from w w w . ja v a2 s . co m String html; try { html = IOUtils.toString(getResources().openRawResource(R.raw.licenses)); } catch (NotFoundException e) { e.printStackTrace(); html = "Error reading license."; } catch (IOException e) { e.printStackTrace(); html = "Error reading license."; } textView.setText(Html.fromHtml(html)); textView.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.achep.base.ui.fragments.dialogs.HelpDialog.java
@NonNull @Override// ww w . ja va2 s .c om public Dialog onCreateDialog(Bundle savedInstanceState) { String source = RawReader.readText(getActivity(), R.raw.faq); CharSequence message = Html.fromHtml(source); return new MaterialDialog.Builder(getActivity()).iconRes(R.drawable.ic_action_help_white) .title(R.string.help_dialog_title).content(message).negativeText(R.string.close).build(); }
From source file:com.rampgreen.caretakermobile.ui.LegalTerms.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); userid = this.getIntent().getStringExtra("userid"); UserName = this.getIntent().getStringExtra("UserName"); setTitle(UserName);/*from ww w . j a va 2 s . co m*/ setContentView(R.layout.legal_terms); TextView tv1 = (TextView) this.findViewById(R.id.TVlegalterms); tv1.setText(Html.fromHtml("<h2 style = \"align:center; vertical-align:middle;\">" + " Legal Terms</h2><br><p>This web page represents a legal document that serves as our Terms of Service and it governs the legal terms of our website, http://androidexample.com, sub-domains, and any associated web-based and mobile applications (collectively, Website), as owned and operated by AndroidExample.Capitalized terms, unless otherwise defined, have the meaning specified within the Definitions section below. This Terms of Service, along with our Privacy Policy, any mobile license agreement, and other posted guidelines within our Website, collectively Legal Terms, constitute the entire and only agreement between you and AndroidExample, and supersede all other agreements, representations, warranties and understandings with respect to our Website and the subject matter contained herein. We may amend our Legal Terms at any time without specific notice to you. The latest copies of our Legal Terms will be posted on our Website, and you should review all Legal Terms prior to using our Website. After any revisions to our Legal Terms are posted, you agree to be bound to any such changes to them. Therefore, it is important for you to periodically review our Legal Terms to make sure you still agree to them. By using our Website, you agree to fully comply with and be bound by our Legal Terms. Please review them carefully. If you do not accept our Legal Terms, do not access and use our Website. If you have already accessed our Website and do not accept our Legal Terms, you should immediately discontinue use of our Website.</p>")); Button btnAgree = (Button) this.findViewById(R.id.btnAgree); btnAgree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // if every field is valid, send request to RTNeuroserver response_accept(token, userid); finish(); } }); }
From source file:budgetworld.ru.bw.MyGcmListenerService.java
/** * Called when message is received.// w ww .java2 s .c om * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { String message = Html.fromHtml(data.getString("title")).toString(); System.out.println(data.getString("title")); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message); if (from.startsWith("/topics/")) { // message received from some topic. } else { // normal downstream message. } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ if (getPushSettings(getString(R.string.switch_setting))) { sendNotification(message); } // [END_EXCLUDE] }
From source file:de.vakuumverpackt.foul.About.java
private Spanned getText() { return Html.fromHtml(read(R.raw.about)); }
From source file:com.ubergeek42.WeechatAndroid.utils.UntrustedCertificateDialog.java
@NonNull @Override//from w ww.j a va 2 s . c om public Dialog onCreateDialog(Bundle savedInstanceState) { final int padding = (int) getResources().getDimension(R.dimen.dialog_padding_full); final ScrollView scrollView = new ScrollView(getContext()); final TextView textView = new AppCompatTextView(getContext()); textView.setText(Html.fromHtml(getCertificateDescription())); scrollView.addView(textView); return new AlertDialog.Builder(getContext()).setTitle(getString(R.string.ssl_cert_dialog_title)) .setView(scrollView, padding, padding / 2, padding, 0) .setPositiveButton(getString(R.string.ssl_cert_dialog_accept_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SSLHandler.getInstance(getContext()).trustCertificate(certificate); ((WeechatActivity) getActivity()).connect(); } }) .setNegativeButton(getString(R.string.ssl_cert_dialog_reject_button), null).create(); }
From source file:com.achep.acdisplay.DialogHelper.java
public static void showCryDialog(@NonNull ActionBarActivity activity) { Check.getInstance().isInMainThread(); Resources res = activity.getResources(); CharSequence message = Html.fromHtml(res.getString(R.string.cry_dialog_message)); new DialogBuilder(activity).setIcon(R.drawable.ic_action_about_white).setTitle(R.string.cry_dialog_title) .setMessage(message).createAlertDialogBuilder().setNegativeButton(R.string.close, null).create() .show();/*from w ww. ja v a 2 s .c o m*/ }
From source file:com.android.dialer.lookup.LookupUtils.java
public static String fromHtml(String input) { if (input == null) { return null; }/*from w ww .j a va2s. co m*/ return Html.fromHtml(input).toString().trim(); }
From source file:app.hacked.ScheduleWelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.schedule_welcome, null); ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); ((TextView) view.findViewById(R.id.Welcome)).setText(Html.fromHtml(getString(R.string.ScheduleWelcome))); ((TextView) view.findViewById(R.id.Welcome)).setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); Log.e("html", getString(R.string.ScheduleWelcome)); return view;//w w w . j ava2s . c o m }
From source file:com.alexcruz.papuhwalls.Credits.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.credits, null); this.Preferences = new Preferences(getContext()); context = getActivity();/*from w w w. jav a 2s . c om*/ ActionBar toolbar = ((ActionBarActivity) context).getSupportActionBar(); toolbar.setTitle(R.string.section_aboutapp); //Credits TextView credit_title = (TextView) root.findViewById(R.id.credit_title); credit_title.setTextColor(Preferences.PrimaryText()); TextView credit_desc = (TextView) root.findViewById(R.id.credit_desc); credit_desc.setText(Html.fromHtml(getString(R.string.credit_desc))); credit_desc.setTextColor(Preferences.SecondaryText()); //Free and open source text TextView freeandopensource_text = (TextView) root.findViewById(R.id.freeandopensource_text); freeandopensource_text.setTextColor(Preferences.PrimaryText()); //Library number two TextView libtwo_title = (TextView) root.findViewById(R.id.libtwo_title); libtwo_title.setTextColor(Preferences.PrimaryText()); TextView libtwo_content = (TextView) root.findViewById(R.id.libtwo_content); libtwo_content.setText(Html.fromHtml(getString(R.string.fab_desc))); libtwo_content.setTextColor(Preferences.SecondaryText()); TextView libtwo_license = (TextView) root.findViewById(R.id.libtwo_license); libtwo_license.setTextColor(Preferences.PrimaryText()); TextView libtwo_author = (TextView) root.findViewById(R.id.libtwo_author); libtwo_author.setTextColor(Preferences.SecondaryText()); //Library number three TextView libthree_title = (TextView) root.findViewById(R.id.libthree_title); libthree_title.setTextColor(Preferences.PrimaryText()); TextView libthree_content = (TextView) root.findViewById(R.id.libthree_content); libthree_content.setText(Html.fromHtml(getString(R.string.materialdialogs_desc))); libthree_content.setTextColor(Preferences.SecondaryText()); TextView libthree_license = (TextView) root.findViewById(R.id.libthree_license); libthree_license.setTextColor(Preferences.PrimaryText()); TextView libthree_author = (TextView) root.findViewById(R.id.libthree_author); libthree_author.setTextColor(Preferences.SecondaryText()); //Library number four TextView libfour_title = (TextView) root.findViewById(R.id.libfour_title); libfour_title.setTextColor(Preferences.PrimaryText()); TextView libfour_content = (TextView) root.findViewById(R.id.libfour_content); libfour_content.setText(Html.fromHtml(getString(R.string.materialdrawer_desc))); libfour_content.setTextColor(Preferences.SecondaryText()); TextView libfour_license = (TextView) root.findViewById(R.id.libfour_license); libfour_license.setTextColor(Preferences.PrimaryText()); TextView libfour_author = (TextView) root.findViewById(R.id.libfour_author); libfour_author.setTextColor(Preferences.SecondaryText()); //Library number five TextView libfive_title = (TextView) root.findViewById(R.id.libfive_title); libfive_title.setTextColor(Preferences.PrimaryText()); TextView libfive_content = (TextView) root.findViewById(R.id.libfive_content); libfive_content.setText(Html.fromHtml(getString(R.string.picasso_desc))); libfive_content.setTextColor(Preferences.SecondaryText()); TextView libfive_license = (TextView) root.findViewById(R.id.libfive_license); libfive_license.setTextColor(Preferences.PrimaryText()); TextView libfive_author = (TextView) root.findViewById(R.id.libfive_author); libfive_author.setTextColor(Preferences.SecondaryText()); //Library number six TextView libsix_title = (TextView) root.findViewById(R.id.libsix_title); libsix_title.setTextColor(Preferences.PrimaryText()); TextView libsix_content = (TextView) root.findViewById(R.id.libsix_content); libsix_content.setText(Html.fromHtml(getString(R.string.okhttp_desc))); libsix_content.setTextColor(Preferences.SecondaryText()); TextView libsix_license = (TextView) root.findViewById(R.id.libsix_license); libsix_license.setTextColor(Preferences.PrimaryText()); TextView libsix_author = (TextView) root.findViewById(R.id.libsix_author); libsix_author.setTextColor(Preferences.SecondaryText()); //Library number seven TextView libseven_title = (TextView) root.findViewById(R.id.libseven_title); libseven_title.setTextColor(Preferences.PrimaryText()); TextView libseven_content = (TextView) root.findViewById(R.id.libseven_content); libseven_content.setText(Html.fromHtml(getString(R.string.snackbar_desc))); libseven_content.setTextColor(Preferences.SecondaryText()); TextView libseven_license = (TextView) root.findViewById(R.id.libseven_license); libseven_license.setTextColor(Preferences.PrimaryText()); TextView libseven_author = (TextView) root.findViewById(R.id.libseven_author); libseven_author.setTextColor(Preferences.SecondaryText()); //Library number eight TextView libeight_title = (TextView) root.findViewById(R.id.libeight_title); libeight_title.setTextColor(Preferences.PrimaryText()); TextView libeight_content = (TextView) root.findViewById(R.id.libeight_content); libeight_content.setText(Html.fromHtml(getString(R.string.crash_desc))); libeight_content.setTextColor(Preferences.SecondaryText()); TextView libeight_license = (TextView) root.findViewById(R.id.libeight_license); libeight_license.setTextColor(Preferences.PrimaryText()); TextView libeight_author = (TextView) root.findViewById(R.id.libeight_author); libeight_author.setTextColor(Preferences.SecondaryText()); //Library number nine TextView libnine_title = (TextView) root.findViewById(R.id.libnine_title); libnine_title.setTextColor(Preferences.PrimaryText()); TextView libnine_content = (TextView) root.findViewById(R.id.libnine_content); libnine_content.setText(Html.fromHtml(getString(R.string.appintro_desc))); libnine_content.setTextColor(Preferences.SecondaryText()); TextView libnine_license = (TextView) root.findViewById(R.id.libnine_license); libnine_license.setTextColor(Preferences.PrimaryText()); TextView libnine_author = (TextView) root.findViewById(R.id.libnine_author); libnine_author.setTextColor(Preferences.SecondaryText()); //Library number ten TextView libten_title = (TextView) root.findViewById(R.id.libten_title); libten_title.setTextColor(Preferences.PrimaryText()); TextView libten_content = (TextView) root.findViewById(R.id.libten_content); libten_content.setText(Html.fromHtml(getString(R.string.materialripple_desc))); libten_content.setTextColor(Preferences.SecondaryText()); TextView libten_license = (TextView) root.findViewById(R.id.libten_license); libten_license.setTextColor(Preferences.PrimaryText()); TextView libten_author = (TextView) root.findViewById(R.id.libten_author); libten_author.setTextColor(Preferences.SecondaryText()); //Library number eleven TextView libeleven_title = (TextView) root.findViewById(R.id.libeleven_title); libeleven_title.setTextColor(Preferences.PrimaryText()); TextView libeleven_content = (TextView) root.findViewById(R.id.libeleven_content); libeleven_content.setText(Html.fromHtml(getString(R.string.materialpreference_desc))); libeleven_content.setTextColor(Preferences.SecondaryText()); TextView libeleven_license = (TextView) root.findViewById(R.id.libeleven_license); libeleven_license.setTextColor(Preferences.PrimaryText()); TextView libeleven_author = (TextView) root.findViewById(R.id.libeleven_author); libeleven_author.setTextColor(Preferences.SecondaryText()); //Library number twelve TextView libtwelve_title = (TextView) root.findViewById(R.id.libtwelve_title); libtwelve_title.setTextColor(Preferences.PrimaryText()); TextView libtwelve_content = (TextView) root.findViewById(R.id.libtwelve_content); libtwelve_content.setText(Html.fromHtml(getString(R.string.licensesdialog_desc))); libtwelve_content.setTextColor(Preferences.SecondaryText()); TextView libtwelve_license = (TextView) root.findViewById(R.id.libtwelve_license); libtwelve_license.setTextColor(Preferences.PrimaryText()); TextView libtwelve_author = (TextView) root.findViewById(R.id.libtwelve_author); libtwelve_author.setTextColor(Preferences.SecondaryText()); //Library source buttons TextView credit = (TextView) root.findViewById(R.id.github_button); credit.setTextColor(Preferences.Accent()); credit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent credit = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.jahir_link))); startActivity(credit); } }); TextView fab_web = (TextView) root.findViewById(R.id.floating_github_button); fab_web.setTextColor(Preferences.Accent()); fab_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent fab_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.fab_web))); startActivity(fab_web); } }); TextView materialdialogs_web = (TextView) root.findViewById(R.id.dialogs_github_button); materialdialogs_web.setTextColor(Preferences.Accent()); materialdialogs_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialdialogs_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialdialogs_web))); startActivity(materialdialogs_web); } }); TextView materialdrawer_web = (TextView) root.findViewById(R.id.materialdrawer_github_button); materialdrawer_web.setTextColor(Preferences.Accent()); materialdrawer_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialdrawer_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialdrawer_web))); startActivity(materialdrawer_web); } }); TextView picasso_web = (TextView) root.findViewById(R.id.picasso_github_button); picasso_web.setTextColor(Preferences.Accent()); picasso_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent picasso_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.picasso_web))); startActivity(picasso_web); } }); TextView okhttp_web = (TextView) root.findViewById(R.id.okhttp_github_button); okhttp_web.setTextColor(Preferences.Accent()); okhttp_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent okhttp_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.okhttp_web))); startActivity(okhttp_web); } }); TextView snackbar_web = (TextView) root.findViewById(R.id.snackbar_github_button); snackbar_web.setTextColor(Preferences.Accent()); snackbar_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent snackbar_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.snackbar_web))); startActivity(snackbar_web); } }); TextView crash_web = (TextView) root.findViewById(R.id.crash_github_button); crash_web.setTextColor(Preferences.Accent()); crash_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent crash_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.crash_web))); startActivity(crash_web); } }); TextView appintro_web = (TextView) root.findViewById(R.id.appintro_github_button); appintro_web.setTextColor(Preferences.Accent()); appintro_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent appintro_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.appintro_web))); startActivity(appintro_web); } }); TextView materialripple_web = (TextView) root.findViewById(R.id.materialripple_github_button); materialripple_web.setTextColor(Preferences.Accent()); materialripple_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialripple_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialripple_web))); startActivity(materialripple_web); } }); TextView materialpreference_web = (TextView) root.findViewById(R.id.materialpreference_github_button); materialpreference_web.setTextColor(Preferences.Accent()); materialpreference_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent materialpreference_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.materialpreference_web))); startActivity(materialpreference_web); } }); TextView licensesdialog_web = (TextView) root.findViewById(R.id.licensesdialog_github_button); licensesdialog_web.setTextColor(Preferences.Accent()); licensesdialog_web.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent licensesdialog_web = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.licensesdialog_web))); startActivity(licensesdialog_web); } }); return root; }