Search in sources :

Example 1 with HistoryResult

use of com.android.dialer.enrichedcall.historyquery.proto.HistoryResult in project android_packages_apps_Dialer by LineageOS.

the class CallDetailsEntryViewHolder method setMultimediaDetails.

private void setMultimediaDetails(String number, CallDetailsEntry entry, boolean showDivider) {
    multimediaDivider.setVisibility(showDivider ? View.VISIBLE : View.GONE);
    if (entry.getHistoryResultsList().isEmpty()) {
        LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no data, hiding UI");
        multimediaDetailsContainer.setVisibility(View.GONE);
    } else {
        HistoryResult historyResult = entry.getHistoryResults(0);
        multimediaDetailsContainer.setVisibility(View.VISIBLE);
        multimediaDetailsContainer.setOnClickListener((v) -> startSmsIntent(context, number));
        multimediaImageContainer.setClipToOutline(true);
        if (!TextUtils.isEmpty(historyResult.getImageUri())) {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "setting image");
            multimediaImageContainer.setVisibility(View.VISIBLE);
            multimediaImage.setImageURI(Uri.parse(historyResult.getImageUri()));
            multimediaDetails.setText(isIncoming(historyResult) ? R.string.received_a_photo : R.string.sent_a_photo);
        } else {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no image");
        }
        // Set text after image to overwrite the received/sent a photo text
        if (!TextUtils.isEmpty(historyResult.getText())) {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "showing text");
            multimediaDetails.setText(context.getString(R.string.message_in_quotes, historyResult.getText()));
        } else {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no text");
        }
        if (entry.getHistoryResultsList().size() > 1 && !TextUtils.isEmpty(entry.getHistoryResults(1).getText())) {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "showing post call note");
            postCallNote.setVisibility(View.VISIBLE);
            postCallNote.setText(context.getString(R.string.message_in_quotes, entry.getHistoryResults(1).getText()));
            postCallNote.setOnClickListener((v) -> startSmsIntent(context, number));
        } else {
            LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no post call note");
        }
    }
}
Also used : HistoryResult(com.android.dialer.enrichedcall.historyquery.proto.HistoryResult)

Example 2 with HistoryResult

use of com.android.dialer.enrichedcall.historyquery.proto.HistoryResult 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();
}
Also used : HistoryResult(com.android.dialer.enrichedcall.historyquery.proto.HistoryResult) CallDetailsEntries(com.android.dialer.calldetails.CallDetailsEntries) CallDetailsEntry(com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry)

Aggregations

HistoryResult (com.android.dialer.enrichedcall.historyquery.proto.HistoryResult)2 CallDetailsEntries (com.android.dialer.calldetails.CallDetailsEntries)1 CallDetailsEntry (com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry)1