diff options
author | zachh <zachh@google.com> | 2017-10-03 17:27:01 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-04 08:18:36 -0700 |
commit | 5ee0b1e574ed93c7000e355e4a6b03fb9ed8aaba (patch) | |
tree | ade09fe638ed0dc2bf65bd64fa6d68a4e51a0b82 /java/com/android/dialer/calllog/ui | |
parent | 01a964d7fbba63c670062ffca9a0ebe30cdcb1ff (diff) |
Only show the most recent call type icon in the new call log, instead of the last 3.
This is according to the latest PRD:
https://docs.google.com/document/d/1FLoQ6kNYL-QKplbniJAIUCHku87S9eYuYPs6IXe-U78
Also cleaned up warnings in CallLogQueryHandler.
Screenshot: https://screenshot.googleplex.com/Z7p4BRVpLpE
Bug: 34672501
Test: unit
PiperOrigin-RevId: 170941445
Change-Id: Ibf79b70eda3837ea46d365729aaed0a87961e42b
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. } |