From 8369df095a73a77b3715f8ae7ba06089cebca4ce Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Wed, 3 May 2017 10:27:13 -0700 Subject: This change reflects the Dialer V10 RC00 branch. RC00 is based on: branch: dialer-android_release_branch/153304843.1 synced to: 153304843 following the instructions at go/dialer-aosp-release. In this release: * Removes final apache sources. * Uses native lite compilation. More drops will follow with subsequent release candidates until we reach our final v10 release, in cadence with our prebuilt drops. Test: TreeHugger, on device Change-Id: Ic9684057230f9b579c777820c746cd21bf45ec0f --- .../calldetails/CallDetailsEntryViewHolder.java | 49 ++++++++++++---------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java') diff --git a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java index a8958d911..156fa4255 100644 --- a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java @@ -27,14 +27,14 @@ import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.TextView; -import com.android.dialer.calldetails.nano.CallDetailsEntries.CallDetailsEntry; +import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry; import com.android.dialer.calllogutils.CallEntryFormatter; import com.android.dialer.calllogutils.CallTypeHelper; import com.android.dialer.calllogutils.CallTypeIconsView; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.AppCompatConstants; -import com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult; -import com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type; +import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult; +import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult.Type; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.util.CallUtil; import com.android.dialer.util.DialerUtils; @@ -87,40 +87,46 @@ public class CallDetailsEntryViewHolder extends ViewHolder { CallDetailsEntry entry, CallTypeHelper callTypeHelper, boolean showMultimediaDivider) { - int callType = entry.callType; + int callType = entry.getCallType(); boolean isVideoCall = - (entry.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO + (entry.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO && CallUtil.isVideoEnabled(context); boolean isPulledCall = - (entry.features & Calls.FEATURES_PULLED_EXTERNALLY) == Calls.FEATURES_PULLED_EXTERNALLY; + (entry.getFeatures() & Calls.FEATURES_PULLED_EXTERNALLY) + == Calls.FEATURES_PULLED_EXTERNALLY; callTime.setTextColor(getColorForCallType(context, callType)); callTypeIcon.clear(); callTypeIcon.add(callType); - callTypeIcon.setShowVideo((entry.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO); - callTypeIcon.setShowHd(MotorolaUtils.shouldShowHdIconInCallLog(context, entry.features)); - callTypeIcon.setShowWifi(MotorolaUtils.shouldShowWifiIconInCallLog(context, entry.features)); + callTypeIcon.setShowVideo((entry.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO); + callTypeIcon.setShowHd(MotorolaUtils.shouldShowHdIconInCallLog(context, entry.getFeatures())); + callTypeIcon.setShowWifi( + MotorolaUtils.shouldShowWifiIconInCallLog(context, entry.getFeatures())); callTypeText.setText(callTypeHelper.getCallTypeText(callType, isVideoCall, isPulledCall)); - callTime.setText(CallEntryFormatter.formatDate(context, entry.date)); + callTime.setText(CallEntryFormatter.formatDate(context, entry.getDate())); if (CallTypeHelper.isMissedCallType(callType)) { callDuration.setVisibility(View.GONE); } else { callDuration.setVisibility(View.VISIBLE); callDuration.setText( - CallEntryFormatter.formatDurationAndDataUsage(context, entry.duration, entry.dataUsage)); + CallEntryFormatter.formatDurationAndDataUsage( + context, entry.getDuration(), entry.getDataUsage(), false /* a11y */)); + callDuration.setContentDescription( + CallEntryFormatter.formatDurationAndDataUsage( + context, entry.getDuration(), entry.getDataUsage(), true /* a11y */)); } setMultimediaDetails(number, entry, showMultimediaDivider); } private void setMultimediaDetails(String number, CallDetailsEntry entry, boolean showDivider) { multimediaDivider.setVisibility(showDivider ? View.VISIBLE : View.GONE); - if (entry.historyResults == null || entry.historyResults.length <= 0) { + if (entry.getHistoryResultsList().isEmpty()) { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no data, hiding UI"); multimediaDetailsContainer.setVisibility(View.GONE); } else { - HistoryResult historyResult = entry.historyResults[0]; + HistoryResult historyResult = entry.getHistoryResults(0); multimediaDetailsContainer.setVisibility(View.VISIBLE); multimediaDetailsContainer.setOnClickListener( (v) -> { @@ -128,10 +134,10 @@ public class CallDetailsEntryViewHolder extends ViewHolder { }); multimediaImageContainer.setClipToOutline(true); - if (!TextUtils.isEmpty(historyResult.imageUri)) { + if (!TextUtils.isEmpty(historyResult.getImageUri())) { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "setting image"); multimediaImageContainer.setVisibility(View.VISIBLE); - multimediaImage.setImageURI(Uri.parse(historyResult.imageUri)); + multimediaImage.setImageURI(Uri.parse(historyResult.getImageUri())); multimediaDetails.setText( isIncoming(historyResult) ? R.string.received_a_photo : R.string.sent_a_photo); } else { @@ -139,19 +145,20 @@ public class CallDetailsEntryViewHolder extends ViewHolder { } // Set text after image to overwrite the received/sent a photo text - if (!TextUtils.isEmpty(historyResult.text)) { + if (!TextUtils.isEmpty(historyResult.getText())) { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "showing text"); multimediaDetails.setText( - context.getString(R.string.message_in_quotes, historyResult.text)); + context.getString(R.string.message_in_quotes, historyResult.getText())); } else { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no text"); } - if (entry.historyResults.length > 1 && !TextUtils.isEmpty(entry.historyResults[1].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.historyResults[1].text)); + context.getString(R.string.message_in_quotes, entry.getHistoryResults(1).getText())); } else { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no post call note"); } @@ -159,8 +166,8 @@ public class CallDetailsEntryViewHolder extends ViewHolder { } private static boolean isIncoming(@NonNull HistoryResult historyResult) { - return historyResult.type == Type.INCOMING_POST_CALL - || historyResult.type == Type.INCOMING_CALL_COMPOSER; + return historyResult.getType() == Type.INCOMING_POST_CALL + || historyResult.getType() == Type.INCOMING_CALL_COMPOSER; } private static @ColorInt int getColorForCallType(Context context, int callType) { -- cgit v1.2.3