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:me.sudar.zxingorient.demo.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from   www .  j  av  a 2  s  .  com

    resultTextView = (TextView) findViewById(R.id.result_text_view);
    shareEditText = (EditText) findViewById(R.id.encodeEditText);
    findViewById(R.id.button_1).setOnClickListener(this);
    findViewById(R.id.button_2).setOnClickListener(this);
    findViewById(R.id.button_3).setOnClickListener(this);
    findViewById(R.id.button_4).setOnClickListener(this);
    findViewById(R.id.button_5).setOnClickListener(this);

    TextView textView = (TextView) findViewById(R.id.github_link);
    textView.setClickable(true);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    String text = "Check out the <a href='https://github.com/SudarAbisheck/ZXing-Orient'>Github Repo !!</a>";
    textView.setText(Html.fromHtml(text));

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        requestCameraPermission();
    }

}

From source file:au.id.tmm.anewreader.view.ItemDetailFragment.java

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

    View view = inflater.inflate(R.layout.adapter_view_item_detail, container, false);

    TextView itemTitle = (TextView) view.findViewById(R.id.item_detail_title);
    TextView subscriptionTitle = (TextView) view.findViewById(R.id.item_detail_subscription_title);
    TextView content = (TextView) view.findViewById(R.id.item_detail_content);

    itemTitle.setText(Html.fromHtml(linkWithText(item.getTitle(), item.getCanonicalLink())));
    itemTitle.setMovementMethod(LinkMovementMethod.getInstance());

    subscriptionTitle.setText(Html.fromHtml(
            linkWithText(item.getParentSubscription().getTitle(), item.getParentSubscription().getHtmlUrl())));
    subscriptionTitle.setMovementMethod(LinkMovementMethod.getInstance());

    UrlImageGetter imageGetter = new UrlImageGetter(content, this.getActivity());

    Spanned htmlSpan = Html.fromHtml(item.getSummary(), imageGetter, null);
    content.setText(htmlSpan);/*from w w  w . ja v a 2  s  .c  o  m*/
    content.setMovementMethod(LinkMovementMethod.getInstance());

    return view;

}

From source file:com.tortel.deploytrack.fragments.AboutDialogFragment.java

@Override
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);
    View view = inflater.inflate(R.layout.about, null);
    TextView text = (TextView) view.findViewById(R.id.about_view);

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

    builder.customView(view, false);/*from  w w w  .j  a va 2 s  .  c  om*/
    builder.title(R.string.app_name);
    builder.positiveText(R.string.close);

    return builder.build();
}

From source file:at.ac.uniklu.mobile.sportal.DashboardAboutDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AppInfo appInfo = Studentportal.getAppInfo();

    View aboutDialogView = getActivity().getLayoutInflater().inflate(R.layout.about_dialog, null);
    TextView aboutDialogVersionTextView = (TextView) aboutDialogView.findViewById(R.id.about_version_info);
    aboutDialogVersionTextView.setText(getString(R.string.app_version, appInfo.getVersionName()));
    TextView creditsTextView = (TextView) aboutDialogView.findViewById(R.id.credits);
    String creditsText = getString(R.string.credits_iconic) + " / " + getString(R.string.credits_tnp) + " / "
            + getString(R.string.credits_osm) + " / " + getString(R.string.credits_leaflet) + " / "
            + getString(R.string.credits_prevel) + " / " + getString(R.string.credits_gson) + " / "
            + getString(R.string.credits_vpi);
    creditsTextView.setText(Html.fromHtml(creditsText));
    creditsTextView.setMovementMethod(LinkMovementMethod.getInstance());

    aboutDialogView.findViewById(R.id.about_facebook).setOnClickListener(new View.OnClickListener() {
        @Override//from  w  w w . j  a v  a  2s .  c  om
        public void onClick(View v) {
            startActivity(Utils.getOpenFacebookIntent(getActivity()));
        }
    });

    aboutDialogView.findViewById(R.id.bugsense).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.bugsense.com")));
        }
    });

    return new AlertDialog.Builder(getActivity()).setView(aboutDialogView)
            .setNeutralButton(getString(R.string.close), null).create();
}

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

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

    // Add items to card

    appCardBuilder.addItem(//from w w w .j  a v  a  2s  .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_bulleted2)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                    c.getString(R.string.about_changelog),
                    "https://github.com/scoute-dich/browser/blob/master/CHANGELOG.md", true, false))
            .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() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.about_text)))
                            .setPositiveButton(c.getString(R.string.toast_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)
            .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());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_help)
            .subText(R.string.about_help_summary).icon(R.drawable.help_circle_outline)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_help)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.help_text)))
                            .setPositiveButton(c.getString(R.string.toast_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());

    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.createWebViewDialogOnClickAction(c,
                            c.getString(R.string.about_dev), "https://github.com/scoute-dich/", true, false))
                    .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 convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Observable ScrollView")
                    .subText(R.string.about_license_2).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Observable ScrollView",
                            "https://github.com/ksoichiro/Android-ObservableScrollView", true, false))
                    .build());

    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("MAH Encryptor Lib")
                    .subText(R.string.about_license_6).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "MAH Encryptor Lib", "https://github.com/hummatli/MAHEncryptorLib", 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 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(),
            convenienceCardBuilder.build());
}

