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:de.grobox.transportr.about.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_about, container, false);
    Activity activity = getActivity();//from   w w w .j a  v a2  s. co  m

    String versionName;
    try {
        if (activity == null)
            throw new NameNotFoundException();
        versionName = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
        versionName = "?.?";
    }

    // add app name and version
    TextView aboutApp = view.findViewById(R.id.aboutApp);
    aboutApp.setText(getResources().getString(R.string.app_name) + "  " + versionName);

    // create real paragraphs
    TextView t = view.findViewById(R.id.aboutTextView);
    t.setText(Html.fromHtml(getString(R.string.about)
            + String.format(getString(R.string.about_bottom), getString(R.string.website),
                    getString(R.string.bugtracker), getString(R.string.website) + "#donate")));

    // make links in about text clickable
    t.setMovementMethod(LinkMovementMethod.getInstance());
    t.setLinkTextColor(ContextCompat.getColor(getContext(), R.color.accent));

    Button website = view.findViewById(R.id.websiteButton);
    website.setOnClickListener(v -> {
        Intent launchBrowser = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.website)));
        startActivity(launchBrowser);
    });

    return view;
}

From source file:org.angellist.angellistmobile.FeedJSONAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null)
        convertView = activity.getLayoutInflater().inflate(R.layout.row_feed, null);

    TextView textView = (TextView) convertView.findViewById(R.id.label);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    ImageView imageView = (ImageView) convertView.findViewById(R.id.logo);
    JSONObject jsonObject = getItem(position);

    try {//from  www . ja va  2s  .c om

        String type = null;

        type = jsonObject.getJSONObject("item").getString("type");

        textView.setText("-");
        imageView.setImageResource(R.drawable.ic_launcher);
        Log.d(type, jsonObject.toString());
        String image = jsonObject.getJSONObject("actor").getString("image");
        imageLoader.DisplayImage(image, imageView);
        if ("Follow".equals(type)) {
            // follow
            // {"timestamp":"2013-10-17T15:16:46Z","id":"UyroZ","text":null,"promoted_by":[],"extra":null,"description":"<a
            // href=\"https:\/\/angel.co\/sbergel\" class=\"feed_link\"
            // data-id=\"106927\" data-type=\"User\">Shanti Bergel<\/a>
            // followed <a href=\"https:\/\/angel.co\/softbank-capital\"
            // class=\"feed_link\" data-id=\"79702\"
            // data-type=\"Startup\">SoftBank
            // Capital<\/a>","likes":0,"item":{"type":"Follow","ids":[15308380]},"target":{"id":79702,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/startups\/i\/79702-06c0b2126476861a1ae5cfb92da2a1aa-thumb_jpg.jpg?buster=1333126870","system_user?":null,"type":"Startup","angellist_url":"https:\/\/angel.co\/softbank-capital","tagline":"Multi-stage
            // venture fund w\/ $600mm under management delivering strategic
            // value to founders","name":"SoftBank
            // Capital"},"actor":{"id":106927,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/users\/106927-medium_jpg?1331913511","system_user?":false,"type":"User","angellist_url":"https:\/\/angel.co\/sbergel","tagline":"Business
            // & Corporate Development Black Belt  Founder @qbiquity  Exec
            // roles at @playfish, @gree","name":"Shanti
            // Bergel"},"comments":0}

            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));

        } else if ("Press".equals(type)) {
            // press
            // {"timestamp":"2013-10-17T15:35:03Z","id":"Uyshy","text":"<a
            // href=\"http:\/\/philadelphia.cbslocal.com\/2013\/10\/14\/boppl-app\/\"
            // target=\"_blank\">CBS Philadelphia features
            // Boppl<\/a>","promoted_by":[],"extra":null,"description":"<a
            // href=\"https:\/\/angel.co\/boppl\" class=\"feed_link\"
            // data-id=\"154252\" data-type=\"Startup\">Boppl<\/a> added
            // press from
            // philadelphia.cbslocal.com","likes":0,"item":{"type":"Press","ids":[85539]},"target":null,"actor":{"id":154252,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/startups\/i\/154252-6e332013f324434792202151e21d8435-thumb_jpg.jpg?buster=1375709358","system_user?":null,"type":"Startup","angellist_url":"https:\/\/angel.co\/boppl","tagline":"Order
            // and pay for food and drinks","name":"Boppl"},"comments":0}
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else if ("StartupRole".equals(type)) {
            // startuprole
            // {"timestamp":"2013-10-17T15:30:29Z","id":"Uys8P","text":null,"promoted_by":[],"extra":{"comment":null},"description":"<a
            // href=\"https:\/\/angel.co\/jim-huston\" class=\"feed_link\"
            // data-id=\"104534\" data-type=\"User\">Jim Huston<\/a>
            // invested in <a href=\"https:\/\/angel.co\/onthego-platforms\"
            // class=\"feed_link\" data-id=\"123266\"
            // data-type=\"Startup\">OnTheGo Platforms<\/a>'s previous
            // round","likes":0,"item":{"type":"StartupRole","ids":[902050]},"target":{"id":123266,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/startups\/i\/123266-001115ef9a121690432a5a43ae7515c5-thumb_jpg.jpg?buster=1364053321","system_user?":null,"type":"Startup","angellist_url":"https:\/\/angel.co\/onthego-platforms","tagline":"Our
            // software makes smart glasses easier to use and the
            // applications on them more powerful.","name":"OnTheGo
            // Platforms"},"actor":{"id":104534,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/users\/104534-medium_jpg?1331270245","system_user?":false,"type":"User","angellist_url":"https:\/\/angel.co\/jim-huston","tagline":"Early
            // Stage Seed Investor at Portland Seed Fund","name":"Jim
            // Huston"},"comments":0}
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else if ("StatusUpdate".equals(type)) {
            // statusupdate
            // {"timestamp":"2013-10-17T15:11:37Z","id":"UyriB","text":"Haxlr8r
            // Demo Day (III) is coming up on 21 November 2013 in San
            // Fran... Contact Cyril or me to get on the RSVP list... Flying
            // robots, Batman! See some of our breakout companies here:
            // http:\/\/kickstarter\/haxlr8r","promoted_by":[],"extra":null,"description":"<a
            // href=\"https:\/\/angel.co\/sosventures\" class=\"feed_link\"
            // data-id=\"33924\" data-type=\"User\">Sean O&#39;Sullivan<\/a>
            // updated their
            // status","likes":0,"item":{"type":"StatusUpdate","ids":[112276]},"target":null,"actor":{"id":33924,"image":"https:\/\/s3.amazonaws.com\/photos.angel.co\/users\/33924-medium_jpg?1305992664","system_user?":false,"type":"User","angellist_url":"https:\/\/angel.co\/sosventures","tagline":"founder
            // of @carma-3, JumpStart Int'l, @mapinfo; co-inventor of street
            // mapping on PCs. co-coined term
            // \"cloud computing\" in 1996. seed & venture capital investor.","name":"Sean O'Sullivan"},"comments":0}

            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            description = description + "<br>" + jsonObject.getString("text");
            textView.setText(Html.fromHtml(description));
        } else if ("Reservation".equals(type)) {
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else if ("Review".equals(type)) {
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            description = description + "<br>" + jsonObject.getString("text");
            textView.setText(Html.fromHtml(description));
        } else if ("JobListing".equals(type)) {
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else if ("StartupPublish".equals(type)) {
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else if ("Share".equals(type)) {
            String descriptionHtml = jsonObject.getString("description");
            String description = this.replaceUserAndStartupLinks(descriptionHtml);
            textView.setText(Html.fromHtml(description));
        } else {
            textView.setText(type);

        }

    } catch (JSONException e) {
        e.printStackTrace();
    }

    return convertView;
}

From source file:com.wolkabout.hexiwear.activity.SignUpActivity.java

@AfterViews
void init() {
    privacyPolicy.setMovementMethod(LinkMovementMethod.getInstance());
    licenceTerms.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.nineducks.hereader.HackfulReaderActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog result = null;/*from ww w .  j ava  2s.  co  m*/
    AlertDialog.Builder builder = null;
    switch (id) {
    case R.id.open_dialog:
        builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.open_dialog_title);
        builder.setItems(R.array.open_dialog_options, (OnClickListener) itemsController);
        builder.setCancelable(true);
        result = builder.create();
        break;
    case R.id.about_dialog:
        builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.about_dialog_title);
        ScrollView scroll = new ScrollView(this);
        TextView msg = new TextView(this);
        SpannableString s = new SpannableString(getString(R.string.about_dialog_text));
        Linkify.addLinks(s, Linkify.WEB_URLS);
        msg.setText(s);
        msg.setMovementMethod(LinkMovementMethod.getInstance());
        msg.setTextSize(16);
        msg.setPadding(15, 15, 15, 15);
        scroll.addView(msg);
        builder.setView(scroll);
        builder.setInverseBackgroundForced(true);
        result = builder.create();
        break;
    }
    return result;
}

From source file:com.color.kid.kidpaint.dialog.DialogAbout.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//w  ww . j  av  a  2  s . c  o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity());

    builder.setTitle(R.string.about_title);
    View view = inflater.inflate(R.layout.dialog_about, null);

    TextView aboutVersionNameTextView = (TextView) view.findViewById(R.id.dialog_about_version_name_text_view);
    String versionName = PaintroidApplication.getVersionName(getActivity());
    aboutVersionNameTextView.setText(R.string.about_version);
    aboutVersionNameTextView.append(" " + versionName);

    TextView aboutTextView = (TextView) view.findViewById(R.id.about_tview_Text);
    String aboutText = String.format(getActivity().getString(R.string.about_content),
            getActivity().getString(R.string.license_type_paintroid));
    aboutTextView.setText(aboutText);

    TextView aboutUrlTextView = (TextView) view.findViewById(R.id.about_tview_Url);
    aboutUrlTextView.setMovementMethod(LinkMovementMethod.getInstance());
    Resources resources = getActivity().getResources();
    /*String paintroidLicense = String.format(
    resources.getString(R.string.about_link_template),
    resources.getString(R.string.license_url),
    resources.getString(R.string.about_license_url_text));
    aboutUrlTextView.append(Html.fromHtml(paintroidLicense));
    aboutUrlTextView.append("\n\n");
    String aboutCatroid = String.format(
    resources.getString(R.string.about_link_template),
    resources.getString(R.string.catroid_url),
    resources.getString(R.string.about_catroid_url_text));*/
    //aboutUrlTextView.append(Html.fromHtml(aboutCatroid));
    aboutUrlTextView.append("\n");

    builder.setView(view);
    builder.setNeutralButton(R.string.done, this);

    return builder.create();

}

