當前位置: 首頁>>代碼示例>>Java>>正文


Java ContactsWrapper類代碼示例

本文整理匯總了Java中de.ub0r.android.lib.apis.ContactsWrapper的典型用法代碼示例。如果您正苦於以下問題:Java ContactsWrapper類的具體用法?Java ContactsWrapper怎麽用?Java ContactsWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ContactsWrapper類屬於de.ub0r.android.lib.apis包,在下文中一共展示了ContactsWrapper類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleIntent

import de.ub0r.android.lib.apis.ContactsWrapper; //導入依賴的package包/類
/**
 * Handle {@link Intent}.
 *
 * @param intent {@link Intent}
 */
@SuppressWarnings("deprecation")
private void handleIntent(final Intent intent) {
    if (parseIntent(intent)) {
        setTheme(android.R.style.Theme_Translucent_NoTitleBar);
        send();
        finish();
    } else {
        int tid = getThreadId();
        if (tid >= 0) {
            Intent i = new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(
                    ConversationListActivity.URI, String.valueOf(tid)), this,
                    MessageListActivity.class);
            i.putExtra("showKeyboard", true);
            startActivity(i);
            finish();
        } else {
            setTheme(PreferencesActivity.getTheme(this));
            setContentView(R.layout.sender);
            findViewById(R.id.text_paste).setOnClickListener(this);
            final EditText et = (EditText) findViewById(R.id.text);
            et.addTextChangedListener(new MyTextWatcher(this, (TextView) this
                    .findViewById(R.id.text_paste), (TextView) findViewById(R.id.text_)));
            et.setText(text);
            final MultiAutoCompleteTextView mtv = (MultiAutoCompleteTextView) this
                    .findViewById(R.id.to);
            final MobilePhoneAdapter mpa = new MobilePhoneAdapter(this);
            final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
            MobilePhoneAdapter.setMobileNumbersOnly(p.getBoolean(
                    PreferencesActivity.PREFS_MOBILE_ONLY, false));
            mtv.setAdapter(mpa);
            mtv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
            mtv.setText(to);
            if (!TextUtils.isEmpty(to)) {
                to = to.trim();
                if (to.endsWith(",")) {
                    to = to.substring(0, to.length() - 1).trim();
                }
                if (to.indexOf('<') < 0) {
                    // try to fetch recipient's name from phone book
                    String n = ContactsWrapper.getInstance().getNameForNumber(
                            getContentResolver(), to);
                    if (n != null) {
                        to = n + " <" + to + ">, ";
                    }
                }
                mtv.setText(to);
                et.requestFocus();
            } else {
                mtv.requestFocus();
            }
            cbmgr = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
            int flags = et.getInputType();
            if (p.getBoolean(PreferencesActivity.PREFS_EDIT_SHORT_TEXT, true)) {
                flags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
            } else {
                flags &= ~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
            }
            et.setInputType(flags);
        }
    }
}
 
開發者ID:andrewxu10,項目名稱:Upkeep,代碼行數:67,代碼來源:SenderActivity.java


注:本文中的de.ub0r.android.lib.apis.ContactsWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。