diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-22 18:44:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-22 18:44:31 +0000 |
commit | 88518503c1351ba86f503ebd8742d6b292928ddd (patch) | |
tree | 97c6b6429cd3a0276ece3bba0ce022e4c6b92866 /java/com/android/dialer/voicemail | |
parent | e2da6ef8a56bd9f7eedfa1c6d89e968590e0c09b (diff) | |
parent | 1e8275f3e6f57f285900ce35946064e0550b174a (diff) |
Merge changes I66342431,I5e579f11,I927711aa,Idd4cc115,If8cdbdfa, ...
* changes:
Automated rollback of changelist 179615699
Automated rollback of changelist 179847039
Differentiate read/unread voicemails in the NUI Voicemail by bolding.
Use CHAR_TO_KEY_MAPS in DialpadCharMappings in SmartDialMaps.
Reorganize classes related to smart dial.
Use the orientation obtained in onFinishInflate as the truth in DialpadView.
Added context menu for favorite contacts in new speed dial.
Update assisted dialing extras in preparation for platform implementation.
Quick fix for bugs on simulator voice call.
Fixed crash in UiListener when launching activity with screen off.
Handle contacts which have been disassociated with a number in Cp2PhoneLookup.
Fixed crash in PinnedShortcuts.
Bug: 70402588
Added copySubMessage method to PhoneLookup interface.
Bubble v2 changes.
Always have hardware acceration enabled for InCallActivity
Include inserted calls for consideration in PhoneLookupDataSource.
Don't use phone number in spam call notifications
Register content observer when voicemail table changes.
Add SmartDialMaps for the Bulgarian alphabet and the Ukrainian alphabet.
Remove voicemail from UI only after delete request.
Bubble v2 RTL language fixes.
Implemented SpeedDialEntry Room Database.
Diffstat (limited to 'java/com/android/dialer/voicemail')
4 files changed, 51 insertions, 6 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java index 315bf1cf0..93d5cda3e 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java @@ -67,9 +67,9 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> private final Clock clock; /** {@link Integer#MAX_VALUE} when the "Today" header should not be displayed. */ - private final int todayHeaderPosition; + private int todayHeaderPosition = Integer.MAX_VALUE; /** {@link Integer#MAX_VALUE} when the "Older" header should not be displayed. */ - private final int olderHeaderPosition; + private int olderHeaderPosition = Integer.MAX_VALUE; private final FragmentManager fragmentManager; /** A valid id for {@link VoicemailEntry} is greater than 0 */ @@ -107,7 +107,15 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> this.clock = clock; this.fragmentManager = fragmentManager; initializeMediaPlayerListeners(); + updateHeaderPositions(); + } + private void updateHeaderPositions() { + LogUtil.i( + "NewVoicemailAdapter.updateHeaderPositions", + "before updating todayPos:%d, olderPos:%d", + todayHeaderPosition, + olderHeaderPosition); // Calculate header adapter positions by reading cursor. long currentTimeMillis = clock.currentTimeMillis(); if (cursor.moveToNext()) { @@ -134,6 +142,11 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> this.todayHeaderPosition = Integer.MAX_VALUE; this.olderHeaderPosition = Integer.MAX_VALUE; } + LogUtil.i( + "NewVoicemailAdapter.updateHeaderPositions", + "after updating todayPos:%d, olderPos:%d", + todayHeaderPosition, + olderHeaderPosition); } private void initializeMediaPlayerListeners() { @@ -143,8 +156,10 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> } public void updateCursor(Cursor updatedCursor) { + LogUtil.enterBlock("NewVoicemailAdapter.updateCursor"); deletedVoicemailPosition.clear(); this.cursor = updatedCursor; + updateHeaderPositions(); notifyDataSetChanged(); } @@ -509,8 +524,6 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> Assert.checkArgument(expandedViewHolder.getViewHolderVoicemailUri().equals(voicemailUri)); - notifyItemRemoved(expandedViewHolder.getAdapterPosition()); - Assert.checkArgument(currentlyExpandedViewHolderId == expandedViewHolder.getViewHolderId()); collapseExpandedViewHolder(expandedViewHolder); @@ -524,6 +537,8 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> .onSuccess(deleteVoicemailCallBack) .build() .executeSerial(new Pair<>(context, voicemailUri)); + + notifyItemRemoved(expandedViewHolder.getAdapterPosition()); } private void onVoicemailDeleted(Integer integer) { 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(); } } |