当前位置: 首页>>代码示例>>Java>>正文


Java Rfc822Token.getAddress方法代码示例

本文整理汇总了Java中android.text.util.Rfc822Token.getAddress方法的典型用法代码示例。如果您正苦于以下问题:Java Rfc822Token.getAddress方法的具体用法?Java Rfc822Token.getAddress怎么用?Java Rfc822Token.getAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.util.Rfc822Token的用法示例。


在下文中一共展示了Rfc822Token.getAddress方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Address

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
private Address(String address, String personal, boolean parse) {
    if (parse) {
        Rfc822Token[] tokens =  Rfc822Tokenizer.tokenize(address);
        if (tokens.length > 0) {
            Rfc822Token token = tokens[0];
            mAddress = token.getAddress();
            String name = token.getName();
            if (!TextUtils.isEmpty(name)) {
                /*
                 * Don't use the "personal" argument if "address" is of the form:
                 * James Bond <[email protected]>
                 *
                 * See issue 2920
                 */
                mPersonal = name;
            } else {
                mPersonal = (personal == null) ? null : personal.trim();
            }
        } else {
            // This should be an error
        }
    } else {
        mAddress = address;
        mPersonal = personal;
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:27,代码来源:Address.java

示例2: Address

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
private Address(String address, String personal, boolean parse) {
    if (parse) {
        Rfc822Token[] tokens =  Rfc822Tokenizer.tokenize(address);
        if (tokens.length > 0) {
            Rfc822Token token = tokens[0];
            mAddress = token.getAddress();
            String name = token.getName();
            if (!StringUtils.isNullOrEmpty(name)) {
                /*
                 * Don't use the "personal" argument if "address" is of the form:
                 * James Bond <[email protected]>
                 *
                 * See issue 2920
                 */
                mPersonal = name;
            } else {
                mPersonal = (personal == null) ? null : personal.trim();
            }
        } else {
            // This should be an error
        }
    } else {
        mAddress = address;
        mPersonal = personal;
    }
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:27,代码来源:Address.java

示例3: parseUnencoded

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
/**
 * Parse a comma separated list of email addresses in human readable format and return an
 * array of Address objects, RFC-822 encoded.
 *
 * @param addressList
 * @return An array of 0 or more Addresses.
 */
public static Address[] parseUnencoded(String addressList) {
    List<Address> addresses = new ArrayList<Address>();
    if (!TextUtils.isEmpty(addressList)) {
        Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
        for (Rfc822Token token : tokens) {
            String address = token.getAddress();
            if (!TextUtils.isEmpty(address)) {
                addresses.add(new Address(token.getAddress(), token.getName(), false));
            }
        }
    }
    return addresses.toArray(EMPTY_ADDRESS_ARRAY);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:21,代码来源:Address.java

示例4: parseUnencoded

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
/**
 * Parse a comma separated list of email addresses in human readable format and return an
 * array of Address objects, RFC-822 encoded.
 *
 * @param addressList
 * @return An array of 0 or more Addresses.
 */
public static Address[] parseUnencoded(String addressList) {
    List<Address> addresses = new ArrayList<Address>();
    if (!StringUtils.isNullOrEmpty(addressList)) {
        Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
        for (Rfc822Token token : tokens) {
            String address = token.getAddress();
            if (!StringUtils.isNullOrEmpty(address)) {
                addresses.add(new Address(token.getAddress(), token.getName(), false));
            }
        }
    }
    return addresses.toArray(EMPTY_ADDRESS_ARRAY);
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:21,代码来源:Address.java

示例5: inviteBuddies

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
void inviteBuddies() {
    Rfc822Token[] recipients = Rfc822Tokenizer.tokenize(mNewAddress.getText());

    Pattern pattern = Pattern.compile(EMAIL_PATTERN);

    boolean foundOne = false;

    for (Rfc822Token recipient : recipients) {

        String address = recipient.getAddress();
        if (pattern.matcher(address).matches()) {
            new AddContactAsyncTask(mApp.getDefaultProviderId(), mApp.getDefaultAccountId(), mApp).execute(address, null, null);
            foundOne = true;
        }
    }

    if (foundOne) {
        Intent intent = new Intent();
        intent.putExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAME, recipients[0].getAddress());
        intent.putExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER, mApp.getDefaultProviderId());
        setResult(RESULT_OK, intent);
        finish();
    }



}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:28,代码来源:AddContactActivity.java

示例6: parseUnencoded

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public static Address[] parseUnencoded(String addressList) {
    List<Address> addresses = new ArrayList<Address>();
    if (addressList!=null
        && !"".equals(addressList)) {
        Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
        for (Rfc822Token token : tokens) {
            String address = token.getAddress();
            if (address!=null
                && !"".equals(address)) {
                addresses.add(new Address(token.getAddress(), token.getName()));
            }
        }
    }
    return addresses.toArray(new Address[0]);
}
 
开发者ID:baolongnt,项目名称:EmailPopup,代码行数:16,代码来源:Address.java

示例7: inviteBuddies

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
void inviteBuddies() {
    Rfc822Token[] recipients = Rfc822Tokenizer.tokenize(mAddressList.getText());
    try {
        IImConnection conn = mApp.getConnection(mProviderId);
        IContactList list = getContactList(conn);
        if (list == null) {
            Log.e(ImApp.LOG_TAG, "<AddContactActivity> can't find given contact list:"
                                 + getSelectedListName());
            finish();
        } else {
            boolean fail = false;
            for (Rfc822Token recipient : recipients) {
                String username = recipient.getAddress();
                if (mDefaultDomain != null && username.indexOf('@') == -1) {
                    username = username + "@" + mDefaultDomain;
                }
                if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)) {
                    log("addContact:" + username);
                }
                int res = list.addContact(username);
                if (res != ImErrorInfo.NO_ERROR) {
                    fail = true;
                    mHandler.showAlert(R.string.error,
                            ErrorResUtils.getErrorRes(getResources(), res, username));
                }
            }
            // close the screen if there's no error.
            if (!fail) {
                finish();
            }
        }
    } catch (RemoteException ex) {
        Log.e(ImApp.LOG_TAG, "<AddContactActivity> inviteBuddies: caught " + ex);
    }
}
 
开发者ID:prive,项目名称:prive-android,代码行数:36,代码来源:AddContactActivity.java

示例8: addAttendees

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public void addAttendees(String attendees) {
    final LinkedHashSet<Rfc822Token> addresses =
            EditEventHelper.getAddressesFromList(attendees, mValidator);
    synchronized (this) {
        for (final Rfc822Token address : addresses) {
            final Attendee attendee = new Attendee(address.getName(), address.getAddress());
            if (TextUtils.isEmpty(attendee.mName)) {
                attendee.mName = attendee.mEmail;
            }
            addOneAttendee(attendee);
        }
    }
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:14,代码来源:AttendeesView.java

示例9: addAttendees

import android.text.util.Rfc822Token; //导入方法依赖的package包/类
public void addAttendees(String attendees, Rfc822Validator validator) {
    final LinkedHashSet<Rfc822Token> addresses = EditEventHelper.getAddressesFromList(
            attendees, validator);
    synchronized (this) {
        for (final Rfc822Token address : addresses) {
            final Attendee attendee = new Attendee(address.getName(), address.getAddress());
            if (TextUtils.isEmpty(attendee.mName)) {
                attendee.mName = attendee.mEmail;
            }
            addAttendee(attendee);
        }
    }
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:14,代码来源:CalendarEventModel.java


注:本文中的android.text.util.Rfc822Token.getAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。