Example usage for android.widget TextView setMovementMethod

List of usage examples for android.widget TextView setMovementMethod

Introduction

In this page you can find the example usage for android.widget TextView setMovementMethod.

Prototype

public final void setMovementMethod(MovementMethod movement) 

Source Link

Document

Sets the android.text.method.MovementMethod for handling arrow key movement for this TextView.

Usage

From source file:am.roadpolice.roadpolice.AboutUsDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null);
    TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion);
    try {//from  w ww  .  j  av  a 2 s .  c  o  m
        PackageManager manager = getActivity().getPackageManager();
        PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0);
        tvVersion.setText(tvVersion.getText() + " " + info.versionName);

    } catch (PackageManager.NameNotFoundException e) {
        tvVersion.setVisibility(View.GONE);
    }

    // Makes the link in the text view clickable.
    TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper);
    t2.setMovementMethod(LinkMovementMethod.getInstance());

    // Creates About Us Alert dialog which extends from DialogFragment.
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.txtAboutUs)
            .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create();
}

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  w w.  j  ava  2  s.c o 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:de.tobiasbielefeld.solitaire.ui.about.InformationFragment.java

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

    TextView textViewBuildDate = (TextView) view.findViewById(R.id.aboutTextViewBuild); //build date
    TextView textViewAppVersion = (TextView) view.findViewById(R.id.aboutTextViewVersion); //app version
    TextView textViewGitHubLink = (TextView) view.findViewById(R.id.aboutTextViewGitHubLink); //link for the gitHub repo
    TextView textViewLicenseLink = (TextView) view.findViewById(R.id.aboutTextViewLicenseLink);

    TextView textJapaneseContributors = (TextView) view.findViewById(R.id.about_japanese_contributors);
    TextView textEsperantoContributors = (TextView) view.findViewById(R.id.about_esperanto_contributors);
    TextView textPolishContributors = (TextView) view.findViewById(R.id.about_polish_contributors);
    TextView textFrenchContributors = (TextView) view.findViewById(R.id.about_french_contributors);
    TextView textFinnishContributors = (TextView) view.findViewById(R.id.about_finnish_contributors);
    TextView textTurkishContributors = (TextView) view.findViewById(R.id.about_turkish_contributors);
    TextView textSpanishArgentinaContributors = (TextView) view
            .findViewById(R.id.about_spanish_argentina_contributers);

    TextView textFurtherContributors1 = (TextView) view.findViewById(R.id.about_further_contributors_1);
    TextView textFurtherContributors2 = (TextView) view.findViewById(R.id.about_further_contributors_2);
    TextView textFurtherContributors3 = (TextView) view.findViewById(R.id.about_further_contributors_3);

    String buildDate = DateFormat.getDateInstance().format(BuildConfig.TIMESTAMP); //get the build date in locale time format

    //update the textViews
    textViewAppVersion.setText(stringFormat(BuildConfig.VERSION_NAME));
    textViewBuildDate.setText(stringFormat(buildDate));

    //enable the hyperlink clicks
    TextView[] textViews = new TextView[] { textViewGitHubLink, textViewLicenseLink, textJapaneseContributors,
            textEsperantoContributors, textPolishContributors, textFinnishContributors, textTurkishContributors,
            textFrenchContributors, textFurtherContributors1, textFurtherContributors2,
            textFurtherContributors3, textSpanishArgentinaContributors };

    for (TextView textView : textViews) {
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }//w ww.  ja  v a  2 s .c  om

    return view;
}

From source file:nz.net.speakman.destinyraidtimers.crota.CrotaHelpDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    View view = getActivity().getLayoutInflater().inflate(R.layout.crota_help, null);
    TextView description = (TextView) view.findViewById(R.id.app_about_description);
    description.setMovementMethod(LinkMovementMethod.getInstance());
    view.findViewById(R.id.app_about_licenses).setOnClickListener(new View.OnClickListener() {
        @Override/*from  w  ww  .  jav  a2  s  .c om*/
        public void onClick(View v) {
            LicensesFragment.displayLicensesFragment(getFragmentManager());
        }
    });
    builder.setView(view).setTitle(R.string.crota_help_title).setPositiveButton(android.R.string.ok,
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    return builder.create();
}

From source file:com.armtimes.dialogs.DialogAboutUs.java

@SuppressWarnings("NullableProblems")
@Override//from w w  w  .j av  a  2 s .c  om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null);
    TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion);
    try {
        PackageManager manager = getActivity().getPackageManager();
        PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0);
        tvVersion.setText(tvVersion.getText() + " " + info.versionName);

    } catch (PackageManager.NameNotFoundException e) {
        tvVersion.setVisibility(View.GONE);
    }

    // Makes the link in the text view clickable.
    TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper);
    t2.setMovementMethod(LinkMovementMethod.getInstance());

    // Creates About Us Alert dialog which extends from DialogFragment.
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.about_us)
            .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create();
}

