Example usage for android.text.util Linkify EMAIL_ADDRESSES

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

Introduction

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

Prototype

int EMAIL_ADDRESSES

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

Click Source Link

Document

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

Usage

From source file:com.schedjoules.eventdiscovery.framework.utils.linkify.EmailLinkified.java

public EmailLinkified(final Spannable input) {
    super(new com.schedjoules.eventdiscovery.framework.utils.factory.Factory<Spannable>() {
        @Override//from  w  w w . j  ava  2  s  .c o m
        public Spannable create() {
            LinkifyCompat.addLinks(input, Linkify.EMAIL_ADDRESSES);
            return input;
        }
    });
}

From source file:it.scoppelletti.mobilepower.app.HelpActivity.java

/**
 * Creazione dell&rsquo;attivit&agrave;.
 * //from w  w  w  . j  a v  a2s  . c  om
 * @param savedInstanceState Stato dell&rsquo;istanza.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    TextView textControl;
    MarketTagHandler tagHandler;

    super.onCreate(savedInstanceState);

    setTheme(AppUtils.getActivityTheme());
    setContentView(R.layout.textview);

    textControl = (TextView) findViewById(R.id.txt_content);
    textControl.setKeyListener(null);
    textControl.setAutoLinkMask(Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

    tagHandler = new MarketTagHandler();
    textControl.setText(Html.fromHtml(buildText(), null, tagHandler));
    tagHandler.addLinks(textControl, myFullPkgName);
}

From source file:com.dev.campus.event.EventFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_event, container, false);
    ((TextView) rootView.findViewById(R.id.event_view_title)).setText(mEvent.getTitle());
    ((TextView) rootView.findViewById(R.id.event_view_category)).setText(mEvent.getCategory());
    ((TextView) rootView.findViewById(R.id.event_view_date)).setText(mEvent.getStringDate());

    TextView detailsView = (TextView) rootView.findViewById(R.id.event_view_details);
    detailsView.setText(Html.fromHtml(mEvent.getDetails()));
    Linkify.addLinks(detailsView, Linkify.EMAIL_ADDRESSES);
    detailsView.setMovementMethod(LinkMovementMethod.getInstance());
    return rootView;
}

From source file:it.scoppelletti.mobilepower.app.ReleaseNoteActivity.java

/**
 * Creazione dell&rsquo;attivit&agrave;.
 * //from   ww  w. j av a 2s .c  o m
 * @param savedInstanceState Stato dell&rsquo;istanza.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    String notes;
    TextView textControl;
    Button button;
    MarketTagHandler tagHandler;

    super.onCreate(savedInstanceState);

    setTheme(AppUtils.getActivityTheme());
    setContentView(R.layout.releasenotes);

    textControl = (TextView) findViewById(R.id.txt_content);
    textControl.setKeyListener(null);
    textControl.setAutoLinkMask(Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

    notes = getIntent().getStringExtra(ReleaseNoteActivity.EXTRA_RELEASENOTES);
    if (!StringUtils.isBlank(notes)) {
        tagHandler = new MarketTagHandler();
        textControl.setText(Html.fromHtml(notes, null, tagHandler));
        tagHandler.addLinks(textControl, AppUtils.getFullPackageName(this, false));
    }

    button = (Button) findViewById(R.id.cmd_continue);
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });
}

From source file:it.scoppelletti.mobilepower.app.AboutActivity.java

/**
 * Creazione dell&rsquo;attivit&agrave;.
 * /*from  w  w  w. j av a  2 s.c  om*/
 * @param savedInstanceState Stato dell&rsquo;istanza.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    TextView textControl;
    MarketTagHandler tagHandler;

    super.onCreate(savedInstanceState);

    setTheme(AppUtils.getActivityTheme());
    setContentView(R.layout.textview);

    textControl = (TextView) findViewById(R.id.txt_content);
    textControl.setKeyListener(null);
    textControl.setAutoLinkMask(Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

    tagHandler = new MarketTagHandler();
    textControl.setText(Html.fromHtml(buildText(), null, tagHandler));
    tagHandler.addLinks(textControl, AppUtils.getFullPackageName(this, false));
}

