List of usage examples for android.text Html fromHtml
@Deprecated public static Spanned fromHtml(String source)
From source file:com.eyekabob.VenueInfo.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.venue_info); findViewById(R.id.findLiveMusicButton).setOnClickListener(linksListener); findViewById(R.id.aboutButton).setOnClickListener(linksListener); findViewById(R.id.contactButton).setOnClickListener(linksListener); Venue thisVenue = (Venue) getIntent().getExtras().get("venue"); Map<String, String> params = new HashMap<String, String>(); params.put("venue", thisVenue.getId()); TextView nameView = (TextView) findViewById(R.id.venueNameView); nameView.setText(thisVenue.getName()); TextView infoView = (TextView) findViewById(R.id.venueInfoView); nameView.setText(thisVenue.getName()); String venueDesc = ""; // TODO: Padding instead of whitespace if (!thisVenue.getCity().equals("") && !thisVenue.getStreet().equals("")) { // TODO: I18N venueDesc += "Address:\n " + thisVenue.getStreet() + "\n " + thisVenue.getCity(); }/*from ww w .j ava 2 s . c o m*/ infoView.setText(venueDesc); TextView websiteView = (TextView) findViewById(R.id.venueMoreInfoView); if (!"".equals((thisVenue.getUrl().toString()))) { // TODO: I18N websiteView.setText(Html.fromHtml("<a href=\"" + thisVenue.getUrl() + "\">More Information</a>")); websiteView.setMovementMethod(LinkMovementMethod.getInstance()); } Uri uri = EyekabobHelper.LastFM.getUri("venue.getEvents", params); new RequestTask().execute(uri.toString()); }
From source file:edu.berkeley.boinc.adapter.NoticesListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final Notice listItem = entries.get(position); LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = vi.inflate(R.layout.notices_layout_listitem, null); ImageView ivIcon = (ImageView) v.findViewById(R.id.projectIcon); Bitmap icon = getIcon(position);/*from w ww. ja va 2s. c o m*/ // if available set icon, if not boinc logo if (icon == null) { ivIcon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.boinc)); } else { ivIcon.setImageBitmap(icon); } TextView tvProjectName = (TextView) v.findViewById(R.id.projectName); tvProjectName.setText(listItem.project_name); TextView tvNoticeTitle = (TextView) v.findViewById(R.id.noticeTitle); tvNoticeTitle.setText(listItem.title); TextView tvNoticeContent = (TextView) v.findViewById(R.id.noticeContent); tvNoticeContent.setText(Html.fromHtml(listItem.description)); TextView tvNoticeTime = (TextView) v.findViewById(R.id.noticeTime); tvNoticeTime.setText(DateUtils.formatDate(new java.util.Date((long) listItem.create_time * 1000))); v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (Logging.DEBUG) Log.d(Logging.TAG, "noticeClick: " + listItem.link); if (listItem.link != null && !listItem.link.isEmpty()) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(listItem.link)); activity.startActivity(i); } } }); return v; }
From source file:ca.etsmtl.applets.etsmobile.adapters.NewsCursorAdapter.java
@Override public void bindView(final View view, final Context context, final Cursor cursor) { ViewHolder holder = (ViewHolder) view.getTag(R.string.viewholdercontenttag); if (holder == null) { holder = new ViewHolder(); holder.title = (TextView) view.findViewById(R.id.newsListItemTitle); holder.date = (TextView) view.findViewById(R.id.newsListItemDate); holder.description = (TextView) view.findViewById(R.id.newsListItemDescription); holder.logo = (TextView) view.findViewById(R.id.newsListItemLogo); view.setTag(R.string.viewholdercontenttag, holder); }/* www.j a v a 2 s .co m*/ title = cursor.getString(cursor.getColumnIndex(NewsTableHelper.NEWS_TITLE)); holder.title.setText(Html.fromHtml(title)); holder.date.setText(dateFormat.format(cursor.getLong(cursor.getColumnIndex(NewsTableHelper.NEWS_DATE)))); description = cursor.getString(cursor.getColumnIndex(NewsTableHelper.NEWS_DESCRIPTION)); if (description.length() > 200) { holder.description.setText(Html.fromHtml(description.substring(0, 180))); } else { holder.description.setText(Html.fromHtml(description)); } source = cursor.getString(cursor.getColumnIndex(NewsTableHelper.NEWS_SOURCE)); if (source.equals(NewsService.RSS_ETS)) { holder.logo.setBackgroundDrawable(webLogo); } if (source.equals(NewsService.FACEBOOK)) { holder.logo.setBackgroundDrawable(facebookLogo); } if (source.equals(NewsService.TWITTER)) { holder.logo.setBackgroundDrawable(twitterLogo); } if (source.equals(NewsService.INTERFACE)) { holder.logo.setBackgroundDrawable(interfaceLogo); } view.setTag(R.string.viewholderidtag, cursor.getInt(cursor.getColumnIndex(NewsTableHelper.NEWS_ID))); }
From source file:com.tigerpenguin.places.model.JsonModel.java
public static final Spanned squashHtmlStringList(List<String> htmlStringList, String delimiter) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String htmlString : htmlStringList) { if (first) { first = false;/*from ww w . j av a 2 s. c o m*/ } else { sb.append(delimiter); } sb.append(htmlString); } return Html.fromHtml(sb.toString()); }
From source file:co.dilaver.quoter.fragments.CreditsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_credits, container, false); TextView androidLink = (TextView) view.findViewById(R.id.tvAndroidLink); TextView androidSupportLibraryLink = (TextView) view.findViewById(R.id.tvAndroidSupportLibraryLink); TextView asyncHTTPLink = (TextView) view.findViewById(R.id.tvAsyncHTTPLink); TextView gsonLink = (TextView) view.findViewById(R.id.tvGsonLink); TextView autoTextViewLink = (TextView) view.findViewById(R.id.tvAutoTextViewLink); TextView lobsterpickerLink = (TextView) view.findViewById(R.id.tvLobsterpickerLink); TextView fButtonLink = (TextView) view.findViewById(R.id.tvFButtonLink); TextView jSoupLink = (TextView) view.findViewById(R.id.tvJSoupLink); TextView circleImageViewLink = (TextView) view.findViewById(R.id.tvCircleImageViewLink); TextView googleCredit = (TextView) view.findViewById(R.id.tvGoogleCredit); TextView freepikCredit = (TextView) view.findViewById(R.id.tvFreepikCredit); TextView qodCredit = (TextView) view.findViewById(R.id.tvQodCredit); TextView popularCredit = (TextView) view.findViewById(R.id.tvPopularCredit); TextView fontsCredit = (TextView) view.findViewById(R.id.tvFontsCredit); TextView backgroundCredit = (TextView) view.findViewById(R.id.tvBackgroundCredit); androidLink.setMovementMethod(LinkMovementMethod.getInstance()); androidSupportLibraryLink.setMovementMethod(LinkMovementMethod.getInstance()); asyncHTTPLink.setMovementMethod(LinkMovementMethod.getInstance()); gsonLink.setMovementMethod(LinkMovementMethod.getInstance()); autoTextViewLink.setMovementMethod(LinkMovementMethod.getInstance()); lobsterpickerLink.setMovementMethod(LinkMovementMethod.getInstance()); fButtonLink.setMovementMethod(LinkMovementMethod.getInstance()); jSoupLink.setMovementMethod(LinkMovementMethod.getInstance()); circleImageViewLink.setMovementMethod(LinkMovementMethod.getInstance()); googleCredit.setText(Html.fromHtml(getString(R.string.str_googleCredit))); googleCredit.setMovementMethod(LinkMovementMethod.getInstance()); freepikCredit.setText(Html.fromHtml(getString(R.string.str_freepikCredit))); freepikCredit.setMovementMethod(LinkMovementMethod.getInstance()); qodCredit.setMovementMethod(LinkMovementMethod.getInstance()); popularCredit.setMovementMethod(LinkMovementMethod.getInstance()); fontsCredit.setMovementMethod(LinkMovementMethod.getInstance()); backgroundCredit.setMovementMethod(LinkMovementMethod.getInstance()); return view;//from w w w . j av a2s .c o m }
From source file:app.hacked.WorkShopsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); String url = "http://hackedioapp.networksaremadeofstring.co.uk/workshops.php"; JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override//from w ww .j a va 2 s .com public void onResponse(JSONObject response) { try { if (response.has("success") && response.getBoolean("success") && response.has("workshops")) { Log.e("response", response.toString()); workshopPayload.setText(Html.fromHtml(response.getString("workshops"))); progressBar.setVisibility(View.GONE); } else { Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT) .show(); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT).show(); } }); queue.add(jsObjRequest); }
From source file:com.battlelancer.seriesguide.adapters.SearchResultsAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (!mDataValid) { throw new IllegalStateException("this should only be called when the cursor is valid"); }/*from ww w .j ava 2 s . c o m*/ if (!mCursor.moveToPosition(position)) { throw new IllegalStateException("couldn't move cursor to position " + position); } final ViewHolder viewHolder; if (convertView == null) { convertView = newView(mContext, mCursor, parent); viewHolder = new ViewHolder(); viewHolder.showTitle = (TextView) convertView.findViewById(R.id.textViewShowTitle); viewHolder.episodeTitle = (TextView) convertView.findViewById(R.id.textViewEpisodeTitle); viewHolder.searchSnippet = (TextView) convertView.findViewById(R.id.textViewSearchSnippet); viewHolder.watchedStatus = (ImageView) convertView.findViewById(R.id.imageViewWatchedStatus); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.showTitle.setText(mCursor.getString(SearchQuery.SHOW_TITLE)); viewHolder.watchedStatus.setImageResource(EpisodeTools.isWatched(mCursor.getInt(SearchQuery.WATCHED)) ? Utils.resolveAttributeToResourceId(mContext.getTheme(), R.attr.drawableWatched) : Utils.resolveAttributeToResourceId(mContext.getTheme(), R.attr.drawableWatch)); // ensure matched term is bold viewHolder.searchSnippet.setText(Html.fromHtml(mCursor.getString(SearchQuery.OVERVIEW))); // episode int number = mCursor.getInt(SearchQuery.NUMBER); int season = mCursor.getInt(SearchQuery.SEASON); String title = mCursor.getString(SearchQuery.TITLE); viewHolder.episodeTitle.setText(Utils.getNextEpisodeString(mContext, season, number, title)); return convertView; }
From source file:com.bdevlin.apps.ui.activity.core.HelpActivity.java
private void initFragments() { mFragments = new ArrayList<>(); Resources res = getResources(); String[] helpTitles = res.getStringArray(R.array.help_screens); int[] helpKeys = res.getIntArray(R.array.help_keys); int length = helpTitles.length; String message = String.format(res.getString(R.string.welcome_messages), "Help", length); CharSequence styledText = Html.fromHtml(message); if (helpKeys.length != length) { if (DEBUG) Log.e(TAG, "Mismatch between keys length " + helpKeys.length + " and titles " + length); length = Math.min(length, helpKeys.length); }//from w ww. j a v a 2s . c o m for (int i = 0; i < length; i++) { HelpListFragment fragment = new HelpListFragment(); Bundle args = new Bundle(); int index = helpKeys[i]; String idKey = "help" + index; int contentId = res.getIdentifier(idKey, "string", getPackageName()); CharSequence content = getText(contentId); args.putCharSequence(HelpListFragment.CONTENT, content); args.putString(HelpListFragment.TITLE, helpTitles[index]); args.putCharSequence(HelpListFragment.MESSAGE, styledText); fragment.setArguments(args); mFragments.add(fragment); } // few magic numbers for good luck... mQueryIndex = new HashMap<ListQuery, Integer>(); mQueryIndex.put(ListQuery.inbox, 1); mQueryIndex.put(ListQuery.dueToday, 2); mQueryIndex.put(ListQuery.dueNextWeek, 2); mQueryIndex.put(ListQuery.dueNextMonth, 2); mQueryIndex.put(ListQuery.nextTasks, 3); mQueryIndex.put(ListQuery.project, 4); mQueryIndex.put(ListQuery.context, 5); mQueryIndex.put(ListQuery.custom, 6); mQueryIndex.put(ListQuery.tickler, 7); }
From source file:com.armtimes.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setBackgroundDrawable(new ColorDrawable(0xFFFA294C)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(Html.fromHtml("<small>" + mTitle + "</small>")); }
From source file:fm.smart.r1.activity.CreateSoundActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExceptionHandler.register(this); setContentView(R.layout.create_sound); final Intent queryIntent = getIntent(); Bundle extras = queryIntent.getExtras(); item_id = (String) extras.get("item_id"); id = (String) extras.get("id"); list_id = (String) extras.get("list_id"); to_record = (String) extras.get("to_record"); sound_type = extras.getString("sound_type"); recorder = new MediaRecorder(); TextView text = (TextView) findViewById(R.id.create_sound_text); text.setText(Html.fromHtml(to_record)); button = (Button) findViewById(R.id.create_sound_submit); button.setOnClickListener(this); }