Example usage for android.text.method LinkMovementMethod getInstance

List of usage examples for android.text.method LinkMovementMethod getInstance

Introduction

In this page you can find the example usage for android.text.method LinkMovementMethod getInstance.

Prototype

public static MovementMethod getInstance() 

Source Link

Usage

From source file:com.adkdevelopment.earthquakesurvival.ui.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_about, container, false);

    mUnbinder = ButterKnife.bind(this, rootView);
    mTextAbout.setMovementMethod(LinkMovementMethod.getInstance());

    return rootView;
}

From source file:org.jared.synodroid.ds.ui.SynologyInfoFragment.java

/**
 * Activity creation/*ww w .  j av  a  2s  .co m*/
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    try {
        if (((Synodroid) getActivity().getApplication()).DEBUG)
            Log.v(Synodroid.DS_TAG, "SynologyInfoFragment: Creating Synology Info fragment");
    } catch (Exception ex) {
        /*DO NOTHING*/}

    View help = inflater.inflate(R.layout.syno_info, null, false);

    TextView main_web = (TextView) help.findViewById(R.id.syno_main_web);
    main_web.setText(Html.fromHtml("<a href=\"http://www.synology.com\">www.synology.com</a>"));
    main_web.setMovementMethod(LinkMovementMethod.getInstance());

    TextView buy = (TextView) help.findViewById(R.id.syno_buy_web);
    buy.setText(Html.fromHtml(
            "<a href=\"http://www.synology.com/support/wheretobuy.php\">www.synology.com/support/wheretobuy.php</a>"));
    buy.setMovementMethod(LinkMovementMethod.getInstance());

    return help;
}

From source file:com.tortel.syslog.dialog.FaqDialog.java

@NonNull
@Override/*from   www . j a  v a2s.  com*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.about, null);
    TextView text = (TextView) view.findViewById(R.id.text);

    text.setText(Html.fromHtml(readRawTextFile(R.raw.faq)));
    Linkify.addLinks(text, Linkify.ALL);
    text.setMovementMethod(LinkMovementMethod.getInstance());

    builder.customView(view, false);
    builder.title(R.string.syslog_faq);
    builder.positiveText(R.string.close);

    return builder.build();
}

From source file:com.tortel.syslog.dialog.AboutDialog.java

@NonNull
@Override/*from   w  ww  .  j  av a2 s  .  co m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.about, null);
    TextView text = (TextView) view.findViewById(R.id.text);

    text.setText(Html.fromHtml(readRawTextFile(R.raw.about)));
    Linkify.addLinks(text, Linkify.ALL);
    text.setMovementMethod(LinkMovementMethod.getInstance());

    builder.customView(view, false);
    builder.title(R.string.about);
    builder.positiveText(R.string.close);

    return builder.build();
}

From source file:damo.three.ie.fragment.ChangeLogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_changelog, container, false);
    String content = "";
    try {//from w ww . j  a v  a 2 s  .co m
        content = FileUtils.readFile(getActivity(), R.raw.changelog);
    } catch (IOException e) {
        /* something went wrong reading the raw file */
        e.printStackTrace();
    }

    TextView aboutTextView = (TextView) view.findViewById(R.id.changelog_text);
    aboutTextView.setMovementMethod(LinkMovementMethod.getInstance());
    aboutTextView.setText(Html.fromHtml(content, null, new CustomTagHandler()));

    return view;
}

From source file:com.tortel.syslog.dialog.AboutLogcatDialog.java

@NonNull
@Override//from www  . jav a 2s  .  c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.about, null);
    TextView text = (TextView) view.findViewById(R.id.text);

    text.setText(Html.fromHtml(readRawTextFile(R.raw.logcat)));
    Linkify.addLinks(text, Linkify.ALL);
    text.setMovementMethod(LinkMovementMethod.getInstance());

    builder.customView(view, false);
    builder.title(R.string.about_live);
    builder.positiveText(R.string.close);

    return builder.build();
}

