diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-18 02:50:55 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-18 02:50:55 +0000 |
commit | ef7a7eb0f103d41df55385267ac52dc3dcf603cb (patch) | |
tree | 8bb6b163a88cf321073913c2b0b7dad5ecbd854e /java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java | |
parent | c2590357cf857e714f875f2a7c222d1bd128c2c5 (diff) | |
parent | 6f78d935ff64f178e9fe8891082c18578d4e4b74 (diff) |
Merge changes Ida554313,Ie7187b02,I7a7c23b4
* changes:
Stop showing partially matched numbers that are not global phone numbers.
Display Voicemail Contact Name and Photo in Voicemail Fragment.
Add temporary assisted dialing setting to Dialer.
Diffstat (limited to 'java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java')
-rw-r--r-- | java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java new file mode 100644 index 000000000..daa24c86c --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +package com.android.dialer.voicemail.listui; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.support.v7.widget.RecyclerView; +import android.view.View; +import android.widget.QuickContactBadge; +import android.widget.TextView; +import com.android.dialer.contactphoto.ContactPhotoManager; +import com.android.dialer.lettertile.LetterTileDrawable; +import com.android.dialer.voicemail.model.VoicemailEntry; + +/** {@link RecyclerView.ViewHolder} for the new voicemail tab. */ +final class NewVoicemailViewHolder extends RecyclerView.ViewHolder { + + private final Context context; + private final TextView primaryTextView; + private final QuickContactBadge quickContactBadge; + + NewVoicemailViewHolder(View view) { + super(view); + this.context = view.getContext(); + primaryTextView = (TextView) view.findViewById(R.id.primary_text); + quickContactBadge = view.findViewById(R.id.quick_contact_photo); + } + + void bind(Cursor cursor) { + VoicemailEntry voicemailEntry = VoicemailCursorLoader.toVoicemailEntry(cursor); + primaryTextView.setText(VoicemailEntryText.buildPrimaryVoicemailText(context, voicemailEntry)); + setPhoto(voicemailEntry); + } + + // TODO(uabdullah): Consider/Implement TYPE (e.g Spam, TYPE_VOICEMAIL) + private void setPhoto(VoicemailEntry voicemailEntry) { + ContactPhotoManager.getInstance(context) + .loadDialerThumbnailOrPhoto( + quickContactBadge, + voicemailEntry.lookupUri() == null ? null : Uri.parse(voicemailEntry.lookupUri()), + voicemailEntry.photoId(), + voicemailEntry.photoUri() == null ? null : Uri.parse(voicemailEntry.photoUri()), + voicemailEntry.name(), + LetterTileDrawable.TYPE_DEFAULT); + } +} |