Loading java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java +3 −3 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> private final FragmentManager fragmentManager; /** A valid id for {@link VoicemailEntry} is greater than 0 */ private int currentlyExpandedViewHolderId = -1; private long currentlyExpandedViewHolderId = -1; private VoicemailErrorMessage voicemailErrorMessage; Loading @@ -114,7 +114,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> * will always ensure there is only (up-to-date) view holder corresponding to a view holder id, * unlike the newVoicemailViewHolderSet. */ private final ArrayMap<Integer, NewVoicemailViewHolder> newVoicemailViewHolderArrayMap = private final ArrayMap<Long, NewVoicemailViewHolder> newVoicemailViewHolderArrayMap = new ArrayMap<>(); // A single instance of a media player re-used across the expanded view holders. Loading Loading @@ -440,7 +440,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> if (!newVoicemailViewHolderArrayMap.isEmpty()) { String ids = ""; for (int id : newVoicemailViewHolderArrayMap.keySet()) { for (long id : newVoicemailViewHolderArrayMap.keySet()) { ids = ids + id + " "; } LogUtil.i("NewVoicemailAdapter.printArrayMap", "ids are " + ids); Loading java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java +4 −4 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { NewVoicemailViewHolderListener listener) { Assert.isNotNull(voicemailEntryFromAdapter); Uri uri = Uri.parse(voicemailEntryFromAdapter.voicemailUri()); Uri uri = Uri.parse(voicemailEntryFromAdapter.getVoicemailUri()); numberVoicemailFrom = voicemailEntryFromAdapter.number().getNormalizedNumber(); phoneAccountId = voicemailEntryFromAdapter.phoneAccountId(); phoneAccountComponentName = voicemailEntryFromAdapter.phoneAccountComponentName(); numberVoicemailFrom = voicemailEntryFromAdapter.getNumber().getNormalizedNumber(); phoneAccountId = voicemailEntryFromAdapter.getPhoneAccountId(); phoneAccountComponentName = voicemailEntryFromAdapter.getPhoneAccountComponentName(); Assert.isNotNull(viewHolder); Assert.isNotNull(uri); Loading java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +21 −24 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.time.Clock; import com.android.dialer.voicemail.listui.menu.NewVoicemailMenu; import com.android.dialer.voicemail.model.VoicemailEntry; Loading @@ -64,7 +63,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On private final ImageView menuButton; private final Clock clock; private boolean isViewHolderExpanded; private int viewHolderId; private long viewHolderId; private VoicemailEntry voicemailEntryOfViewHolder; @NonNull private Uri viewHolderVoicemailUri; private final NewVoicemailViewHolderListener voicemailViewHolderListener; Loading Loading @@ -117,7 +116,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On FragmentManager fragmentManager, NewVoicemailMediaPlayer mediaPlayer, int position, int currentlyExpandedViewHolderId) { long currentlyExpandedViewHolderId) { LogUtil.i( "NewVoicemailViewHolder.bindViewHolderValuesFromAdapter", Loading @@ -128,16 +127,16 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On cursor.getCount()); voicemailEntryOfViewHolder = VoicemailCursorLoader.toVoicemailEntry(cursor); viewHolderId = voicemailEntryOfViewHolder.id(); viewHolderId = voicemailEntryOfViewHolder.getId(); LogUtil.i( "NewVoicemailViewHolder.bindViewHolderValuesFromAdapter", "viewholderId:%d", viewHolderId); viewHolderVoicemailUri = Uri.parse(voicemailEntryOfViewHolder.voicemailUri()); viewHolderVoicemailUri = Uri.parse(voicemailEntryOfViewHolder.getVoicemailUri()); primaryTextView.setText( VoicemailEntryText.buildPrimaryVoicemailText(context, voicemailEntryOfViewHolder)); secondaryTextView.setText( VoicemailEntryText.buildSecondaryVoicemailText(context, clock, voicemailEntryOfViewHolder)); String voicemailTranscription = voicemailEntryOfViewHolder.transcription(); String voicemailTranscription = voicemailEntryOfViewHolder.getTranscription(); if (TextUtils.isEmpty(voicemailTranscription)) { transcriptionTextView.setVisibility(GONE); Loading Loading @@ -204,10 +203,10 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On LogUtil.v( "NewVoicemailViewHolder.boldViewHolderIfUnread", "id:%d, isRead:%d", voicemailEntryOfViewHolder.id(), voicemailEntryOfViewHolder.isRead()); voicemailEntryOfViewHolder.getId(), voicemailEntryOfViewHolder.getIsRead()); if (voicemailEntryOfViewHolder.isRead() == 0) { if (voicemailEntryOfViewHolder.getIsRead() == 0) { primaryTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); secondaryTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); transcriptionTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); Loading @@ -215,13 +214,11 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On } private void setPhoto(VoicemailEntry voicemailEntry) { PhotoInfo.Builder photoInfoBuilder = NumberAttributesConverter.toPhotoInfoBuilder(voicemailEntry.numberAttributes()); if (!TextUtils.isEmpty(voicemailEntry.formattedNumber())) { photoInfoBuilder.setFormattedNumber(voicemailEntry.formattedNumber()); } glidePhotoManager.loadQuickContactBadge(quickContactBadge, photoInfoBuilder.build()); glidePhotoManager.loadQuickContactBadge( quickContactBadge, NumberAttributesConverter.toPhotoInfoBuilder(voicemailEntry.getNumberAttributes()) .setFormattedNumber(voicemailEntry.getFormattedNumber()) .build()); } void collapseViewHolder() { Loading Loading @@ -293,9 +290,9 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On Assert.isNotNull(voicemailViewHolderListener); Assert.checkArgument( voicemailEntry.id() == viewHolderId, "ensure that the adapter binding has taken place"); voicemailEntry.getId() == viewHolderId, "ensure that the adapter binding has taken place"); Assert.checkArgument( Uri.parse(voicemailEntry.voicemailUri()).equals(viewHolderVoicemailUri), Uri.parse(voicemailEntry.getVoicemailUri()).equals(viewHolderVoicemailUri), "ensure that the adapter binding has taken place"); LogUtil.i( "NewVoicemailViewHolder.expandAndBindViewHolderAndMediaPlayerViewWithAdapterValues", Loading @@ -305,15 +302,15 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On isViewHolderExpanded, String.valueOf(viewHolderVoicemailUri), String.valueOf(mediaPlayerView.getVoicemailUri()), voicemailEntry.isRead()); voicemailEntry.getIsRead()); if (voicemailEntry.isRead() == 0) { if (voicemailEntry.getIsRead() == 0) { // update as read. primaryTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); secondaryTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); transcriptionTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); Uri uri = Uri.parse(voicemailEntry.voicemailUri()); Uri uri = Uri.parse(voicemailEntry.getVoicemailUri()); Worker<Pair<Context, Uri>, Integer> markVoicemailRead = this::markVoicemailAsRead; SuccessListener<Integer> markedAsReadVoicemailCallBack = this::onVoicemailMarkedAsRead; Loading Loading @@ -344,8 +341,8 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On } private void updateBrandingText(VoicemailEntry voicemailEntry) { if (voicemailEntry.transcriptionState() == VoicemailCompat.TRANSCRIPTION_AVAILABLE && !TextUtils.isEmpty(voicemailEntry.transcription())) { if (voicemailEntry.getTranscriptionState() == VoicemailCompat.TRANSCRIPTION_AVAILABLE && !TextUtils.isEmpty(voicemailEntry.getTranscription())) { transcriptionBrandingTextView.setVisibility(VISIBLE); } else { transcriptionBrandingTextView.setVisibility(GONE); Loading Loading @@ -435,7 +432,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On return isViewHolderExpanded; } public int getViewHolderId() { public long getViewHolderId() { return viewHolderId; } Loading java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java +43 −16 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.database.Cursor; import android.provider.CallLog.Calls; import android.support.v4.content.CursorLoader; import android.text.TextUtils; import com.android.dialer.DialerPhoneNumber; import com.android.dialer.NumberAttributes; import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog; Loading Loading @@ -99,22 +100,48 @@ final class VoicemailCursorLoader extends CursorLoader { "CP2 info incomplete for number: %s", LogUtil.sanitizePii(number.getNormalizedNumber())); return VoicemailEntry.builder() VoicemailEntry.Builder voicemailEntryBuilder = VoicemailEntry.newBuilder() .setId(cursor.getInt(ID)) .setTimestamp(cursor.getLong(TIMESTAMP)) .setNumber(number) .setFormattedNumber(cursor.getString(FORMATTED_NUMBER)) .setDuration(cursor.getLong(DURATION)) .setTranscription(cursor.getString(TRANSCRIPTION)) .setVoicemailUri(cursor.getString(VOICEMAIL_URI)) .setGeocodedLocation(cursor.getString(GEOCODED_LOCATION)) .setCallType(cursor.getInt(CALL_TYPE)) .setIsRead(cursor.getInt(IS_READ)) .setNumberAttributes(numberAttributes) .setTranscriptionState(cursor.getInt(TRANSCRIPTION_STATE)) .setPhoneAccountComponentName(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME)) .setPhoneAccountId(cursor.getString(PHONE_ACCOUNT_ID)) .build(); .setTranscriptionState(cursor.getInt(TRANSCRIPTION_STATE)); String formattedNumber = cursor.getString(FORMATTED_NUMBER); if (!TextUtils.isEmpty(formattedNumber)) { voicemailEntryBuilder.setFormattedNumber(formattedNumber); } String geocodedLocation = cursor.getString(GEOCODED_LOCATION); if (!TextUtils.isEmpty(geocodedLocation)) { voicemailEntryBuilder.setGeocodedLocation(geocodedLocation); } String transcription = cursor.getString(TRANSCRIPTION); if (!TextUtils.isEmpty(transcription)) { voicemailEntryBuilder.setTranscription(transcription); } String voicemailUri = cursor.getString(VOICEMAIL_URI); if (!TextUtils.isEmpty(voicemailUri)) { voicemailEntryBuilder.setVoicemailUri(voicemailUri); } String phoneAccountComponentName = cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME); if (!TextUtils.isEmpty(phoneAccountComponentName)) { voicemailEntryBuilder.setPhoneAccountComponentName(phoneAccountComponentName); } String phoneAccountId = cursor.getString(PHONE_ACCOUNT_ID); if (!TextUtils.isEmpty(phoneAccountId)) { voicemailEntryBuilder.setPhoneAccountId(phoneAccountId); } return voicemailEntryBuilder.build(); } static long getTimestamp(Cursor cursor) { Loading java/com/android/dialer/voicemail/listui/VoicemailEntryText.java +12 −10 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ public class VoicemailEntryText { public static String buildPrimaryVoicemailText(Context context, VoicemailEntry data) { StringBuilder primaryText = new StringBuilder(); if (!TextUtils.isEmpty(data.numberAttributes().getName())) { primaryText.append(data.numberAttributes().getName()); } else if (!TextUtils.isEmpty(data.formattedNumber())) { primaryText.append(data.formattedNumber()); if (!TextUtils.isEmpty(data.getNumberAttributes().getName())) { primaryText.append(data.getNumberAttributes().getName()); } else if (!TextUtils.isEmpty(data.getFormattedNumber())) { primaryText.append(data.getFormattedNumber()); } else { // TODO(uabdullah): Handle CallLog.Calls.PRESENTATION_*, including Verizon restricted numbers. primaryText.append(context.getText(R.string.voicemail_entry_unknown)); Loading Loading @@ -71,7 +71,7 @@ public class VoicemailEntryText { private static String secondaryTextPrefix( Context context, Clock clock, VoicemailEntry voicemailEntry) { StringBuilder secondaryText = new StringBuilder(); String location = voicemailEntry.geocodedLocation(); String location = voicemailEntry.getGeocodedLocation(); if (!TextUtils.isEmpty(location)) { secondaryText.append(location); } Loading @@ -80,9 +80,9 @@ public class VoicemailEntryText { } secondaryText.append( CallLogDates.newCallLogTimestampLabel( context, clock.currentTimeMillis(), voicemailEntry.timestamp())); context, clock.currentTimeMillis(), voicemailEntry.getTimestamp())); long duration = voicemailEntry.duration(); long duration = voicemailEntry.getDuration(); if (duration >= 0) { secondaryText.append(" • "); String formattedDuration = getVoicemailDuration(context, voicemailEntry); Loading @@ -92,15 +92,17 @@ public class VoicemailEntryText { } static String getVoicemailDuration(Context context, VoicemailEntry voicemailEntry) { long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.duration()); long seconds = voicemailEntry.duration() - TimeUnit.MINUTES.toSeconds(minutes); long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.getDuration()); long seconds = voicemailEntry.getDuration() - TimeUnit.MINUTES.toSeconds(minutes); // The format for duration is "MM:SS" and we never expect the duration to be > 5 minutes // However an incorrect duration could be set by the framework/someone to be >99, and in that // case cap it at 99, for the UI to still be able to display it in "MM:SS" format. if (minutes > 99) { LogUtil.w( "VoicemailEntryText.getVoicemailDuration", "Duration was %d", voicemailEntry.duration()); "VoicemailEntryText.getVoicemailDuration", "Duration was %d", voicemailEntry.getDuration()); minutes = 99; } return context.getString(R.string.voicemailDurationFormat, minutes, seconds); Loading Loading
java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java +3 −3 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> private final FragmentManager fragmentManager; /** A valid id for {@link VoicemailEntry} is greater than 0 */ private int currentlyExpandedViewHolderId = -1; private long currentlyExpandedViewHolderId = -1; private VoicemailErrorMessage voicemailErrorMessage; Loading @@ -114,7 +114,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> * will always ensure there is only (up-to-date) view holder corresponding to a view holder id, * unlike the newVoicemailViewHolderSet. */ private final ArrayMap<Integer, NewVoicemailViewHolder> newVoicemailViewHolderArrayMap = private final ArrayMap<Long, NewVoicemailViewHolder> newVoicemailViewHolderArrayMap = new ArrayMap<>(); // A single instance of a media player re-used across the expanded view holders. Loading Loading @@ -440,7 +440,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter<ViewHolder> if (!newVoicemailViewHolderArrayMap.isEmpty()) { String ids = ""; for (int id : newVoicemailViewHolderArrayMap.keySet()) { for (long id : newVoicemailViewHolderArrayMap.keySet()) { ids = ids + id + " "; } LogUtil.i("NewVoicemailAdapter.printArrayMap", "ids are " + ids); Loading
java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java +4 −4 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout { NewVoicemailViewHolderListener listener) { Assert.isNotNull(voicemailEntryFromAdapter); Uri uri = Uri.parse(voicemailEntryFromAdapter.voicemailUri()); Uri uri = Uri.parse(voicemailEntryFromAdapter.getVoicemailUri()); numberVoicemailFrom = voicemailEntryFromAdapter.number().getNormalizedNumber(); phoneAccountId = voicemailEntryFromAdapter.phoneAccountId(); phoneAccountComponentName = voicemailEntryFromAdapter.phoneAccountComponentName(); numberVoicemailFrom = voicemailEntryFromAdapter.getNumber().getNormalizedNumber(); phoneAccountId = voicemailEntryFromAdapter.getPhoneAccountId(); phoneAccountComponentName = voicemailEntryFromAdapter.getPhoneAccountComponentName(); Assert.isNotNull(viewHolder); Assert.isNotNull(uri); Loading
java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +21 −24 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.time.Clock; import com.android.dialer.voicemail.listui.menu.NewVoicemailMenu; import com.android.dialer.voicemail.model.VoicemailEntry; Loading @@ -64,7 +63,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On private final ImageView menuButton; private final Clock clock; private boolean isViewHolderExpanded; private int viewHolderId; private long viewHolderId; private VoicemailEntry voicemailEntryOfViewHolder; @NonNull private Uri viewHolderVoicemailUri; private final NewVoicemailViewHolderListener voicemailViewHolderListener; Loading Loading @@ -117,7 +116,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On FragmentManager fragmentManager, NewVoicemailMediaPlayer mediaPlayer, int position, int currentlyExpandedViewHolderId) { long currentlyExpandedViewHolderId) { LogUtil.i( "NewVoicemailViewHolder.bindViewHolderValuesFromAdapter", Loading @@ -128,16 +127,16 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On cursor.getCount()); voicemailEntryOfViewHolder = VoicemailCursorLoader.toVoicemailEntry(cursor); viewHolderId = voicemailEntryOfViewHolder.id(); viewHolderId = voicemailEntryOfViewHolder.getId(); LogUtil.i( "NewVoicemailViewHolder.bindViewHolderValuesFromAdapter", "viewholderId:%d", viewHolderId); viewHolderVoicemailUri = Uri.parse(voicemailEntryOfViewHolder.voicemailUri()); viewHolderVoicemailUri = Uri.parse(voicemailEntryOfViewHolder.getVoicemailUri()); primaryTextView.setText( VoicemailEntryText.buildPrimaryVoicemailText(context, voicemailEntryOfViewHolder)); secondaryTextView.setText( VoicemailEntryText.buildSecondaryVoicemailText(context, clock, voicemailEntryOfViewHolder)); String voicemailTranscription = voicemailEntryOfViewHolder.transcription(); String voicemailTranscription = voicemailEntryOfViewHolder.getTranscription(); if (TextUtils.isEmpty(voicemailTranscription)) { transcriptionTextView.setVisibility(GONE); Loading Loading @@ -204,10 +203,10 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On LogUtil.v( "NewVoicemailViewHolder.boldViewHolderIfUnread", "id:%d, isRead:%d", voicemailEntryOfViewHolder.id(), voicemailEntryOfViewHolder.isRead()); voicemailEntryOfViewHolder.getId(), voicemailEntryOfViewHolder.getIsRead()); if (voicemailEntryOfViewHolder.isRead() == 0) { if (voicemailEntryOfViewHolder.getIsRead() == 0) { primaryTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); secondaryTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); transcriptionTextView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); Loading @@ -215,13 +214,11 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On } private void setPhoto(VoicemailEntry voicemailEntry) { PhotoInfo.Builder photoInfoBuilder = NumberAttributesConverter.toPhotoInfoBuilder(voicemailEntry.numberAttributes()); if (!TextUtils.isEmpty(voicemailEntry.formattedNumber())) { photoInfoBuilder.setFormattedNumber(voicemailEntry.formattedNumber()); } glidePhotoManager.loadQuickContactBadge(quickContactBadge, photoInfoBuilder.build()); glidePhotoManager.loadQuickContactBadge( quickContactBadge, NumberAttributesConverter.toPhotoInfoBuilder(voicemailEntry.getNumberAttributes()) .setFormattedNumber(voicemailEntry.getFormattedNumber()) .build()); } void collapseViewHolder() { Loading Loading @@ -293,9 +290,9 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On Assert.isNotNull(voicemailViewHolderListener); Assert.checkArgument( voicemailEntry.id() == viewHolderId, "ensure that the adapter binding has taken place"); voicemailEntry.getId() == viewHolderId, "ensure that the adapter binding has taken place"); Assert.checkArgument( Uri.parse(voicemailEntry.voicemailUri()).equals(viewHolderVoicemailUri), Uri.parse(voicemailEntry.getVoicemailUri()).equals(viewHolderVoicemailUri), "ensure that the adapter binding has taken place"); LogUtil.i( "NewVoicemailViewHolder.expandAndBindViewHolderAndMediaPlayerViewWithAdapterValues", Loading @@ -305,15 +302,15 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On isViewHolderExpanded, String.valueOf(viewHolderVoicemailUri), String.valueOf(mediaPlayerView.getVoicemailUri()), voicemailEntry.isRead()); voicemailEntry.getIsRead()); if (voicemailEntry.isRead() == 0) { if (voicemailEntry.getIsRead() == 0) { // update as read. primaryTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); secondaryTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); transcriptionTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); Uri uri = Uri.parse(voicemailEntry.voicemailUri()); Uri uri = Uri.parse(voicemailEntry.getVoicemailUri()); Worker<Pair<Context, Uri>, Integer> markVoicemailRead = this::markVoicemailAsRead; SuccessListener<Integer> markedAsReadVoicemailCallBack = this::onVoicemailMarkedAsRead; Loading Loading @@ -344,8 +341,8 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On } private void updateBrandingText(VoicemailEntry voicemailEntry) { if (voicemailEntry.transcriptionState() == VoicemailCompat.TRANSCRIPTION_AVAILABLE && !TextUtils.isEmpty(voicemailEntry.transcription())) { if (voicemailEntry.getTranscriptionState() == VoicemailCompat.TRANSCRIPTION_AVAILABLE && !TextUtils.isEmpty(voicemailEntry.getTranscription())) { transcriptionBrandingTextView.setVisibility(VISIBLE); } else { transcriptionBrandingTextView.setVisibility(GONE); Loading Loading @@ -435,7 +432,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On return isViewHolderExpanded; } public int getViewHolderId() { public long getViewHolderId() { return viewHolderId; } Loading
java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java +43 −16 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.database.Cursor; import android.provider.CallLog.Calls; import android.support.v4.content.CursorLoader; import android.text.TextUtils; import com.android.dialer.DialerPhoneNumber; import com.android.dialer.NumberAttributes; import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog; Loading Loading @@ -99,22 +100,48 @@ final class VoicemailCursorLoader extends CursorLoader { "CP2 info incomplete for number: %s", LogUtil.sanitizePii(number.getNormalizedNumber())); return VoicemailEntry.builder() VoicemailEntry.Builder voicemailEntryBuilder = VoicemailEntry.newBuilder() .setId(cursor.getInt(ID)) .setTimestamp(cursor.getLong(TIMESTAMP)) .setNumber(number) .setFormattedNumber(cursor.getString(FORMATTED_NUMBER)) .setDuration(cursor.getLong(DURATION)) .setTranscription(cursor.getString(TRANSCRIPTION)) .setVoicemailUri(cursor.getString(VOICEMAIL_URI)) .setGeocodedLocation(cursor.getString(GEOCODED_LOCATION)) .setCallType(cursor.getInt(CALL_TYPE)) .setIsRead(cursor.getInt(IS_READ)) .setNumberAttributes(numberAttributes) .setTranscriptionState(cursor.getInt(TRANSCRIPTION_STATE)) .setPhoneAccountComponentName(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME)) .setPhoneAccountId(cursor.getString(PHONE_ACCOUNT_ID)) .build(); .setTranscriptionState(cursor.getInt(TRANSCRIPTION_STATE)); String formattedNumber = cursor.getString(FORMATTED_NUMBER); if (!TextUtils.isEmpty(formattedNumber)) { voicemailEntryBuilder.setFormattedNumber(formattedNumber); } String geocodedLocation = cursor.getString(GEOCODED_LOCATION); if (!TextUtils.isEmpty(geocodedLocation)) { voicemailEntryBuilder.setGeocodedLocation(geocodedLocation); } String transcription = cursor.getString(TRANSCRIPTION); if (!TextUtils.isEmpty(transcription)) { voicemailEntryBuilder.setTranscription(transcription); } String voicemailUri = cursor.getString(VOICEMAIL_URI); if (!TextUtils.isEmpty(voicemailUri)) { voicemailEntryBuilder.setVoicemailUri(voicemailUri); } String phoneAccountComponentName = cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME); if (!TextUtils.isEmpty(phoneAccountComponentName)) { voicemailEntryBuilder.setPhoneAccountComponentName(phoneAccountComponentName); } String phoneAccountId = cursor.getString(PHONE_ACCOUNT_ID); if (!TextUtils.isEmpty(phoneAccountId)) { voicemailEntryBuilder.setPhoneAccountId(phoneAccountId); } return voicemailEntryBuilder.build(); } static long getTimestamp(Cursor cursor) { Loading
java/com/android/dialer/voicemail/listui/VoicemailEntryText.java +12 −10 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ public class VoicemailEntryText { public static String buildPrimaryVoicemailText(Context context, VoicemailEntry data) { StringBuilder primaryText = new StringBuilder(); if (!TextUtils.isEmpty(data.numberAttributes().getName())) { primaryText.append(data.numberAttributes().getName()); } else if (!TextUtils.isEmpty(data.formattedNumber())) { primaryText.append(data.formattedNumber()); if (!TextUtils.isEmpty(data.getNumberAttributes().getName())) { primaryText.append(data.getNumberAttributes().getName()); } else if (!TextUtils.isEmpty(data.getFormattedNumber())) { primaryText.append(data.getFormattedNumber()); } else { // TODO(uabdullah): Handle CallLog.Calls.PRESENTATION_*, including Verizon restricted numbers. primaryText.append(context.getText(R.string.voicemail_entry_unknown)); Loading Loading @@ -71,7 +71,7 @@ public class VoicemailEntryText { private static String secondaryTextPrefix( Context context, Clock clock, VoicemailEntry voicemailEntry) { StringBuilder secondaryText = new StringBuilder(); String location = voicemailEntry.geocodedLocation(); String location = voicemailEntry.getGeocodedLocation(); if (!TextUtils.isEmpty(location)) { secondaryText.append(location); } Loading @@ -80,9 +80,9 @@ public class VoicemailEntryText { } secondaryText.append( CallLogDates.newCallLogTimestampLabel( context, clock.currentTimeMillis(), voicemailEntry.timestamp())); context, clock.currentTimeMillis(), voicemailEntry.getTimestamp())); long duration = voicemailEntry.duration(); long duration = voicemailEntry.getDuration(); if (duration >= 0) { secondaryText.append(" • "); String formattedDuration = getVoicemailDuration(context, voicemailEntry); Loading @@ -92,15 +92,17 @@ public class VoicemailEntryText { } static String getVoicemailDuration(Context context, VoicemailEntry voicemailEntry) { long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.duration()); long seconds = voicemailEntry.duration() - TimeUnit.MINUTES.toSeconds(minutes); long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.getDuration()); long seconds = voicemailEntry.getDuration() - TimeUnit.MINUTES.toSeconds(minutes); // The format for duration is "MM:SS" and we never expect the duration to be > 5 minutes // However an incorrect duration could be set by the framework/someone to be >99, and in that // case cap it at 99, for the UI to still be able to display it in "MM:SS" format. if (minutes > 99) { LogUtil.w( "VoicemailEntryText.getVoicemailDuration", "Duration was %d", voicemailEntry.duration()); "VoicemailEntryText.getVoicemailDuration", "Duration was %d", voicemailEntry.getDuration()); minutes = 99; } return context.getString(R.string.voicemailDurationFormat, minutes, seconds); Loading