From source file:de.uni_weimar.m18.anatomiederstadt.element.TextFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_text, container, false);

    TextView tv = (TextView) rootView.findViewById(R.id.text_view);
    tv.setText(Html.fromHtml(mText));/*ww  w  . j a v a  2  s  . co m*/
    tv.setMovementMethod(LinkMovementMethod.getInstance());
    return rootView;
}

From source file:com.example.testcutontopview.AboutFragment.java

private void setLinkMovementMethod(TextView... textViews) {
    for (TextView view : textViews) {
        view.setMovementMethod(LinkMovementMethod.getInstance());
    }
}

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

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

    // Add items to card

    appCardBuilder.addItem(//  w  ww.  j  a  v a2 s  .  co m
            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.createWebViewDialogOnClickAction(c,
                    c.getString(R.string.about_changelog),
                    "https://github.com/scoute-dich/PDFCreator/blob/master/CHANGELOG.md", true, false))
            .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() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.about_text)))
                            .setPositiveButton(c.getString(R.string.toast_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)
            .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.createWebViewDialogOnClickAction(c,
                            c.getString(R.string.about_dev), "https://github.com/scoute-dich/", true, false))
                    .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_con);

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

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

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

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

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Android Image Cropper")
            .subText(R.string.about_license_2).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Android Image Cropper",
                    "https://github.com/ArthurHub/Android-Image-Cropper", true, false))
            .build());

    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("Android PDFView")
                    .subText(R.string.about_license_6).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android PDFView", "https://github.com/JoanZapata/android-pdfview", 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("GPUImage for Android")
            .subText(R.string.about_license_4).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "GPUImage for Android",
                    "https://github.com/CyberAgent/android-gpuimage", 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("iText")
            .subText(R.string.about_license_5).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "iText",
                    "https://github.com/itext/itextpdf", 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 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(),
            authorCardBuilder3.build(), convenienceCardBuilder.build());
}

From source file:com.justwayward.reader.view.BookContentTextView.java

public void setText(String text) {
    int startIndex = 0;
    while (true) {

        int start = text.indexOf("");
        int end = text.indexOf("");
        if (start < 0 || end < 0) {
            append(text.substring(startIndex));
            break;
        }//from  w ww  .  ja  v a 2  s .  c  om

        append(text.substring(startIndex, start));

        SpannableString spanableInfo = new SpannableString(text.substring(start, end + 1));
        spanableInfo.setSpan(new Clickable(spanableInfo.toString()), 0, end + 1 - start,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        append(spanableInfo);
        //setMovementMethod()???
        setMovementMethod(LinkMovementMethod.getInstance());
        text = text.substring(end + 1);

        LogUtils.e(spanableInfo.toString());
    }
}

From source file:com.xabber.android.ui.AboutViewer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_viewer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override/* www  .j a  va 2s  . c  o m*/
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(AboutViewer.this);
        }
    });

    findViewById(R.id.about_github).setOnClickListener(this);
    findViewById(R.id.about_twitter).setOnClickListener(this);
    findViewById(R.id.about_redsolution).setOnClickListener(this);
    findViewById(R.id.about_text_xmpp_protocol).setOnClickListener(this);

    ((TextView) findViewById(R.id.about_text_developers)).setMovementMethod(LinkMovementMethod.getInstance());
    ((TextView) findViewById(R.id.about_text_translators)).setMovementMethod(LinkMovementMethod.getInstance());
    ((TextView) findViewById(R.id.about_text_license)).setMovementMethod(LinkMovementMethod.getInstance());

    CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(getString(R.string.application_title_short));

    ((TextView) findViewById(R.id.about_version)).setText(getVersionName());

    loadBackdrop();
}