From source file:com.mycodehurts.rapidmath.app.AboutPage.java

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

    {/*from w  ww  .ja v a 2 s .  c  o  m*/
        TextView link = (TextView) rootView.findViewById(R.id.visitkickstarter);
        String linkText = "<a href='https://www.kickstarter.com/projects/1373995643/rapidmath-educational-poster-for-rapid-mental-math'>Kickstarter Campaign</a> ";
        link.setText(Html.fromHtml(linkText));
        link.setMovementMethod(LinkMovementMethod.getInstance());
    }

    {
        TextView link = (TextView) rootView.findViewById(R.id.buyrapidmath);
        String linkText = "<a href='http://techessentials.myshopify.com/'>Buy Rapidmath Material</a> ";
        link.setText(Html.fromHtml(linkText));
        link.setMovementMethod(LinkMovementMethod.getInstance());
    }
    {
        TextView link = (TextView) rootView.findViewById(R.id.jhalaLink);
        String linkText = "<a href='https://plus.google.com/+VishalsinhJhala/posts'>Vishalsinh Jhala</a> ";
        link.setText(Html.fromHtml(linkText));
        link.setMovementMethod(LinkMovementMethod.getInstance());
    }
    {
        TextView link = (TextView) rootView.findViewById(R.id.githubLink);
        String linkText = "<a href='https://github.com/myCodeHurts/RapidMath'>Download Source</a> ";
        link.setText(Html.fromHtml(linkText));
        link.setMovementMethod(LinkMovementMethod.getInstance());
    }

    //TextView textView = (TextView) rootView.findViewById(R.id.section_label);
    //textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));

    //        Button btnStartTest = (Button)rootView.findViewById(R.id.btnStartTest);
    //        btnStartTest.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View view) {
    //
    //                RadioGroup chkSex = (RadioGroup)rootView.findViewById(R.id.testDifficultLevel);
    //
    //                if( chkSex.getCheckedRadioButtonId()==-1)
    //                {
    //
    //                }
    //                int iLevel = -1;
    //                if( chkSex.getCheckedRadioButtonId() == R.id.testEasy )
    //                    iLevel = 0;
    //                else if (chkSex.getCheckedRadioButtonId() == R.id.testMedium)
    //                    iLevel = 1;
    //                else if(chkSex.getCheckedRadioButtonId() == R.id.testDifficult)
    //                    iLevel = 2;
    //
    //                Intent intent = new Intent(rootView.getContext(), TestActivity.class);
    //                intent.putExtra("iLevel",iLevel);
    //                startActivity(intent);
    //            }
    //        });

    return rootView;
}

