From 4ceafab5f9a2d7bf599ed90d9e6cec9a383f088e Mon Sep 17 00:00:00 2001 From: erfanian Date: Tue, 2 Jan 2018 14:18:05 -0800 Subject: Add assisted dialing indicators to the old call log. Modify the call log grouping strategy. The strategy is as follows: When comparing the current group to the next candidate to add to that group, if the assisted dialing feature tag differs between the two, create a new group. Thus, if a call has other features like wifi or hd, we ignore those features when making grouping decisions. Bug: 70506228 Test: unit tests PiperOrigin-RevId: 180592125 Change-Id: I73d130bd9eb23706a04cb02f5711200729d978b6 --- .../dialer/calllogutils/CallTypeIconsView.java | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'java/com/android/dialer/calllogutils') diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index c7840c5ca..3d2b561f1 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -49,6 +49,7 @@ public class CallTypeIconsView extends View { private boolean showVideo; private boolean showHd; private boolean showWifi; + private boolean showAssistedDialed; private int width; private int height; @@ -132,6 +133,19 @@ public class CallTypeIconsView extends View { } } + public boolean isAssistedDialedShown() { + return showAssistedDialed; + } + + public void setShowAssistedDialed(boolean showAssistedDialed) { + this.showAssistedDialed = showAssistedDialed; + if (showAssistedDialed) { + width += resources.assistedDialedCall.getIntrinsicWidth() + resources.iconMargin; + height = Math.max(height, resources.assistedDialedCall.getIntrinsicHeight()); + invalidate(); + } + } + public int getCount() { return callTypes.size(); } @@ -174,7 +188,8 @@ public class CallTypeIconsView extends View { int left = 0; // If we are using large icons, we should only show one icon (video, hd or call type) with // priority give to HD or Video. So we skip the call type icon if we plan to show them. - if (!useLargeIcons || !(showHd || showVideo || showWifi)) { + + if (!useLargeIcons || !(showHd || showVideo || showWifi || showAssistedDialed)) { for (Integer callType : callTypes) { final Drawable drawable = getCallTypeDrawable(callType); final int right = left + drawable.getIntrinsicWidth(); @@ -196,6 +211,10 @@ public class CallTypeIconsView extends View { if (showWifi) { left = addDrawable(canvas, resources.wifiCall, left) + resources.iconMargin; } + // If showing assisted dial call icon, draw it scaled appropriately. + if (showAssistedDialed) { + left = addDrawable(canvas, resources.assistedDialedCall, left) + resources.iconMargin; + } } private int addDrawable(Canvas canvas, Drawable drawable, int left) { @@ -231,6 +250,9 @@ public class CallTypeIconsView extends View { // Drawable representing a WiFi call. final Drawable wifiCall; + // Drawable representing an assisted dialed call. + final Drawable assistedDialedCall; + /** The margin to use for icons. */ final int iconMargin; @@ -290,6 +312,12 @@ public class CallTypeIconsView extends View { wifiCall = drawable.mutate(); wifiCall.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + iconId = R.drawable.quantum_ic_language_white_24; + drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); + assistedDialedCall = drawable.mutate(); + assistedDialedCall.setColorFilter( + r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } -- cgit v1.2.3