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:tk.jordynsmediagroup.nightmode.activity.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    try {/*from   ww  w .  j av  a  2  s .  c om*/
        // Set the context of the textview to the app VerionName
        TextView version = (TextView) findViewById(R.id.nameView);
        String app_ver = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
        version.setText(getString(R.string.app_name) + " Version" + " " + app_ver);
    } catch (PackageManager.NameNotFoundException e) {
        // This should never happen
        Log.e("NightMode/AboutActivity", e.getMessage());
        finish();
    }
    TextView licenseDetails = (TextView) findViewById(R.id.licenceText);
    licenseDetails.setText(Html.fromHtml(getString(R.string.licence_info)));
    // Make the license scrollable
    licenseDetails.setMovementMethod(new ScrollingMovementMethod());
}

From source file:com.ijuru.kumva.app.activity.EntryActivity.java

/**
 * Sets the text of a text view or hides it if the text is empty
 * @param itemId the text view identifier
 * @param text the text/*from  www .j  a  v a 2s  . c o m*/
 */
protected void setItemTextOrHide(int itemId, CharSequence text) {
    TextView view = (TextView) findViewById(itemId);
    view.setMovementMethod(LinkMovementMethod.getInstance());

    if (!TextUtils.isEmpty(text)) {
        view.setText(text);
    } else {
        view.setVisibility(View.GONE);
    }
}

From source file:org.birthdayadapter.ui.InstallWorkaroundDialogFragment.java

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

    // Make the textview clickable. Must be called after show()
    TextView messageTextView = ((TextView) getDialog().findViewById(android.R.id.message));
    if (messageTextView != null) {
        messageTextView.setMovementMethod(LinkMovementMethod.getInstance());
    }/*from w  ww . java  2  s.c om*/
}

From source file:com.kukumoraketo.emojibrowser.AboutDialogFragment.java

@NonNull
@Override//from  ww w  .jav a2  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:color.kidpaint.com.kidpaintcolor.dialog.DialogTermsOfUseAndService.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*from  w w w. jav  a2  s .  c  o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity());

    builder.setTitle(R.string.terms_of_use_and_service_title);
    View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null);

    TextView termsOfUseAndServiceTextView = (TextView) view
            .findViewById(R.id.terms_of_use_and_service_tview_Text);
    termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content);

    TextView termsOfUseAndServiceUrlTextView = (TextView) view
            .findViewById(R.id.terms_of_use_and_service_tview_Url);
    termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance());
    Resources resources = getActivity().getResources();
    String paintroidTermsOfUseAndService = String.format(
            resources.getString(R.string.terms_of_use_and_service_link_template),
            resources.getString(R.string.terms_of_use_and_service_url),
            resources.getString(R.string.terms_of_use_and_service_url_text));
    termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService));
    termsOfUseAndServiceUrlTextView.append("\n\n");
    String aboutCatroid = String.format(resources.getString(R.string.about_link_template),
            resources.getString(R.string.catroid_url), resources.getString(R.string.about_catroid_url_text));
    termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid));
    termsOfUseAndServiceUrlTextView.append("\n");

    builder.setView(view);
    builder.setNeutralButton(R.string.done, this);

    return builder.create();

}

From source file:org.jared.synodroid.ds.ui.SynologyInfoFragment.java

/**
 * Activity creation/* w  ww .  ja  va  2  s  .co m*/
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    try {
        if (((Synodroid) getActivity().getApplication()).DEBUG)
            Log.v(Synodroid.DS_TAG, "SynologyInfoFragment: Creating Synology Info fragment");
    } catch (Exception ex) {
        /*DO NOTHING*/}

    View help = inflater.inflate(R.layout.syno_info, null, false);

    TextView main_web = (TextView) help.findViewById(R.id.syno_main_web);
    main_web.setText(Html.fromHtml("<a href=\"http://www.synology.com\">www.synology.com</a>"));
    main_web.setMovementMethod(LinkMovementMethod.getInstance());

    TextView buy = (TextView) help.findViewById(R.id.syno_buy_web);
    buy.setText(Html.fromHtml(
            "<a href=\"http://www.synology.com/support/wheretobuy.php\">www.synology.com/support/wheretobuy.php</a>"));
    buy.setMovementMethod(LinkMovementMethod.getInstance());

    return help;
}

From source file:com.color.kid.kidpaint.dialog.DialogTermsOfUseAndService.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//from   ww w . jav  a  2 s  .co  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity());

    builder.setTitle(R.string.terms_of_use_and_service_title);
    View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null);

    TextView termsOfUseAndServiceTextView = (TextView) view
            .findViewById(R.id.terms_of_use_and_service_tview_Text);
    termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content);

    TextView termsOfUseAndServiceUrlTextView = (TextView) view
            .findViewById(R.id.terms_of_use_and_service_tview_Url);
    termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance());
    Resources resources = getActivity().getResources();
    String paintroidTermsOfUseAndService = String.format(
            resources.getString(R.string.terms_of_use_and_service_link_template),
            resources.getString(R.string.terms_of_use_and_service_url),
            resources.getString(R.string.terms_of_use_and_service_url_text));
    termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService));
    termsOfUseAndServiceUrlTextView.append("\n\n");
    String aboutCatroid = String.format(
            /*resources.getString(R.string.about_link_template),
            resources.getString(R.string.catroid_url),*/
            resources.getString(R.string.about_catroid_url_text));
    termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid));
    termsOfUseAndServiceUrlTextView.append("\n");

    builder.setView(view);
    builder.setNeutralButton(R.string.done, this);

    return builder.create();

}

From source file:de.grobox.liberario.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.activity_about);

    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_info);
    setTitle(getResources().getString(R.string.action_about) + " "
            + getResources().getString(R.string.app_name));

    String versionName;/*from   ww  w  .  j a va  2s. c  o  m*/
    try {
        versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
        versionName = "?.?";
    }

    // add app name and version
    TextView aboutApp = (TextView) findViewById(R.id.aboutApp);
    aboutApp.setText(getResources().getString(R.string.app_name) + "  " + versionName);

    // create real paragraphs
    TextView t = (TextView) findViewById(R.id.aboutTextView);
    t.setText(Html.fromHtml(getString(R.string.about)));

    // make links in about text clickable
    t.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:ru.yandex.subtitles.ui.fragment.conversations.ZoomedMessageFragment.java

@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final TextView messageView = findView(R.id.message);
    messageView.setMovementMethod(new ScrollingMovementMethod());
    messageView.setOnClickListener(this);

    if (mMessage != null) {
        messageView.setText(mMessage.getText());

        final Bundle loaderArgs = MessageLoader.forMessageId(mMessage.getId());
        getLoaderManager().initLoader(R.id.message_loader, loaderArgs, this);
    }//w w  w  .  ja va 2 s. c o m
}

From source file:com.darizotas.metadatastrip.AboutDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //Set title for this dialog
    getDialog().setTitle(getResources().getString(R.string.app_name) + " v1.0");
    //Set the licenses
    View v = inflater.inflate(R.layout.fragment_about_dialog, container, false);
    TextView tv = (TextView) v.findViewById(R.id.textAbout);
    //http://stackoverflow.com/questions/1748977/making-textview-scrollable-in-android
    tv.setMovementMethod(new ScrollingMovementMethod());

    tv.setText(getLicense(License.LIC_METADATASTRIP) + "\n\n*** Third party license agreements ***\n\n"
            + getLicense(License.LIC_METADATAEXTRACTOR) + "\n\n*** ***\n\n"
            + getLicense(License.LIC_HOPSTARTER));

    return v;//ww w .  j ava2 s  .  co  m
}