From source file:com.awesome.vicky.justetit.fragment.About.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    textViewRecipeIcon = (TextView) getView().findViewById(R.id.recipe_icon_textview);
    textViewLeftoversIcon = (TextView) getView().findViewById(R.id.leftovers_icon_textview);
    textViewHelpIcon = (TextView) getView().findViewById(R.id.help_icon_textview);
    textViewAboutIcon = (TextView) getView().findViewById(R.id.about_icon_textview);
    textViewRefreshIcon = (TextView) getView().findViewById(R.id.refresh_icon_textview);
    textViewNoResultIcon = (TextView) getView().findViewById(R.id.no_result_icon_textview);
    textViewAppIcon = (TextView) getView().findViewById(R.id.app_icon_textview);
    textViewAppInto1Icon = (TextView) getView().findViewById(R.id.app_intro1_textview);
    textViewAppIntro2Icon = (TextView) getView().findViewById(R.id.app_intro2_textview);
    textViewAppIntro3Icon = (TextView) getView().findViewById(R.id.app_intro3_textview);
    textViewRecipyPuppyLink = (TextView) getView().findViewById(R.id.api_textview);

    textViewRecipeIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.freepik.com' title='Freepik'>Freepik</a> from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewRecipeIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewLeftoversIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.freepik.com' title = 'Freepik' > Freepik </a > from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewLeftoversIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewHelpIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.danielbruce.se' title='Daniel Bruce'>Daniel Bruce</a> from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewHelpIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewAboutIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.freepik.com' title='Freepik'>Freepik</a> from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewAboutIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewRefreshIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://icon-works.com' title='Icon Works'>Icon Works</a> from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewRefreshIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewNoResultIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://catalinfertu.com' title='Catalin Fertu'>Catalin Fertu</a> from <a href='http://www.flaticon.com' title='Flaticon'>www.flaticon.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewNoResultIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewAppIcon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.iconfinder.com/ArtWhite' title='Artem White'>Artem White</a> from <a href='http://www.iconfinder.com' title='iconfinder'>www.iconfinder.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewAppIcon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewAppInto1Icon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.iconfinder.com/Squid.ink' title='Squid.ink'>Squid.ink</a> from <a href='http://www.iconfinder.com' title='iconfinder'>www.iconfinder.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewAppInto1Icon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewAppIntro2Icon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.iconfinder.com/Squid.ink' title='Squid.ink'>Squid.ink</a> from <a href='http://www.iconfinder.com' title='iconfinder'>www.iconfinder.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewAppIntro2Icon.setMovementMethod(LinkMovementMethod.getInstance());
    textViewAppIntro3Icon.setText(Html.fromHtml(
            "Icon made by <a href='http://www.iconfinder.com/Squid.ink' title='Squid.ink'>Squid.ink</a> from <a href='http://www.iconfinder.com' title='iconfinder'>www.iconfinder.com</a> is licensed under <a href='http://creativecommons.org/licenses/by/3.0/' title='Creative Commons BY 3.0'>CC BY 3.0</a>"));
    textViewAppIntro3Icon.setMovementMethod(LinkMovementMethod.getInstance());

    textViewRecipyPuppyLink.setText(//from  www . j av a  2  s .co  m
            Html.fromHtml("Powered by <a href='http://www.recipepuppy.com/about/api/'>Recippy Puppy</a>"));
    textViewRecipyPuppyLink.setMovementMethod(LinkMovementMethod.getInstance());
}

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

