当前位置: 首页>>代码示例>>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;未经允许,请勿转载。