Search in sources :

Example 1 with ContactsPreferences

use of com.android.contacts.common.preference.ContactsPreferences in project android_packages_apps_Dialer by MoKee.

the class CallDetailActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mContext = this;
    mResources = getResources();
    mContactInfoHelper = new ContactInfoHelper(this, GeoUtil.getCurrentCountryIso(this));
    mContactsPreferences = new ContactsPreferences(mContext);
    mCallTypeHelper = new CallTypeHelper(getResources());
    mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(getContentResolver());
    mVoicemailUri = getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.call_detail);
    mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    mHistoryList = (ListView) findViewById(R.id.history);
    mHistoryList.addHeaderView(mInflater.inflate(R.layout.call_detail_header, null));
    mHistoryList.addFooterView(mInflater.inflate(R.layout.call_detail_footer, null), null, false);
    mQuickContactBadge = (QuickContactBadge) findViewById(R.id.quick_contact_photo);
    mQuickContactBadge.setOverlay(null);
    if (CompatUtils.hasPrioritizedMimeType()) {
        mQuickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
    }
    mCallerName = (TextView) findViewById(R.id.caller_name);
    mCallerNumber = (TextView) findViewById(R.id.caller_number);
    mAccountLabel = (TextView) findViewById(R.id.phone_account_label);
    mContactPhotoManager = ContactPhotoManager.getInstance(this);
    mCallButton = findViewById(R.id.call_back_button);
    mCallButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (TextUtils.isEmpty(mNumber)) {
                return;
            }
            Intent dialIntent = new CallIntentBuilder(getDialableNumber()).setCallInitiationType(LogState.INITIATION_CALL_DETAILS).build();
            if (DialerUtils.isConferenceURICallLog(mNumber, mPostDialDigits)) {
                dialIntent.putExtra("org.codeaurora.extra.DIAL_CONFERENCE_URI", true);
            }
            mContext.startActivity(dialIntent);
        }
    });
    mBlockNumberActionItem = (TextView) findViewById(R.id.call_detail_action_block);
    updateBlockActionItemVisibility(View.VISIBLE);
    mBlockNumberActionItem.setOnClickListener(this);
    mEditBeforeCallActionItem = findViewById(R.id.call_detail_action_edit_before_call);
    mEditBeforeCallActionItem.setOnClickListener(this);
    mReportActionItem = findViewById(R.id.call_detail_action_report);
    mReportActionItem.setOnClickListener(this);
    mCopyNumberActionItem = findViewById(R.id.call_detail_action_copy);
    mCopyNumberActionItem.setOnClickListener(this);
    if (getIntent().getBooleanExtra(EXTRA_FROM_NOTIFICATION, false)) {
        closeSystemDialogs();
    }
}
Also used : CallTypeHelper(com.android.dialer.calllog.CallTypeHelper) ContactsPreferences(com.android.contacts.common.preference.ContactsPreferences) ContactInfoHelper(com.android.dialer.calllog.ContactInfoHelper) CallIntentBuilder(com.android.dialer.util.IntentUtil.CallIntentBuilder) FilteredNumberAsyncQueryHandler(com.android.dialer.database.FilteredNumberAsyncQueryHandler) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 2 with ContactsPreferences

use of com.android.contacts.common.preference.ContactsPreferences in project android_packages_apps_Dialer by MoKee.

the class ContactsPreferencesFactoryTest method testNewContactsPreferences_TestInstance.

public void testNewContactsPreferences_TestInstance() {
    ContactsPreferences testInstance = Mockito.mock(ContactsPreferences.class);
    ContactsPreferencesFactory.setTestInstance(testInstance);
    // Assert that it returns the same object always
    assertSame(testInstance, ContactsPreferencesFactory.newContactsPreferences(getContext()));
    assertSame(testInstance, ContactsPreferencesFactory.newContactsPreferences(getContext()));
}
Also used : ContactsPreferences(com.android.contacts.common.preference.ContactsPreferences)

Example 3 with ContactsPreferences

use of com.android.contacts.common.preference.ContactsPreferences in project android_packages_apps_Dialer by LineageOS.

the class ContactEntryListFragment method onCreate.

@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    restoreSavedState(savedState);
    mAdapter = createListAdapter();
    mContactsPrefs = new ContactsPreferences(mContext);
}
Also used : ContactsPreferences(com.android.contacts.common.preference.ContactsPreferences)

Example 4 with ContactsPreferences

use of com.android.contacts.common.preference.ContactsPreferences in project android_packages_apps_Dialer by LineageOS.

the class ContactsFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    contactsPrefs = new ContactsPreferences(getContext());
    contactsPrefs.registerChangeListener(this);
}
Also used : ContactsPreferences(com.android.contacts.common.preference.ContactsPreferences)

Example 5 with ContactsPreferences

use of com.android.contacts.common.preference.ContactsPreferences in project packages_apps_Contacts by AOKP.

the class ContactDisplayUtils method getDisplayName.

/**
 * Returns the display name of the contact, using the current display order setting.
 * Returns res/string/missing_name if there is no display name.
 */
public static CharSequence getDisplayName(Context context, Contact contactData) {
    ContactsPreferences prefs = new ContactsPreferences(context);
    final CharSequence displayName = contactData.getDisplayName();
    if (prefs.getDisplayOrder() == ContactsPreferences.DISPLAY_ORDER_PRIMARY) {
        if (!TextUtils.isEmpty(displayName)) {
            if (contactData.getDisplayNameSource() == DisplayNameSources.PHONE) {
                return sBidiFormatter.unicodeWrap(displayName.toString(), TextDirectionHeuristics.LTR);
            }
            return displayName;
        }
    } else {
        final CharSequence altDisplayName = contactData.getAltDisplayName();
        if (!TextUtils.isEmpty(altDisplayName)) {
            return altDisplayName;
        }
    }
    return context.getResources().getString(R.string.missing_name);
}
Also used : ContactsPreferences(com.android.contacts.common.preference.ContactsPreferences)

Aggregations

ContactsPreferences (com.android.contacts.common.preference.ContactsPreferences)5 Intent (android.content.Intent)1 View (android.view.View)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 CallTypeHelper (com.android.dialer.calllog.CallTypeHelper)1 ContactInfoHelper (com.android.dialer.calllog.ContactInfoHelper)1 FilteredNumberAsyncQueryHandler (com.android.dialer.database.FilteredNumberAsyncQueryHandler)1 CallIntentBuilder (com.android.dialer.util.IntentUtil.CallIntentBuilder)1