Search in sources :

Example 11 with ContactCacheEntry

use of com.android.incallui.ContactInfoCache.ContactCacheEntry in project android_packages_apps_Dialer by MoKee.

the class ConferenceParticipantListAdapter method getView.

/**
 * Creates or populates an existing conference participant row.
 *
 * @param position The position of the item within the adapter's data set of the item whose view
 *        we want.
 * @param convertView The old view to reuse, if possible.
 * @param parent The parent that this view will eventually be attached to
 * @return The populated view.
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // Make sure we have a valid convertView to start with
    final View result = convertView == null ? mLayoutInflater.inflate(R.layout.caller_in_conference, parent, false) : convertView;
    ParticipantInfo participantInfo = mConferenceParticipants.get(position);
    Call call = participantInfo.getCall();
    ContactCacheEntry contactCache = participantInfo.getContactCacheEntry();
    final ContactInfoCache cache = ContactInfoCache.getInstance(mContext);
    // photo, do it now.
    if (!participantInfo.isCacheLookupComplete()) {
        cache.findInfo(participantInfo.getCall(), participantInfo.getCall().getState() == Call.State.INCOMING, new ContactLookupCallback(this));
    }
    boolean thisRowCanSeparate = mParentCanSeparate && call.getTelecomCall().getDetails().can(android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE);
    boolean thisRowCanDisconnect = call.getTelecomCall().getDetails().can(android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE);
    setCallerInfoForRow(result, contactCache.namePrimary, ContactDisplayUtils.getPreferredDisplayName(contactCache.namePrimary, contactCache.nameAlternative, mContactsPreferences), contactCache.number, contactCache.label, contactCache.lookupKey, contactCache.displayPhotoUri, thisRowCanSeparate, thisRowCanDisconnect, getResourceforState(call.getTrueState()));
    // Tag the row in the conference participant list with the call id to make it easier to
    // find calls when contact cache information is loaded.
    result.setTag(call.getId());
    return result;
}
Also used : ContactCacheEntry(com.android.incallui.ContactInfoCache.ContactCacheEntry) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Aggregations

ContactCacheEntry (com.android.incallui.ContactInfoCache.ContactCacheEntry)11 DialerCall (com.android.incallui.call.DialerCall)3 View (android.view.View)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 ContactInfoCacheCallback (com.android.incallui.ContactInfoCache.ContactInfoCacheCallback)2 Map (java.util.Map)2 RequiresPermission (android.support.annotation.RequiresPermission)1 ArrayMap (android.support.v4.util.ArrayMap)1 SpannableString (android.text.SpannableString)1 ArraySet (android.util.ArraySet)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1