diff options
author | uabdullah <uabdullah@google.com> | 2017-12-21 16:28:55 -0800 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-12-22 08:57:54 -0800 |
commit | 6aa961b5fa429ad64a9c0bf02d3a1673950ef743 (patch) | |
tree | 7c595cded5f0ff9622849bab219c19e6d63318d1 /java | |
parent | 126c0e599ea98b639549d91ff99bc4e780d769b5 (diff) |
Differentiate read/unread voicemails in the NUI Voicemail by bolding.
Voicemails that are unread in the annotated call log table will show up as bold. Voicemails that are marked as read will show up as normal (non bold). A follow up CL will update the underlying table and mark them as read when a viewholder is expanded.
Bug: 64882313,70900195
Test: Unit Tests
PiperOrigin-RevId: 179872932
Change-Id: I927711aa8c6c6324e43f519c14a58b5f2b8e7ca9
Diffstat (limited to 'java')
3 files changed, 32 insertions, 2 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java index 24bed0f04..dac4ebafc 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java @@ -21,6 +21,7 @@ import static android.view.View.VISIBLE; import android.app.FragmentManager; import android.content.Context; import android.database.Cursor; +import android.graphics.Typeface; import android.net.Uri; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; @@ -124,6 +125,9 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On transcriptionTextView.setText(voicemailTranscription); } + // Bold if voicemail is unread + boldViewHolderIfUnread(); + itemView.setOnClickListener(this); menuButton.setOnClickListener( NewVoicemailMenu.createOnClickListener(context, voicemailEntryOfViewHolder)); @@ -173,6 +177,20 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On mediaPlayerView.getVisibility() == VISIBLE); } + private void boldViewHolderIfUnread() { + LogUtil.v( + "NewVoicemailViewHolder.boldViewHolderIfUnread", + "id:%d, isRead:%d", + voicemailEntryOfViewHolder.id(), + voicemailEntryOfViewHolder.isRead()); + + if (voicemailEntryOfViewHolder.isRead() == 0) { + primaryTextView.setTypeface(null, Typeface.BOLD); + secondaryTextView.setTypeface(null, Typeface.BOLD); + transcriptionTextView.setTypeface(null, Typeface.BOLD); + } + } + // TODO(uabdullah): Consider/Implement TYPE (e.g Spam, TYPE_VOICEMAIL) private void setPhoto(VoicemailEntry voicemailEntry) { ContactPhotoManager.getInstance(context) @@ -214,6 +232,10 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On isViewHolderExpanded = false; viewHolderVoicemailUri = null; + primaryTextView.setTypeface(null, Typeface.NORMAL); + secondaryTextView.setTypeface(null, Typeface.NORMAL); + transcriptionTextView.setTypeface(null, Typeface.NORMAL); + mediaPlayerView.reset(); LogUtil.i( diff --git a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java index 6a55483a4..55d36b364 100644 --- a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java +++ b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java @@ -43,7 +43,8 @@ final class VoicemailCursorLoader extends CursorLoader { AnnotatedCallLog.GEOCODED_LOCATION, AnnotatedCallLog.CALL_TYPE, AnnotatedCallLog.TRANSCRIPTION, - AnnotatedCallLog.VOICEMAIL_URI + AnnotatedCallLog.VOICEMAIL_URI, + AnnotatedCallLog.IS_READ }; // Indexes for VOICEMAIL_COLUMNS @@ -60,6 +61,7 @@ final class VoicemailCursorLoader extends CursorLoader { private static final int CALL_TYPE = 10; private static final int TRANSCRIPTION = 11; private static final int VOICEMAIL_URI = 12; + private static final int IS_READ = 13; // TODO(zachh): Optimize indexes VoicemailCursorLoader(Context context) { @@ -95,6 +97,7 @@ final class VoicemailCursorLoader extends CursorLoader { .setVoicemailUri(cursor.getString(VOICEMAIL_URI)) .setGeocodedLocation(cursor.getString(GEOCODED_LOCATION)) .setCallType(cursor.getInt(CALL_TYPE)) + .setIsRead(cursor.getInt(IS_READ)) .build(); } diff --git a/java/com/android/dialer/voicemail/model/VoicemailEntry.java b/java/com/android/dialer/voicemail/model/VoicemailEntry.java index df30dee9c..702f52d17 100644 --- a/java/com/android/dialer/voicemail/model/VoicemailEntry.java +++ b/java/com/android/dialer/voicemail/model/VoicemailEntry.java @@ -32,7 +32,8 @@ public abstract class VoicemailEntry { .setNumber(DialerPhoneNumber.getDefaultInstance()) .setPhotoId(0) .setDuration(0) - .setCallType(0); + .setCallType(0) + .setIsRead(0); } public abstract int id(); @@ -69,6 +70,8 @@ public abstract class VoicemailEntry { public abstract int callType(); + public abstract int isRead(); + /** Builder for {@link VoicemailEntry}. */ @AutoValue.Builder public abstract static class Builder { @@ -99,6 +102,8 @@ public abstract class VoicemailEntry { public abstract Builder setCallType(int callType); + public abstract Builder setIsRead(int isRead); + public abstract VoicemailEntry build(); } } |