diff options
Diffstat (limited to 'java/com/android/dialer/calllog/ui')
-rw-r--r-- | java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java | 17 | ||||
-rw-r--r-- | java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java | 16 |
2 files changed, 14 insertions, 19 deletions
diff --git a/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java b/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java index d89338350..13a801ac8 100644 --- a/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java +++ b/java/com/android/dialer/calllog/ui/CoalescedAnnotatedCallLogCursorLoader.java @@ -19,12 +19,8 @@ package com.android.dialer.calllog.ui; import android.content.Context; import android.database.Cursor; import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; import android.support.v4.content.CursorLoader; -import com.android.dialer.CallTypes; import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.CoalescedAnnotatedCallLog; -import com.android.dialer.common.Assert; -import com.google.protobuf.InvalidProtocolBufferException; /** CursorLoader for the coalesced annotated call log. */ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader { @@ -47,8 +43,8 @@ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader { private static final int FEATURES = 13; private static final int IS_BUSINESS = 14; private static final int IS_VOICEMAIL = 15; - private static final int NUMBER_CALLS = 16; - private static final int CALL_TYPES = 17; + private static final int TYPE = 16; + private static final int NUMBER_CALLS = 17; /** Convenience class for accessing values using an abbreviated syntax. */ static final class Row { @@ -127,13 +123,8 @@ final class CoalescedAnnotatedCallLogCursorLoader extends CursorLoader { return cursor.getInt(NUMBER_CALLS); } - @NonNull - CallTypes callTypes() { - try { - return CallTypes.parseFrom(cursor.getBlob(CALL_TYPES)); - } catch (InvalidProtocolBufferException e) { - throw Assert.createAssertionFailException("Couldn't parse call types", e); - } + int callType() { + return cursor.getInt(TYPE); } } diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index e198a38e8..8ac419e56 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -66,8 +66,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { primaryTextView.setText(buildPrimaryText(row)); secondaryTextView.setText(buildSecondaryText(row)); - if (row.isNew()) { - // TODO(zachh): Figure out correct styling for new/missed/unread calls. + if (isNewMissedCall(row)) { primaryTextView.setTextAppearance(R.style.primary_textview_new_call); // TODO(zachh): Styling for call type icons when the call is new. secondaryTextView.setTextAppearance(R.style.secondary_textview_new_call); @@ -95,6 +94,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { return primaryText.toString(); } + private boolean isNewMissedCall(CoalescedAnnotatedCallLogCursorLoader.Row row) { + // Show missed call styling if the most recent call in the group was missed and it is still + // marked as NEW. It is not clear what IS_READ should be used for and it is currently not used. + return row.callType() == Calls.MISSED_TYPE && row.isNew(); + } + private String buildSecondaryText(CoalescedAnnotatedCallLogCursorLoader.Row row) { /* * Rules: (Duo video, )?$Label|$Location • Date @@ -158,10 +163,9 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } private void setSecondaryCallTypes(Row row) { - // Only call type icons are shown before the secondary text. - for (int callType : row.callTypes().getTypeList()) { - secondaryCallTypeIconsView.add(callType); - } + // Only call type icon is shown before the secondary text. + secondaryCallTypeIconsView.add(row.callType()); + // TODO(zachh): Per new mocks, may need to add method to CallTypeIconsView to disable coloring. } |