From source file:com.temboo.example.YouTubeResultView.java

public YouTubeResultView(Context context, String title, String url, String thumbnailURL) {
    super(context);
    super.setOrientation(HORIZONTAL);

    // Create the link text view, and make the link clickable
    linkView = new TextView(getContext());
    linkView.setMovementMethod(LinkMovementMethod.getInstance());

    // Set the link text
    linkView.append(Html.fromHtml("<a href='" + url + "'>" + title + "</a>"));

    // Populate the image view
    try {/*  w  ww .j a v  a 2 s . com*/
        imageView = new ImageView(getContext());
        imageView.setPadding(4, 4, 4, 0);
        fetchDrawableOnThread(thumbnailURL, imageView);
        super.addView(imageView);
    } catch (Exception e) {
        Toast.makeText(getContext(), "An error occurred retrieving the video thumbnail", Toast.LENGTH_LONG)
                .show();
    }
    super.addView(linkView);
}

From source file:com.example.onenoteservicecreatepageexample.ResultsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_results);
    // Show the Up button in the action bar.
    setupActionBar();//from   ww w . ja v a  2 s  .c om

    //Get messages from the intent
    Intent intent = getIntent();
    String clientUrl = intent.getStringExtra(Constants.CLIENT_URL).replaceAll(
            //This regular expression adds curly braces before and after the section identifier and page identifier values in the client URL
            "=([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})&", "={$1}&");
    TextView clientLinkView = (TextView) findViewById(R.id.lbl_clientLink);
    clientLinkView.setText(Html.fromHtml("<a href = \'" + clientUrl + "\'>" + clientUrl + "</a>"));
    clientLinkView.setMovementMethod(LinkMovementMethod.getInstance());
    //Set the messages
    ((TextView) findViewById(R.id.lbl_Response)).setText(intent.getStringExtra(Constants.RESPONSE));
    ((TextView) findViewById(R.id.lbl_webLink)).setText(intent.getStringExtra(Constants.WEB_URL));
}

From source file:com.aniruddhc.acemusic.player.Dialogs.LicensesDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    parentActivity = getActivity();/*w w  w.  j  a  v  a  2 s.c o m*/
    dialogFragment = (DialogFragment) getFragmentManager().findFragmentByTag("licensesDialog");

    rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.licenses_dialog_layout, null);

    creativeCommonsLink = (TextView) rootView.findViewById(R.id.creative_commons_link);
    creativeCommonsLink.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));
    creativeCommonsLink.setText(Html.fromHtml(
            "<a href=\"http://creativecommons.org/licenses/by-sa/3.0/legalcode\">Creative Commons ShareALike 3.0 License</a> "));
    creativeCommonsLink.setMovementMethod(LinkMovementMethod.getInstance());

    creativeCommonsInfo = (TextView) rootView.findViewById(R.id.licenses_text);
    creativeCommonsInfo.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light"));

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    //Set the dialog title.
    builder.setTitle(R.string.licenses);
    builder.setView(rootView);
    builder.setPositiveButton(R.string.done, new OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            dialogFragment.dismiss();
            getActivity().finish();

        }

    });

    return builder.create();
}

From source file:com.manning.androidhacks.hack010.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/* ww w  .  j a v a  2s .co  m*/

    final TextView textView1 = (TextView) findViewById(R.id.my_text_view_html);
    textView1.setText(Html.fromHtml(getString(R.string.text1)));
    textView1.setMovementMethod(LinkMovementMethod.getInstance());

    final Spannable text2 = new SpannableString(getString(R.string.text2));
    text2.setSpan(new BackgroundColorSpan(Color.RED), 1, 4, 0);
    text2.setSpan(new ForegroundColorSpan(Color.BLUE), 5, 9, 0);

    ((TextView) findViewById(R.id.my_text_view_spannable)).setText(text2);
}