use of com.android.dialer.calldetails.CallDetailsEntries in project android_packages_apps_Dialer by LineageOS.
the class CallLogAdapter method loadAndRender.
private void loadAndRender(final CallLogListItemViewHolder views, final long rowId, final PhoneCallDetails details, final CallDetailsEntries callDetailsEntries) {
LogUtil.d("CallLogAdapter.loadAndRender", "position: %d", views.getAdapterPosition());
// Reset block and spam information since this view could be reused which may contain
// outdated data.
views.isSpam = false;
views.blockId = null;
views.isSpamFeatureEnabled = false;
// Attempt to set the isCallComposerCapable field. If capabilities are unknown for this number,
// the value will be false while capabilities are requested. mExpandCollapseListener will
// attempt to set the field properly in that case
views.isCallComposerCapable = isCallComposerCapable(views.number);
CallDetailsEntries updatedCallDetailsEntries = generateAndMapNewCallDetailsEntriesHistoryResults(views.number, callDetailsEntries, getAllHistoricalData(views.number, callDetailsEntries));
views.setDetailedPhoneDetails(updatedCallDetailsEntries);
views.lightbringerReady = getLightbringer().isReachable(mActivity, views.number);
final AsyncTask<Void, Void, Boolean> loadDataTask = new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
views.blockId = mFilteredNumberAsyncQueryHandler.getBlockedIdSynchronous(views.number, views.countryIso);
details.isBlocked = views.blockId != null;
if (isCancelled()) {
return false;
}
if (mIsSpamEnabled) {
views.isSpamFeatureEnabled = true;
// Only display the call as a spam call if there are incoming calls in the list.
// Call log cards with only outgoing calls should never be displayed as spam.
views.isSpam = details.hasIncomingCalls() && Spam.get(mActivity).checkSpamStatusSynchronous(views.number, views.countryIso);
details.isSpam = views.isSpam;
}
return !isCancelled() && loadData(views, rowId, details);
}
@Override
protected void onPostExecute(Boolean success) {
views.isLoaded = true;
if (success) {
int currentGroup = getDayGroupForCall(views.rowId);
if (currentGroup != details.previousGroup) {
views.dayGroupHeaderVisibility = View.VISIBLE;
views.dayGroupHeaderText = getGroupDescription(currentGroup);
} else {
views.dayGroupHeaderVisibility = View.GONE;
}
render(views, details, rowId);
}
}
};
views.asyncTask = loadDataTask;
mAsyncTaskExecutor.submit(LOAD_DATA_TASK_IDENTIFIER, loadDataTask);
}
use of com.android.dialer.calldetails.CallDetailsEntries in project android_packages_apps_Dialer by LineageOS.
the class CallLogAdapter method generateAndMapNewCallDetailsEntriesHistoryResults.
private static CallDetailsEntries generateAndMapNewCallDetailsEntriesHistoryResults(@Nullable String number, @NonNull CallDetailsEntries callDetailsEntries, @NonNull Map<CallDetailsEntry, List<HistoryResult>> mappedResults) {
if (number == null) {
return callDetailsEntries;
}
CallDetailsEntries.Builder mutableCallDetailsEntries = CallDetailsEntries.newBuilder();
for (CallDetailsEntry entry : callDetailsEntries.getEntriesList()) {
CallDetailsEntry.Builder newEntry = CallDetailsEntry.newBuilder().mergeFrom(entry);
List<HistoryResult> results = mappedResults.get(entry);
if (results != null) {
newEntry.addAllHistoryResults(mappedResults.get(entry));
LogUtil.v("CallLogAdapter.generateAndMapNewCallDetailsEntriesHistoryResults", "mapped %d results", newEntry.getHistoryResultsList().size());
}
mutableCallDetailsEntries.addEntries(newEntry.build());
}
return mutableCallDetailsEntries.build();
}
use of com.android.dialer.calldetails.CallDetailsEntries 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);
}
Aggregations