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:com.Candy.ota.settings.About.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about);/*from w w  w  .ja v a 2  s.c om*/

    mHomeURL = (TextView) findViewById(ID_HOME_URL);
    mContact = (TextView) findViewById(ID_CONTACT);
    mLicense = (TextView) findViewById(ID_LICENSE);

    mHomeURL.setMovementMethod(LinkMovementMethod.getInstance());
    mContact.setMovementMethod(LinkMovementMethod.getInstance());
    mLicense.setMovementMethod(LinkMovementMethod.getInstance());

    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayHomeAsUpEnabled(true);

}

From source file:com.connectsdk.smarthomesampler.dialog.AcknowledgementsFragmentDialog.java

@NonNull
@Override//from   www.  ja  v  a 2s  .c  o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getActivity();
    final TextView message = new TextView(context);
    message.setText(Html.fromHtml(context.getString(R.string.info_message)));
    message.setMovementMethod(LinkMovementMethod.getInstance());
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25,
            context.getResources().getDisplayMetrics());
    message.setPadding(padding, 0, padding, 0);
    ScrollView scrollView = new ScrollView(context);
    scrollView.addView(message);

    return new AlertDialog.Builder(context).setTitle(R.string.info_title).setView(scrollView)
            .setCancelable(true).create();
}

From source file:com.google.samples.apps.ledtoggler.UserConsentDialogFragment.java

@NonNull
@Override/*from w  w  w.  j av a2s  .c  o m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Spanned message = android.text.Html.fromHtml(getString(R.string.tos_confirmation));

    TextView tv = new TextView(getActivity());
    tv.setText(message);

    tv.setMovementMethod(LinkMovementMethod.getInstance());

    tv.setTextSize(20);
    tv.setGravity(Gravity.CENTER);

    int spacingInPixels = dpsToPixels(16);
    AlertDialog dialog = new AlertDialog.Builder(getActivity())
            .setView(tv, spacingInPixels, spacingInPixels, spacingInPixels, spacingInPixels)
            .setPositiveButton(R.string.tos_accept, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    onTosAccepted();
                }
            }).setNegativeButton(R.string.tos_cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    onTosRejected();
                }
            }).create();
    dialog.setCanceledOnTouchOutside(false);
    setCancelable(false);
    return dialog;

}

From source file:com.google.android.demos.html.HtmlActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.main);/*from   w  w  w  . jav a  2  s . c  o m*/
    mHtmlView = (HtmlView) findViewById(R.id.html);
    mHtmlView.setHtmlChromeClient(new ProgressChromeClient());
    mHtmlView.setMovementMethod(LinkMovementMethod.getInstance());

    // Load HTML asynchronously:
    //
    // TODO: Move this functionality into HtmlView
    new HtmlTask().execute("http://slashdot.org/palm");
}

From source file:com.microsoft.mimickeralarm.utilities.GeneralUtilities.java

public static void enableLinks(TextView view) {
    if (view != null) {
        view.setMovementMethod(LinkMovementMethod.getInstance());
        GeneralUtilities.stripUnderlines(view);
    }/*w w w . j  a  va2 s.  c om*/
}

From source file:net.sf.openrocket.android.AboutDialogFragment.java

@Override
public void onStart() {
    super.onStart();
    ((TextView) this.getDialog().findViewById(android.R.id.message))
            .setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.tmendes.birthdaydroid.AboutUsFragment.java

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

    View v = inflater.inflate(R.layout.fragment_about_us, container, false);

    TextView appVersion = (TextView) v.findViewById(R.id.tvVersion);
    TextView tvHelpDevel = (TextView) v.findViewById(R.id.tvHelpDevel);
    TextView tvHelpIssue = (TextView) v.findViewById(R.id.tvHelpIssue);
    TextView tvHelpTranslator = (TextView) v.findViewById(R.id.tvHelpTranslator);
    TextView tvIcons01 = (TextView) v.findViewById(R.id.tvIcons01);
    TextView tvTranslatorNames = (TextView) v.findViewById(R.id.tvTranslatorNames);

    tvHelpDevel.setMovementMethod(LinkMovementMethod.getInstance());
    tvHelpIssue.setMovementMethod(LinkMovementMethod.getInstance());
    tvHelpTranslator.setMovementMethod(LinkMovementMethod.getInstance());
    tvIcons01.setMovementMethod(LinkMovementMethod.getInstance());
    tvTranslatorNames.setMovementMethod(LinkMovementMethod.getInstance());

    appVersion//from   ww  w .j  a va  2s  .c  om
            .setText(container.getContext().getResources().getString(R.string.build, BuildConfig.VERSION_CODE));

    return v;

}

From source file:io.jari.geenstijl.Dialogs.AboutDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();

    final View view = inflater.inflate(R.layout.dialog_about, null);
    builder.setView(view);//from  w  ww .  ja  va 2 s.  c  o  m
    TextView version = (TextView) view.findViewById(R.id.about_version);
    TextView desc = (TextView) view.findViewById(R.id.about_desc);
    desc.setMovementMethod(LinkMovementMethod.getInstance());

    try {
        version.setText(activity.getResources().getString(R.string.about_version)
                + activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0).versionName);
    } catch (PackageManager.NameNotFoundException e) {
        version.setText(activity.getResources().getString(R.string.about_version) + "????");
    }
    return builder.create();
}

From source file:com.swisscom.safeconnect.fragment.PipeDialogFragment.java

@Override
public void onStart() {
    super.onStart();

    // clickable hyperlinks
    TextView tvMessage = (TextView) getDialog().findViewById(android.R.id.message);
    if (tvMessage != null) {
        tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
    }/*from w  w w  .  ja v a  2s. co  m*/
}

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);//from ww w.  j a v a2  s.c o m

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

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