Example usage for android.text.util Linkify MAP_ADDRESSES

List of usage examples for android.text.util Linkify MAP_ADDRESSES

Introduction

In this page you can find the example usage for android.text.util Linkify MAP_ADDRESSES.

Prototype

int MAP_ADDRESSES

To view the source code for android.text.util Linkify MAP_ADDRESSES.

Click Source Link

Document

Bit field indicating that street addresses should be matched in methods that take an options mask.

Usage

From source file:com.apptentive.android.sdk.module.messagecenter.view.holder.MessageComposerHolder.java

public void bindView(final MessageCenterFragment fragment, final MessageCenterRecyclerViewAdapter adapter,
        final Composer composer) {
    title.setText(composer.title);/*from  w  w w.j  a  v a2s. c o  m*/

    closeButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (!TextUtils.isEmpty(message.getText().toString().trim()) || !images.isEmpty()) {
                Bundle bundle = new Bundle();
                bundle.putString("message", composer.closeBody);
                bundle.putString("positive", composer.closeDiscard);
                bundle.putString("negative", composer.closeCancel);
                ApptentiveAlertDialog.show(fragment, bundle,
                        Constants.REQUEST_CODE_CLOSE_COMPOSING_CONFIRMATION);
            } else {
                if (adapter.getListener() != null) {
                    adapter.getListener().onCancelComposing();
                }
            }
        }
    });

    sendButton.setContentDescription(composer.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (adapter.getListener() != null) {
                adapter.getListener().onFinishComposing();
            }
        }
    });

    message.setHint(composer.messageHint);

    message.removeTextChangedListener(textWatcher);
    textWatcher = new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (adapter.getListener() != null) {
                adapter.getListener().beforeComposingTextChanged(charSequence);
            }
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
            if (adapter.getListener() != null) {
                adapter.getListener().onComposingTextChanged(charSequence);
            }
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (adapter.getListener() != null) {
                adapter.getListener().afterComposingTextChanged(editable.toString());
            }
            Linkify.addLinks(editable,
                    Linkify.WEB_URLS | Linkify.PHONE_NUMBERS | Linkify.EMAIL_ADDRESSES | Linkify.MAP_ADDRESSES);
        }
    };
    message.addTextChangedListener(textWatcher);

    attachButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (adapter.getListener() != null) {
                adapter.getListener().onAttachImage();
            }
        }
    });

    attachments.setupUi();
    attachments.setupLayoutListener();
    attachments.setListener(new ApptentiveImageGridView.ImageItemClickedListener() {
        @Override
        public void onClick(int position, ImageItem image) {
            if (adapter.getListener() != null) {
                adapter.getListener().onClickAttachment(position, image);
            }
        }
    });
    attachments.setAdapterIndicator(R.drawable.apptentive_ic_remove_attachment);

    attachments.setImageIndicatorCallback(fragment);
    //Initialize image attachments band with empty data
    clearImageAttachmentBand();
    attachments.setVisibility(View.GONE);
    attachments.setData(new ArrayList<ImageItem>());
    setAttachButtonState();

    if (adapter.getListener() != null) {
        adapter.getListener().onComposingViewCreated(this, message, attachments);
    }
}

From source file:cgeo.geocaching.CacheDetailActivity.java

private static void setPersonalNote(final TextView personalNoteView, final String personalNote) {
    personalNoteView.setText(personalNote, TextView.BufferType.SPANNABLE);
    if (StringUtils.isNotBlank(personalNote)) {
        personalNoteView.setVisibility(View.VISIBLE);
        Linkify.addLinks(personalNoteView, Linkify.MAP_ADDRESSES | Linkify.WEB_URLS);
    } else {//from   w w  w.  ja v a  2 s.  co  m
        personalNoteView.setVisibility(View.GONE);
    }
}