Search in sources :

Example 1 with DialerContact

use of com.android.dialer.dialercontact.DialerContact in project android_packages_apps_Dialer by LineageOS.

the class PhoneNumberPickerFragment method onCallAndShareIconClicked.

@Override
public void onCallAndShareIconClicked(int position) {
    // Required because of cyclic dependencies of everything depending on contacts/common.
    String componentName = "com.android.dialer.callcomposer.CallComposerActivity";
    Intent intent = new Intent();
    intent.setComponent(new ComponentName(getContext(), componentName));
    DialerContact contact = ((PhoneNumberListAdapter) getAdapter()).getDialerContact(position);
    ProtoParsers.put(intent, "CALL_COMPOSER_CONTACT", contact);
    startActivity(intent);
}
Also used : DialerContact(com.android.dialer.dialercontact.DialerContact) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Example 2 with DialerContact

use of com.android.dialer.dialercontact.DialerContact in project android_packages_apps_Dialer by LineageOS.

the class PhoneNumberListAdapter method getDialerContact.

public DialerContact getDialerContact(int position) {
    Cursor cursor = (Cursor) getItem(position);
    if (cursor == null) {
        LogUtil.e("PhoneNumberListAdapter.getDialerContact", "cursor was null.");
        return null;
    }
    String displayName = cursor.getString(PhoneQuery.DISPLAY_NAME);
    String number = cursor.getString(PhoneQuery.PHONE_NUMBER);
    String photoUri = cursor.getString(PhoneQuery.PHOTO_URI);
    Uri contactUri = Contacts.getLookupUri(cursor.getLong(PhoneQuery.CONTACT_ID), cursor.getString(PhoneQuery.LOOKUP_KEY));
    DialerContact.Builder contact = DialerContact.newBuilder();
    contact.setNumber(number).setPhotoId(cursor.getLong(PhoneQuery.PHOTO_ID)).setContactType(LetterTileDrawable.TYPE_DEFAULT).setNameOrNumber(displayName).setNumberLabel(Phone.getTypeLabel(mContext.getResources(), cursor.getInt(PhoneQuery.PHONE_TYPE), cursor.getString(PhoneQuery.PHONE_LABEL)).toString());
    if (photoUri != null) {
        contact.setPhotoUri(photoUri);
    }
    if (contactUri != null) {
        contact.setContactUri(contactUri.toString());
    }
    if (!TextUtils.isEmpty(displayName)) {
        contact.setDisplayNumber(number);
    }
    return contact.build();
}
Also used : DialerContact(com.android.dialer.dialercontact.DialerContact) Cursor(android.database.Cursor) Uri(android.net.Uri)

Aggregations

DialerContact (com.android.dialer.dialercontact.DialerContact)2 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1