From 30ccc4f3aa6da94f0bb8a01a880a6353b883b263 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 20 Mar 2017 20:40:36 +0000 Subject: Revert "Update AOSP Dialer source from internal google3 repository at cl/150622237" This reverts commit 06b6b56e9eaa91ebf757ea641e38a9c885fa40bd. Change-Id: Ida8c5ee67669524dc63b9adc60a6dd392cb9b9a6 --- .../calldetails/CallDetailsEntryViewHolder.java | 51 ++++++++++++++-------- .../calldetails/res/layout/call_details_entry.xml | 30 ++++--------- .../dialer/calldetails/res/values/dimens.xml | 4 +- 3 files changed, 43 insertions(+), 42 deletions(-) (limited to 'java/com/android/dialer/calldetails') diff --git a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java index 55447f8ff..b1a70af0c 100644 --- a/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsEntryViewHolder.java @@ -17,6 +17,9 @@ package com.android.dialer.calldetails; import android.content.Context; +import android.content.res.Resources; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.CallLog.Calls; import android.support.annotation.ColorInt; @@ -30,12 +33,10 @@ import android.widget.TextView; import com.android.dialer.calldetails.nano.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.oem.MotorolaUtils; import com.android.dialer.util.CallUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; @@ -43,7 +44,7 @@ import com.android.dialer.util.IntentUtil; /** ViewHolder for call entries in {@link CallDetailsActivity}. */ public class CallDetailsEntryViewHolder extends ViewHolder { - private final CallTypeIconsView callTypeIcon; + private final ImageView callTypeIcon; private final TextView callTypeText; private final TextView callTime; private final TextView callDuration; @@ -53,7 +54,6 @@ public class CallDetailsEntryViewHolder extends ViewHolder { private final View multimediaDivider; private final TextView multimediaDetails; - private final TextView postCallNote; private final ImageView multimediaImage; @@ -67,7 +67,7 @@ public class CallDetailsEntryViewHolder extends ViewHolder { super(container); context = container.getContext(); - callTypeIcon = (CallTypeIconsView) container.findViewById(R.id.call_direction); + callTypeIcon = (ImageView) container.findViewById(R.id.call_direction); callTypeText = (TextView) container.findViewById(R.id.call_type); callTime = (TextView) container.findViewById(R.id.call_time); callDuration = (TextView) container.findViewById(R.id.call_duration); @@ -76,7 +76,6 @@ public class CallDetailsEntryViewHolder extends ViewHolder { multimediaDetailsContainer = container.findViewById(R.id.ec_container); multimediaDivider = container.findViewById(R.id.divider); multimediaDetails = (TextView) container.findViewById(R.id.multimedia_details); - postCallNote = (TextView) container.findViewById(R.id.post_call_note); multimediaImage = (ImageView) container.findViewById(R.id.multimedia_image); multimediaAttachmentsNumber = (TextView) container.findViewById(R.id.multimedia_attachments_number); @@ -94,10 +93,11 @@ public class CallDetailsEntryViewHolder extends ViewHolder { boolean isPulledCall = (entry.features & Calls.FEATURES_PULLED_EXTERNALLY) == Calls.FEATURES_PULLED_EXTERNALLY; - callTime.setTextColor(getColorForCallType(context, callType)); - callTypeIcon.add(callType); - callTypeIcon.setShowVideo((entry.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO); - callTypeIcon.setShowHd(MotorolaUtils.shouldShowHdIconInCallLog(context, entry.features)); + Drawable callIcon = getIconForCallType(context.getResources(), callType); + int color = getColorForCallType(context, callType); + callIcon.setColorFilter(color, PorterDuff.Mode.MULTIPLY); + callTime.setTextColor(color); + callTypeIcon.setImageDrawable(callIcon); callTypeText.setText(callTypeHelper.getCallTypeText(callType, isVideoCall, isPulledCall)); callTime.setText(CallEntryFormatter.formatDate(context, entry.date)); @@ -118,6 +118,8 @@ public class CallDetailsEntryViewHolder extends ViewHolder { multimediaDetailsContainer.setVisibility(View.GONE); } else { + // TODO: b/36158891 Add room for 2 pieces of enriched call data. It's possible + // to have both call composer data and post call data for a single call. HistoryResult historyResult = entry.historyResults[0]; multimediaDetailsContainer.setVisibility(View.VISIBLE); multimediaDetailsContainer.setOnClickListener( @@ -144,15 +146,6 @@ public class CallDetailsEntryViewHolder extends ViewHolder { } else { LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no text"); } - - if (entry.historyResults.length > 1 && !TextUtils.isEmpty(entry.historyResults[1].text)) { - 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)); - } else { - LogUtil.i("CallDetailsEntryViewHolder.setMultimediaDetails", "no post call note"); - } } } @@ -161,6 +154,26 @@ public class CallDetailsEntryViewHolder extends ViewHolder { || historyResult.type == Type.INCOMING_CALL_COMPOSER; } + private static Drawable getIconForCallType(Resources resources, int callType) { + switch (callType) { + case AppCompatConstants.CALLS_OUTGOING_TYPE: + return resources.getDrawable(R.drawable.quantum_ic_call_made_white_24); + case AppCompatConstants.CALLS_BLOCKED_TYPE: + return resources.getDrawable(R.drawable.quantum_ic_block_white_24); + case AppCompatConstants.CALLS_INCOMING_TYPE: + case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + case AppCompatConstants.CALLS_REJECTED_TYPE: + return resources.getDrawable(R.drawable.quantum_ic_call_received_white_24); + case AppCompatConstants.CALLS_MISSED_TYPE: + default: + // It is possible for users to end up with calls with unknown call types in their + // call history, possibly due to 3rd party call log implementations (e.g. to + // distinguish between rejected and missed calls). Instead of crashing, just + // assume that all unknown call types are missed calls. + return resources.getDrawable(R.drawable.quantum_ic_call_missed_white_24); + } + } + private static @ColorInt int getColorForCallType(Context context, int callType) { switch (callType) { case AppCompatConstants.CALLS_OUTGOING_TYPE: diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml index 3f2ba7534..7f8bb8087 100644 --- a/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml +++ b/java/com/android/dialer/calldetails/res/layout/call_details_entry.xml @@ -16,30 +16,29 @@ --> - + android:layout_marginEnd="@dimen/call_entry_left_margin"/> @@ -57,29 +56,18 @@ android:id="@+id/ec_container" android:layout_height="@dimen/ec_container_height" android:layout_width="match_parent" - android:layout_marginStart="@dimen/call_entry_text_left_margin" + android:layout_marginStart="@dimen/ec_text_left_margin" android:layout_below="@+id/call_time" android:visibility="gone"/> - - \ No newline at end of file diff --git a/java/com/android/dialer/calldetails/res/values/dimens.xml b/java/com/android/dialer/calldetails/res/values/dimens.xml index 2ca7ea83a..59f237103 100644 --- a/java/com/android/dialer/calldetails/res/values/dimens.xml +++ b/java/com/android/dialer/calldetails/res/values/dimens.xml @@ -29,12 +29,12 @@ 24dp 16dp 14dp - 72dp + 32dp 12sp 48dp - 73dp + 72dp 40dp 8dp \ No newline at end of file -- cgit v1.2.3