예제 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.xiph_copyright);

    TextView tv = (TextView) findViewById(R.id.text);
    tv.setText(getXiphCopyright());
    tv.setMovementMethod(new ScrollingMovementMethod());
  }
  /**
   * 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());
      }
    }
  }