@NonNull
@Override//from   ww w. ja va  2  s.c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context wrappedContext = new ContextThemeWrapper(getActivity(), R.style.Theme_DeployThemeLight);

    MaterialDialog.Builder builder = new MaterialDialog.Builder(wrappedContext);

    LayoutInflater inflater = getActivity().getLayoutInflater().cloneInContext(wrappedContext);
    @SuppressLint("InflateParams")
    View view = inflater.inflate(R.layout.dialog_about, null);
    TextView text = (TextView) view.findViewById(R.id.about_view);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        text.setText(Html.fromHtml(readRawTextFile(getContent()), Html.FROM_HTML_MODE_LEGACY));
    } else {
        //noinspection deprecation
        text.setText(Html.fromHtml(readRawTextFile(getContent())));
    }
    Linkify.addLinks(text, Linkify.ALL);
    text.setMovementMethod(LinkMovementMethod.getInstance());

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

    return builder.build();
}

From source file:com.grokkingandroid.sampleapp.samples.SampleBaseFragment.java

@SuppressLint("NewApi")
protected void showLinks(ViewGroup container) {
    String[] linkTexts = getLinkTexts();
    String[] linkTargets = getLinkTargets();
    StringBuilder link = null;//w w  w .  ja  va2 s  .c  o m
    for (int i = 0; i < linkTexts.length; i++) {
        // TODO: Use an inflater
        TextView tv = new TextView(getActivity());
        LinearLayout.LayoutParams params = null;
        params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        if (i != linkTexts.length - 1) {
            int marginBottom = getResources().getDimensionPixelSize(R.dimen.linkSpacing);
            params.setMargins(0, 0, 0, marginBottom);
        }
        tv.setLayoutParams(params);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            tv.setTextIsSelectable(true);
        }
        tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
        link = new StringBuilder(100);
        link.append("<a href=\"");
        link.append(linkTargets[i]);
        link.append("\">");
        link.append(linkTexts[i]);
        link.append("</a>");
        Spanned spannedLink = Html.fromHtml(link.toString());
        tv.setText(spannedLink);
        tv.setMovementMethod(LinkMovementMethod.getInstance());
        container.addView(tv);
    }
}