From source file:de.tum.mw.lfe.drtrc.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_about, container, false);
    ((MainActivity) getActivity()).addToReportView(null);//call with (null) just to refresh the reportView

    String tempStr = getVersionString();
    tempStr += "<br/><br/>This is an open source implementation of an application to control an Arduino Detection Response Task (DRT) via USB OTG connection.";
    tempStr += "<br/><br/> (c) Michael Krause <a href=\"mailto:krause@tum.de\">krause@tum.de</a> <br/>2015 Institute of Ergonomics, TUM";
    tempStr += "<br/><br/>More information on <br/><a href=\"http://www.lfe.mw.tum.de/drt-rc\">http://www.lfe.mw.tum.de/drt-rc</a>";
    tempStr += "<br/><br/>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.";

    final SpannableString s = new SpannableString(Html.fromHtml(tempStr));
    Linkify.addLinks(s, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);
    TextView tv = (TextView) rootView.findViewById(R.id.aboutTextView);
    tv.setText(s);/*from   ww  w  . ja v a  2  s .  c  o m*/

    return rootView;
}

From source file:org.ewicom.pps.unitinfo.TabLeadersFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    personDataSource = new PersonDataSource(getActivity());
    personDataSource.open();//from w  w w.j av a 2s  .c  o m

    LinearLayout leadersLL = (LinearLayout) getView().findViewById(R.id.ll_leaders);

    List<Person> persons = new ArrayList<Person>();
    persons = personDataSource.getPersonsByUnitId(unitID);

    if (persons != null && !persons.isEmpty()) {
        Iterator<Person> iterator = persons.iterator();

        while (iterator.hasNext()) {

            final Person person = iterator.next();

            LinearLayout personLL = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.person_ll,
                    null);

            TextView positionTV = (TextView) personLL.findViewById(R.id.text_personposition);
            TextView nameTV = (TextView) personLL.findViewById(R.id.text_personname);
            TextView phoneTV = (TextView) personLL.findViewById(R.id.text_personphone);
            TextView emailTV = (TextView) personLL.findViewById(R.id.text_personemail);

            positionTV.setText(person.getPosition());
            nameTV.setText(person.getPerson());
            phoneTV.setText(person.getPhone());
            emailTV.setText(person.getEmail());

            Linkify.addLinks(phoneTV, Linkify.PHONE_NUMBERS);
            Linkify.addLinks(emailTV, Linkify.EMAIL_ADDRESSES);

            TextView saveContactLink = (TextView) getActivity().getLayoutInflater()
                    .inflate(R.layout.textview_link_savecontact, null);
            LayoutParams linkParam = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
            personLL.addView(saveContactLink, linkParam);
            saveContactLink.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent saveContactIntent = new Intent(Intents.Insert.ACTION);
                    saveContactIntent.setType(ContactsContract.RawContacts.CONTENT_TYPE);

                    saveContactIntent.putExtra(Intents.Insert.NAME, person.getPerson());
                    saveContactIntent.putExtra(Intents.Insert.JOB_TITLE, person.getPosition());
                    saveContactIntent.putExtra(Intents.Insert.PHONE, person.getPhone());
                    saveContactIntent.putExtra(Intents.Insert.EMAIL, person.getEmail());

                    startActivity(saveContactIntent);
                }
            });

            leadersLL.addView(personLL);

        }

    }

}

From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java

public AlertDialog.Builder buildNoticeDialog(CharSequence text) {
    TextView textView = new TextView(activity);
    textView.setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
    textView.setPadding((int) spaceSuperRelax, (int) spaceSuperRelax, (int) spaceSuperRelax,
            (int) spaceSuperRelax);
    textView.setText(text);// w  w  w. java  2  s .c om
    ScrollView scrollView = new ScrollView(activity);
    scrollView.addView(textView);
    return new AlertDialog.Builder(activity).setView(scrollView).setPositiveButton(android.R.string.ok, null);
}

From source file:com.github.wakhub.monodict.activity.settings.DownloadsActivity.java

@ItemClick(android.R.id.list)
void onClickListItem(int position) {
    final DownloadsItem item = listAdapter.getItem(position);
    TextView textView = new TextView(this);
    textView.setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
    textView.setPadding((int) spaceRelax, (int) spaceRelax, (int) spaceRelax, (int) spaceRelax);
    textView.setText(String.format("%s\nsize: %s", item.getDescription(), item.getSize()));
    ScrollView scrollView = new ScrollView(this);
    scrollView.addView(textView);//from www  . j  a v a2  s . co  m

    new AlertDialog.Builder(this)
            .setPositiveButton(R.string.action_download, new AlertDialog.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    resultIntent.putExtra(RESULT_INTENT_ENGLISH, item.isEnglish());
                    resultIntent.putExtra(RESULT_INTENT_FILENAME, item.getName());
                    startDownload(item);
                }
            }).setNegativeButton(android.R.string.cancel, null).setIcon(R.drawable.ic_action_download)
            .setTitle(item.getName()).setView(scrollView).show();
}

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);/*  w ww  .j  a  va 2  s.c om*/

    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);
    }
}