/** * Parse a html tag <a href="www.example.com">example</a> and linkifies to 'example' then put that * text in a text view and appends it to the ulr viewgroup. * * @param urls: urls to linkify. */ private void fillUrlsLayout(Url[] urls) { if (getActivity() != null) { for (Url link : urls) { String url = "<a href=\"" + link.getValue() + "\"> - " + link.getLabel() + "</a>\n"; TextView urlTextView = new TextView(getActivity()); urlTextView.setText(Html.fromHtml(url)); urlTextView.setMovementMethod(LinkMovementMethod.getInstance()); urlTextView.setTextAppearance(getActivity(), R.style.LinkStyle); groupURLLayout.addView(urlTextView, GuiUtils.getLinkParams()); Url urlEnt = new Url(); urlEnt.setGroup_id(Configuration.GROUP_ID); urlEnt.setLabel(link.getLabel()); urlEnt.setValue(link.getValue()); dbHandler.insertElement(Url.class, urlEnt.getFields()); } } }
@Override public void onCompleted(Exception e, PlusPerson plusPerson) { progressBarSpinner.setVisibility(View.GONE); d( "[DEBUG] fucverg.saulmm.gdg.gui.fragments.GroupFragment.onCompleted ", "Posts completed..."); if (plusPerson != null) { baseLayout.setVisibility(View.VISIBLE); scrollView.setVisibility(View.VISIBLE); errorLayout.setVisibility(View.INVISIBLE); String content = plusPerson.getAboutMe().replaceAll("<br />", ""); fillUrlsLayout(plusPerson.getUrls()); GroupInfo apiGroupInfo = new GroupInfo(); apiGroupInfo.setAbout(content); apiGroupInfo.setId(plusPerson.getId()); apiGroupInfo.setTagLine(plusPerson.getTagline()); apiGroupInfo.setName(plusPerson.getDisplayName()); fillAboutUIElements(apiGroupInfo); dbHandler.insertElement(GroupInfo.class, apiGroupInfo.getFields()); } else { e( "[ERROR] fucverg.saulmm.gdg.gui.fragments.AboutFragment.onCompleted ", "Error retrieving the gdg about data."); errorLayout.setVisibility(View.VISIBLE); scrollView.setVisibility(View.INVISIBLE); GuiUtils.showShortToast(getActivity(), "No hay red"); } }