From source file:de.baumann.quitsmoking.about.About_content.java

static MaterialAboutList createMaterialAboutList(final Context c) {
    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();

    // Add items to card

    appCardBuilder.addItem(//  w  w w . j  a  v a 2  s .  c om
            new MaterialAboutTitleItem.Builder().text(R.string.app_name).icon(R.mipmap.ic_launcher).build());

    try {

        appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                ContextCompat.getDrawable(c, R.drawable.earth2), "Version", false));

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_changelog)
                    .subText(R.string.about_changelog_summary).icon(R.drawable.format_list_bulleted)
                    .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c,
                            Uri.parse("https://github.com/scoute-dich/QuitSmoking/blob/master/CHANGELOG.md")))
                    .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license)
            .subText(R.string.about_license_summary).icon(R.drawable.copyright)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    SpannableString s;

                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
                        s = new SpannableString(
                                Html.fromHtml(c.getString(R.string.about_text), Html.FROM_HTML_MODE_LEGACY));
                    } else {
                        //noinspection deprecation
                        s = new SpannableString(Html.fromHtml(c.getString(R.string.about_text)));
                    }

                    Linkify.addLinks(s, Linkify.WEB_URLS);

                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(s).setPositiveButton(c.getString(R.string.yes),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_intro)
            .subText(R.string.about_intro_summary).icon(R.drawable.information_outline_dark)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    Intent intent = new Intent(c, Activity_intro.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    c.startActivity(intent);
                }
            }).build());

    MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
    authorCardBuilder.title(R.string.about_title_dev);

    authorCardBuilder.addItem(
            new MaterialAboutActionItem.Builder().text(R.string.about_dev).subText(R.string.about_dev_summary)
                    .icon(R.drawable.gaukler_faun).setOnClickListener(ConvenienceBuilder
                            .createWebsiteOnClickAction(c, Uri.parse("https://github.com/scoute-dich/")))
                    .build());

    authorCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_donate)
            .subText(R.string.about_donate_summary).icon(R.drawable.coin)
            .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NP6TGYDYP9SHY")))
            .build());

    MaterialAboutCard.Builder authorCardBuilder2 = new MaterialAboutCard.Builder();
    authorCardBuilder2.title(R.string.about_title_ext);

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Neofaum")
            .subText(R.string.about_title_ext3).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/naofum")))
            .build());

    authorCardBuilder2.addItem(new MaterialAboutActionItem.Builder().text("Primokorn")
            .subText(R.string.about_title_ext4).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/Primokorn")))
            .build());

    MaterialAboutCard.Builder convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Onboarder")
                    .subText(R.string.about_license_3).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Onboarder", "https://github.com/chyrta/AndroidOnboarder", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Glide")
            .subText(R.string.about_license_9).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Glide",
                    "https://github.com/bumptech/glide", true, false))
            .build());

    convenienceCardBuilder
            .addItem(
                    new MaterialAboutActionItem.Builder().text("Image Picker").subText(R.string.about_license_1)
                            .icon(R.drawable.github_circle)
                            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                                    "Image Picker", "https://github.com/Mariovc/ImagePicker", true, false))
                            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material About Library")
            .subText(R.string.about_license_7).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material About Library",
                    "https://github.com/daniel-stoneuk/material-about-library", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Date Time Picker")
            .subText(R.string.about_license_2).icon(R.drawable.github_circle)
            .setOnClickListener(
                    ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Date Time Picker",
                            "https://github.com/wdullaer/MaterialDateTimePicker", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Design Icons")
            .subText(R.string.about_license_8).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Design Icons",
                    "https://github.com/Templarian/MaterialDesign", true, false))
            .build());

    return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(), authorCardBuilder2.build(),
            convenienceCardBuilder.build());
}