summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java29
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java21
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemHelper.java10
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViews.java7
4 files changed, 26 insertions, 41 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index edd083117..ab599725e 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -75,8 +75,7 @@ public class PhoneCallDetailsHelper {
}
/** Fills the call details views with content. */
- public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details,
- boolean isHighlighted) {
+ public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details) {
// Display up to a given number of icons.
views.callTypeIcons.clear();
int count = details.callTypes.length;
@@ -93,14 +92,11 @@ public class PhoneCallDetailsHelper {
} else {
callCount = null;
}
- // The color to highlight the count and date in, if any. This is based on the first call.
- Integer highlightColor =
- isHighlighted ? mCallTypeHelper.getHighlightedColor(details.callTypes[0]) : null;
CharSequence callLocationAndDate = getCallLocationAndDate(details);
// Set the call count, location and date.
- setCallCountAndDate(views, callCount, callLocationAndDate, highlightColor);
+ setCallCountAndDate(views, callCount, callLocationAndDate);
final CharSequence nameText;
final CharSequence displayNumber =
@@ -224,7 +220,7 @@ public class PhoneCallDetailsHelper {
/** Sets the call count and date. */
private void setCallCountAndDate(PhoneCallDetailsViews views, Integer callCount,
- CharSequence dateText, Integer highlightColor) {
+ CharSequence dateText) {
// Combine the count (if present) and the date.
final CharSequence text;
if (callCount != null) {
@@ -234,23 +230,6 @@ public class PhoneCallDetailsHelper {
text = dateText;
}
- // Apply the highlight color if present.
- final CharSequence formattedText;
- if (highlightColor != null) {
- formattedText = addBoldAndColor(text, highlightColor);
- } else {
- formattedText = text;
- }
-
- views.callLocationAndDate.setText(formattedText);
- }
-
- /** Creates a SpannableString for the given text which is bold and in the given color. */
- private CharSequence addBoldAndColor(CharSequence text, int color) {
- int flags = Spanned.SPAN_INCLUSIVE_INCLUSIVE;
- SpannableString result = new SpannableString(text);
- result.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), flags);
- result.setSpan(new ForegroundColorSpan(color), 0, text.length(), flags);
- return result;
+ views.callLocationAndDate.setText(text);
}
}
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index a8cd72a39..44fad2225 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -28,7 +28,6 @@ import android.os.Message;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -42,7 +41,6 @@ import com.android.common.widget.GroupingListAdapter;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.util.UriUtils;
-import com.android.dialer.CallDetailActivity;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.R;
@@ -55,7 +53,6 @@ import com.google.common.base.Objects;
import java.util.HashMap;
import java.util.LinkedList;
-import java.util.Map;
/**
* Adapter class to fill in data for the Call Log.
@@ -686,10 +683,7 @@ public class CallLogAdapter extends GroupingListAdapter
duration, name, ntype, label, lookupUri, photoUri, sourceType);
}
- final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0;
- // New items also use the highlighted version of the text.
- final boolean isHighlighted = isNew;
- mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted);
+ mCallLogViewsHelper.setPhoneCallDetails(views, details);
int contactType = ContactPhotoManager.TYPE_DEFAULT;
@@ -1080,6 +1074,19 @@ public class CallLogAdapter extends GroupingListAdapter
false /* darkTheme */, true /* isCircular */, request);
}
+ /**
+ * Bind a call log entry view for testing purposes. Also inflates the action view stub so
+ * unit tests can access the buttons contained within.
+ *
+ * @param view The current call log row.
+ * @param context The current context.
+ * @param cursor The cursor to bind from.
+ */
+ @VisibleForTesting
+ void bindViewForTest(View view, Context context, Cursor cursor) {
+ bindStandAloneView(view, context, cursor);
+ inflateActionViewStub(view);
+ }
/**
* Sets whether processing of requests for contact details should be enabled.
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 81d1a2711..976726d28 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -17,15 +17,12 @@
package com.android.dialer.calllog;
import android.content.res.Resources;
-import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.text.TextUtils;
-import android.view.View;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.R;
-import com.android.internal.util.CharSequences;
/**
* Helper class to fill in the views of a call log entry.
@@ -56,12 +53,9 @@ import com.android.internal.util.CharSequences;
*
* @param views the views to populate
* @param details the details of a phone call needed to fill in the data
- * @param isHighlighted whether to use the highlight text for the call
*/
- public void setPhoneCallDetails(CallLogListItemViews views, PhoneCallDetails details,
- boolean isHighlighted) {
- mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details,
- isHighlighted);
+ public void setPhoneCallDetails(CallLogListItemViews views, PhoneCallDetails details) {
+ mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details);
// Set the accessibility text for the contact badge
views.quickContactView.setContentDescription(getContactBadgeDescription(details));
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index 879647f15..333769d7e 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -109,10 +109,15 @@ public final class CallLogListItemViews {
@NeededForTesting
public static CallLogListItemViews createForTest(Context context) {
- return new CallLogListItemViews(
+ CallLogListItemViews views = new CallLogListItemViews(
new QuickContactBadge(context),
new View(context),
PhoneCallDetailsViews.createForTest(context),
new TextView(context));
+ views.callBackButtonView = new TextView(context);
+ views.deleteButtonView = new TextView(context);
+ views.voicemailButtonView = new TextView(context);
+ views.actionsView = new View(context);
+ return views;
}
}