From source file:de.stkl.gbgvertretungsplan.fragments.PopupDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (savedInstanceState != null)
        mContent = savedInstanceState.getString("content", mContent);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View layout = inflater.inflate(R.layout.dialog_html, null);

    TextView text = (TextView) layout.findViewById(R.id.text);
    text.setMovementMethod(LinkMovementMethod.getInstance());
    text.setText(Html.fromHtml(mContent));

    builder.setView(layout);//w ww  .  jav a2  s  .c om

    builder.setPositiveButton(getString(R.string.popup_ok), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    return builder.create();
}

From source file:org.gdgsp.fragment.AboutFragment.java

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

    String about_text = "<h3>GDG</h3>"
            + "<p>O Google Developers Group  uma iniciativa de pessoas interessadas em construir com tecnologia e disseminar o conhecimento. Nossos eventos so direcionados para a comunidade de desenvolvedores, engenheiros, designers e empreendedores, organizados pelos nossos membros de forma voluntria e sem fins lucrativos. Encontre outros captulos do GDG no Brasil no <a href=\"https://developers.google.com/groups/directory/Brazil\">Google Developers</a>.</p>"
            + "<p><h3>Aplicativo</h3></p>" + "<p>" + activity.getString(R.string.app_name)
            + " para Android verso: " + Other.getAppVersion(activity) + "</p>"
            + "<p>Aplicativo desenvolvido por <a href=\"http://alefesouza.com\">Alefe Souza</a></p>"
            + "<p>Esse aplicativo foi desenvolvido em cdigo aberto para Android, Universal Windows Platform e Xamarin.Forms, voc pode ver o cdigo exato dos aplicativos e o back-end em PHP no meu <a href=\"http://github.com/alefesouza/gdg-sp\">GitHub</a>, procurei deixar o cdigo para ser facilmente adaptado para outros meetups, deixando informaes de como fazer isso em cada projeto.</p>"
            + "Nesse aplicativo foi utilizado:" + "<br><br><a href=\"http://icons8.com\">Icons8</a>"
            + "<br><a href=\"http://github.com/koush/ion\">Ion</a>"
            + "<br><a href=\"http://onesignal.com\">OneSignal</a>"
            + "<br><a href=\"http://github.com/vinc3m1/RoundedImageView\">Rounded Image View</a>"
            + "<br><a href=\"https://gist.github.com/darnmason/7bbf8beae24fe7296c8a\">HeaderViewRecyclerAdapter</a>"
            + "<br><a href=\"http://github.com/google/gson\">Gson</a>"
            + "<br><a href=\"http://developer.android.com/topic/libraries/support-library/index.html\">Android Support Libraries</a>"
            + "<br><a href=\"http://developers.google.com/android/guides/overview\">Google Play Services</a>";

    TextView about = (TextView) view.findViewById(R.id.about);
    about.setMovementMethod(LinkMovementMethod.getInstance());
    about.setText(Html.fromHtml(about_text));

    return view;//from  www.  j ava 2s .com
}

From source file:at.bitfire.davdroid.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    setTitle("CardDroid " + Constants.APP_VERSION);

    TextView tv = (TextView) findViewById(R.id.text_info);
    tv.setText(Html.fromHtml(getString(R.string.html_info)));
    tv.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:org.iisgcp.waterwalk.utils.LicenseDialog.java

@Override
public void onStart() {
    super.onStart();
    // Make the textview clickable. Must be called after show()
    TextView message = (TextView) mDialog.findViewById(android.R.id.message);
    message.setMovementMethod(LinkMovementMethod.getInstance());
    message.setContentDescription(Html.fromHtml(mDialogText).toString());
}

From source file:org.mozilla.mozstumbler.client.subactivities.FirstRunFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().setTitle(getActivity().getString(R.string.first_run_welcome_to_mozstumbler));
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0xaa000000));
    getDialog().setCanceledOnTouchOutside(false);

    root = inflater.inflate(R.layout.fragment_first_run, container, false);

    TextView tv = (TextView) root.findViewById(R.id.textview2);
    tv.setMovementMethod(LinkMovementMethod.getInstance());

    Button button = (Button) root.findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override//  w  w w  .  j  av  a2 s  .c om
        public void onClick(View v) {
            FragmentActivity thisActivity = getActivity();
            if (thisActivity == null) {
                return;
            }
            MainApp theApp = (MainApp) thisActivity.getApplication();
            if (theApp == null) {
                return;
            }
            theApp.startScanning();
            ClientPrefs.getInstance(getActivity()).setFirstRun(false);

            Dialog d = getDialog();
            if (d != null) {
                dismiss();
            }
        }
    });

    return root;
}