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:net.yolosec.upckeygen.ui.AboutTabHostActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_dialog);

    try {/*from  w ww. j  a  v  a 2s.c o m*/
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    } catch (Exception e) {
        Log.e(TAG, "Exception", e);
    }

    TabHost tabs = (TabHost) findViewById(R.id.tabhost);
    tabs.setup();

    TabHost.TabSpec tspec1 = tabs.newTabSpec("about");
    tspec1.setIndicator(getString(R.string.pref_2section));
    tspec1.setContent(R.id.text_about_scroll);
    TextView text = ((TextView) findViewById(R.id.text_about));
    text.setMovementMethod(LinkMovementMethod.getInstance());
    try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        String version = pInfo.versionName;
        text.append(version);
    } catch (Exception e) {
        Log.e(TAG, "Exception in getting app version", e);
    }
    tabs.addTab(tspec1);

    TabHost.TabSpec tspec2 = tabs.newTabSpec("credits");
    tspec2.setIndicator(getString(R.string.dialog_about_credits));
    tspec2.setContent(R.id.about_credits_scroll);
    ((TextView) findViewById(R.id.about_credits)).setMovementMethod(LinkMovementMethod.getInstance());
    tabs.addTab(tspec2);
    TabHost.TabSpec tspec3 = tabs.newTabSpec("license");
    tspec3.setIndicator(getString(R.string.dialog_about_license));
    tspec3.setContent(R.id.about_license_scroll);
    ((TextView) findViewById(R.id.about_license)).setMovementMethod(LinkMovementMethod.getInstance());
    tabs.addTab(tspec3);
}

From source file:com.pasta.mensadd.fragments.ImprintFragment.java

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_imprint, container, false);
    setHasOptionsMenu(true);/*from w  w  w. j  av a  2 s  . c o m*/
    mPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
    TextView baconView = v.findViewById(R.id.imprintLicenseBacon);
    if (mPrefs.getBoolean(getString(R.string.pref_bacon_key), false))
        baconView.setVisibility(View.VISIBLE);
    TextView licenseView = v.findViewById(R.id.imprintLicense);

    licenseView.setMovementMethod(LinkMovementMethod.getInstance());
    licenseView.setText(Html.fromHtml(getString(R.string.imprint_license)));
    ImageView banner = v.findViewById(R.id.banner_imprint);
    banner.setOnClickListener(this);
    MainActivity activity = (MainActivity) getActivity();
    if (activity != null)
        activity.updateToolbar(-1, getString(R.string.pref_imprint));
    Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    return v;
}

From source file:com.lorenz.arthur.citybike.CopyrightActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_copyright);

    //set actionbar
    actionBar = getSupportActionBar();/* www.  j ava  2 s . co  m*/
    actionBar.setDefaultDisplayHomeAsUpEnabled(true);

    //set TextView
    TextView copyRight = (TextView) findViewById(R.id.textView2);
    copyRight.setText(COPYRIGHT);
    copyRight.setMovementMethod(new ScrollingMovementMethod());
}

From source file:io.github.importre.android.chromeadb.HelpFragment.java

private void setContents(View view) {
    TextView see = (TextView) view.findViewById(R.id.see_chromeadb);
    see.setText(Html.fromHtml(getActivity().getString(R.string.help_desc2)));
    see.setMovementMethod(LinkMovementMethod.getInstance());
}

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

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

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

    TextView versionText = (TextView) view.findViewById(R.id.about_version);
    versionText.setText(getString(R.string.about_version) + " " + getVersion());

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

    return view;
}

From source file:de.vakuumverpackt.foul.About.java

@Override
public void onCreate(final Bundle bundle) {
    setContentView(R.layout.activity_about);

    TextView text = (TextView) findViewById(R.id.textView);
    text.setLinkTextColor(getLinkColor());
    text.setMovementMethod(LinkMovementMethod.getInstance());
    text.setText(getText());// w w w.j  a va 2  s  . c  o m
    text.setTextColor(getTextColor());
}

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));/*from   w w w .  j  ava2  s.c  om*/
    tv.setMovementMethod(LinkMovementMethod.getInstance());
    return rootView;
}

From source file:uk.co.richyhbm.coinbag.activities.AboutActivity.java

private void initHyperlinks() {
    //Elements that have a hyper link in them
    int data[] = { R.id.developed_by, R.id.ja_bc_license, R.id.zxing_license, R.id.sugar_orm_license,
            R.id.coin_bag_icon_license, R.id.cryptocoin_icon_license, R.id.okhttp_license, R.id.moshi_license };

    for (int aData : data) {
        TextView text = (TextView) findViewById(aData);
        if (text != null) {
            text.setMovementMethod(LinkMovementMethod.getInstance());
        }/*from w  ww .ja  va 2 s  . c  om*/
    }
}

From source file:com.example.ahmed.ui.Welcome.InfoActivity.java

protected void showLicenseInfo() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("License information");

    TextView tv = new TextView(this);
    tv.setMovementMethod(new ScrollingMovementMethod());
    tv.setText(Html.fromHtml(getString(R.string.isc_license)));
    tv.setPadding(16, 12, 16, 0);/*w w  w .j a  va2s  . co m*/
    alert.setView(tv);

    alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    });
    alert.show();
}

From source file:org.catrobat.catroid.ui.dialogs.AcceptTermsOfUseDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle bundle) {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_terms_of_use, null);

    TextView termsOfUseUrlTextView = (TextView) view.findViewById(R.id.dialog_terms_of_use_text_view_url);
    termsOfUseUrlTextView.setMovementMethod(LinkMovementMethod.getInstance());

    String termsOfUseUrl = getString(R.string.terms_of_use_link_template, Constants.CATROBAT_TERMS_OF_USE_URL,
            getString(R.string.dialog_terms_of_use_link_text));

    termsOfUseUrlTextView.setText(Html.fromHtml(termsOfUseUrl));

    Dialog termsOfUseDialog = new AlertDialog.Builder(getActivity()).setView(view)
            .setTitle(R.string.dialog_terms_of_use_title)
            .setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
                @Override/*from  ww w  .  java 2s .c  o m*/
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            }).create();
    termsOfUseDialog.setCanceledOnTouchOutside(true);

    return termsOfUseDialog;
}