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: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//  w w w. j a  va 2s  .  com
        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.kukumoraketo.emojibrowser.AboutDialogFragment.java

@NonNull
@Override/*from   w  ww  . j a va 2  s .  c o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    View mainView = View.inflate(getContext(), R.layout.dialog_about, null);
    builder.setView(mainView);

    builder.setPositiveButton(R.string.about_positiveButton, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    //region sets text
    TextView aboutContent = (TextView) mainView.findViewById(R.id.about_content_TextView);
    aboutContent.setText(Html.fromHtml(getString(R.string.about_content)));
    aboutContent.setMovementMethod(LinkMovementMethod.getInstance());

    TextView licenseContent = (TextView) mainView.findViewById(R.id.about_license_content_TextView);
    licenseContent.setText(Html.fromHtml(getString(R.string.about_license_content)));
    licenseContent.setMovementMethod(LinkMovementMethod.getInstance());
    //endregion

    return builder.create();
}

From source file:de.j4velin.mapsmeasure.Dialogs.java

/**
 * @param c the Context/*from   w w  w. j av  a2s. c o  m*/
 * @return the about dialog
 */
public static Dialog getAbout(final Context c) {
    AlertDialog.Builder builder = new AlertDialog.Builder(c);
    builder.setTitle(R.string.about);

    TextView tv = new TextView(c);
    int pad = (Util.dpToPx(c, 10));
    tv.setPadding(pad, pad, pad, pad);

    try {
        tv.setText(R.string.about_text);
        tv.append(c.getString(R.string.app_version,
                c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName));
        tv.setMovementMethod(LinkMovementMethod.getInstance());
    } catch (NameNotFoundException e1) {
        // should not happen as the app is definitely installed when
        // seeing the dialog
        e1.printStackTrace();
    }
    builder.setView(tv);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return builder.create();
}

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 www  . ja  v a2  s .co  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:it.reyboz.bustorino.ActivityAbout.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    Spanned htmlText = Html.fromHtml(getResources().getString(R.string.about_history));
    TextView aboutTextView = (TextView) findViewById(R.id.aboutTextView);
    assert aboutTextView != null;
    aboutTextView.setText(htmlText);//from w w w .j a  v a  2  s.  c o  m
    aboutTextView.setMovementMethod(LinkMovementMethod.getInstance());

    // Back button
    ActionBar ab = getSupportActionBar();
    assert ab != null;
    ab.setDisplayHomeAsUpEnabled(true);
}

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());/*from   w ww. ja  va  2s  . c  om*/
    text.setTextColor(getTextColor());
}

From source file:com.slushpupie.deskclock.ChangelogDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    // Standard AlertDialog does not support HTML-style links.
    // So rebuild the ScrollView->TextView with the appropriate
    // settings and set the view directly.
    TextView tv = new TextView(getActivity());
    tv.setPadding(5, 5, 5, 5);/*from  w ww. ja  va2s .c  o  m*/
    tv.setLinksClickable(true);
    tv.setMovementMethod(LinkMovementMethod.getInstance());
    tv.setText(R.string.changeLog);
    tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
    ScrollView sv = new ScrollView(getActivity());
    sv.setPadding(14, 2, 10, 12);
    sv.addView(tv);
    builder.setView(sv).setCancelable(false).setTitle(R.string.changeLogTitle).setPositiveButton(R.string.ok,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    ((DeskClock) getActivity()).acknoledgeChangelog();
                }
            });
    return builder.create();
}

From source file:in.yuvi.signpost.AboutActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ((TextView) findViewById(R.id.aboutContributors)).setMovementMethod(LinkMovementMethod.getInstance());
    ((TextView) findViewById(R.id.aboutLicense)).setMovementMethod(LinkMovementMethod.getInstance());
    stripUnderlines((TextView) findViewById(R.id.aboutContributors));
    stripUnderlines((TextView) findViewById(R.id.aboutLicense));

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:de.fau.cs.mad.kwikshop.android.view.AboutFragment.java

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

    View rootView = inflater.inflate(R.layout.activity_about, fragmentContainer, false);
    ButterKnife.inject(this, rootView);

    // link to the app's GitHub page
    String linkText = String.format("<a href=\"%s\">%s</a> ", getResources().getString(R.string.githubLink),
            getResources().getString(R.string.viewOnGitHub));
    textView_GitHubLink.setText(Html.fromHtml(linkText));
    textView_GitHubLink.setMovementMethod(LinkMovementMethod.getInstance());

    //git commit/*from w w  w. j a v  a2 s  .c  o  m*/

    String text = String.format(getResources().getString(R.string.about_Commit_Format),
            getResources().getString(R.string.BuildInfo_Git_Commit),
            getResources().getString(R.string.BuildInfo_CommonRepository_Git_Commit));

    textView_GitCommit.setText(text);

    //display acknowledgements

    LayoutInflater layoutInflater = getActivity().getLayoutInflater();
    String[] acknowledgements = getResources().getStringArray(R.array.acknowledgements_Items);
    for (String item : acknowledgements) {

        View view = layoutInflater.inflate(R.layout.activity_about_acknowledgements_item, null);
        TextView textView = (TextView) view.findViewById(R.id.textView);
        textView.setText(Html.fromHtml(item));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        acknowledgements_Container.addView(view);
    }

    // long Google Play Services attribution text
    // if we use Google Play Service it has to be included
    View view = layoutInflater.inflate(R.layout.activity_about_acknowledgements_item, null);
    TextView textView = (TextView) view.findViewById(R.id.textView);
    textView.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()));
    container.addView(view);

    return rootView;
}

From source file:com.yonisamlan.android.metaqr.AttributionsActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView textView = new TextView(this);
    setContentView(textView);// w  w  w.jav  a  2  s  .  com
    String html;

    try {
        html = IOUtils.toString(getResources().openRawResource(R.raw.licenses));
    } catch (NotFoundException e) {
        e.printStackTrace();
        html = "Error reading license.";
    } catch (IOException e) {
        e.printStackTrace();
        html = "Error reading license.";
    }

    textView.setText(Html.fromHtml(html));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
}