Search in sources :

Example 1 with PhoneCallDetails

use of com.android.dialer.calllogutils.PhoneCallDetails in project android_packages_apps_Dialer by LineageOS.

the class CallLogAdapter method createPhoneCallDetails.

/**
 * Initialize PhoneCallDetails by reading all data from cursor. This method must be run on main
 * thread since cursor is not thread safe.
 */
@MainThread
private PhoneCallDetails createPhoneCallDetails(Cursor cursor, int count, final CallLogListItemViewHolder views) {
    Assert.isMainThread();
    final String number = cursor.getString(CallLogQuery.NUMBER);
    final String postDialDigits = (VERSION.SDK_INT >= VERSION_CODES.N) ? cursor.getString(CallLogQuery.POST_DIAL_DIGITS) : "";
    final String viaNumber = (VERSION.SDK_INT >= VERSION_CODES.N) ? cursor.getString(CallLogQuery.VIA_NUMBER) : "";
    final int numberPresentation = cursor.getInt(CallLogQuery.NUMBER_PRESENTATION);
    final ContactInfo cachedContactInfo = ContactInfoHelper.getContactInfo(cursor);
    final PhoneCallDetails details = new PhoneCallDetails(number, numberPresentation, postDialDigits);
    details.viaNumber = viaNumber;
    details.countryIso = cursor.getString(CallLogQuery.COUNTRY_ISO);
    details.date = cursor.getLong(CallLogQuery.DATE);
    details.duration = cursor.getLong(CallLogQuery.DURATION);
    details.features = getCallFeatures(cursor, count);
    details.geocode = cursor.getString(CallLogQuery.GEOCODED_LOCATION);
    details.transcription = cursor.getString(CallLogQuery.TRANSCRIPTION);
    details.callTypes = getCallTypes(cursor, count);
    details.accountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
    details.accountId = cursor.getString(CallLogQuery.ACCOUNT_ID);
    details.cachedContactInfo = cachedContactInfo;
    if (!cursor.isNull(CallLogQuery.DATA_USAGE)) {
        details.dataUsage = cursor.getLong(CallLogQuery.DATA_USAGE);
    }
    views.rowId = cursor.getLong(CallLogQuery.ID);
    // Stash away the Ids of the calls so that we can support deleting a row in the call log.
    views.callIds = getCallIds(cursor, count);
    details.previousGroup = getPreviousDayGroup(cursor);
    // Store values used when the actions ViewStub is inflated on expansion.
    views.number = number;
    views.countryIso = details.countryIso;
    views.postDialDigits = details.postDialDigits;
    views.numberPresentation = numberPresentation;
    if (details.callTypes[0] == CallLog.Calls.VOICEMAIL_TYPE || details.callTypes[0] == CallLog.Calls.MISSED_TYPE) {
        details.isRead = cursor.getInt(CallLogQuery.IS_READ) == 1;
    }
    views.callType = cursor.getInt(CallLogQuery.CALL_TYPE);
    views.voicemailUri = cursor.getString(CallLogQuery.VOICEMAIL_URI);
    return details;
}
Also used : PhoneCallDetails(com.android.dialer.calllogutils.PhoneCallDetails) ContactInfo(com.android.dialer.phonenumbercache.ContactInfo) MainThread(android.support.annotation.MainThread)

Example 2 with PhoneCallDetails

use of com.android.dialer.calllogutils.PhoneCallDetails in project android_packages_apps_Dialer by LineageOS.

the class CallLogAdapter method bindCallLogListViewHolder.

/**
 * Binds the view holder for the call log list item view.
 *
 * @param viewHolder The call log list item view holder.
 * @param position The position of the list item.
 */
private void bindCallLogListViewHolder(final ViewHolder viewHolder, final int position) {
    Cursor c = (Cursor) getItem(position);
    if (c == null) {
        return;
    }
    CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
    updateCheckMarkedStatusOfEntry(views);
    views.isLoaded = false;
    int groupSize = getGroupSize(position);
    CallDetailsEntries callDetailsEntries = createCallDetailsEntries(c, groupSize);
    PhoneCallDetails details = createPhoneCallDetails(c, groupSize, views);
    if (mHiddenRowIds.contains(c.getLong(CallLogQuery.ID))) {
        views.callLogEntryView.setVisibility(View.GONE);
        views.dayGroupHeader.setVisibility(View.GONE);
        return;
    } else {
        views.callLogEntryView.setVisibility(View.VISIBLE);
    // dayGroupHeader will be restored after loadAndRender() if it is needed.
    }
    if (mCurrentlyExpandedRowId == views.rowId) {
        views.inflateActionViewStub();
    }
    loadAndRender(views, views.rowId, details, callDetailsEntries);
}
Also used : CallDetailsEntries(com.android.dialer.calldetails.CallDetailsEntries) PhoneCallDetails(com.android.dialer.calllogutils.PhoneCallDetails) Cursor(android.database.Cursor)

Aggregations

PhoneCallDetails (com.android.dialer.calllogutils.PhoneCallDetails)2 Cursor (android.database.Cursor)1 MainThread (android.support.annotation.MainThread)1 CallDetailsEntries (com.android.dialer.calldetails.CallDetailsEntries)1 ContactInfo (com.android.dialer.phonenumbercache.ContactInfo)1