diff options
Diffstat (limited to 'java/com/android/dialer/voicemail/listui')
4 files changed, 19 insertions, 10 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java index 1e56a8189..b2d93b17c 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java @@ -25,18 +25,19 @@ import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnPreparedListener; import android.net.Uri; import android.provider.VoicemailContract; -import android.support.annotation.VisibleForTesting; import android.support.v4.util.Pair; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; +import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; +import com.android.dialer.voicemail.model.VoicemailEntry; /** * The view of the media player that is visible when a {@link NewVoicemailViewHolder} is expanded. @@ -46,6 +47,7 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { private Button playButton; private Button speakerButton; private Button deleteButton; + private TextView totalDurationView; private Uri voicemailUri; private FragmentManager fragmentManager; private MediaPlayer mediaPlayer; @@ -62,14 +64,15 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { protected void onFinishInflate() { super.onFinishInflate(); LogUtil.enterBlock("NewVoicemailMediaPlayer.onFinishInflate"); - initializeMediaPlayerButtons(); + initializeMediaPlayerButtonsAndViews(); setupListenersForMediaPlayerButtons(); } - private void initializeMediaPlayerButtons() { + private void initializeMediaPlayerButtonsAndViews() { playButton = findViewById(R.id.playButton); speakerButton = findViewById(R.id.speakerButton); deleteButton = findViewById(R.id.deleteButton); + totalDurationView = findViewById(R.id.playback_seek_total_duration); } private void setupListenersForMediaPlayerButtons() { @@ -171,7 +174,6 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { } }; - @VisibleForTesting(otherwise = VisibleForTesting.NONE) OnCompletionListener onCompletionListener = new OnCompletionListener() { @@ -197,7 +199,6 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { } }; - @VisibleForTesting(otherwise = VisibleForTesting.NONE) OnErrorListener onErrorListener = new OnErrorListener() { @Override @@ -210,12 +211,21 @@ public class NewVoicemailMediaPlayerView extends LinearLayout { } }; - public void setVoicemailUri(Uri voicemailUri) { + void setVoicemailUri(Uri voicemailUri) { Assert.isNotNull(voicemailUri); this.voicemailUri = voicemailUri; } - public void setFragmentManager(FragmentManager fragmentManager) { + void setFragmentManager(FragmentManager fragmentManager) { this.fragmentManager = fragmentManager; } + + // TODO(uabdullah): Merge with voicemailUri (http://cl/175585919) + void setVoicemailDuration(VoicemailEntry voicemailEntry) { + Assert.isNotNull(voicemailEntry); + Assert.isNotNull(totalDurationView); + + totalDurationView.setText( + VoicemailEntryText.getVoicemailDuration(getContext(), voicemailEntry)); + } } diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java index 078a029c9..d5546c33f 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java @@ -81,6 +81,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On setPhoto(voicemailEntry); mediaPlayerView.setVoicemailUri(Uri.parse(voicemailEntry.voicemailUri())); mediaPlayerView.setFragmentManager(fragmentManager); + mediaPlayerView.setVoicemailDuration(voicemailEntry); } // TODO(uabdullah): Consider/Implement TYPE (e.g Spam, TYPE_VOICEMAIL) diff --git a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java index f59220105..d73d1f0de 100644 --- a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java +++ b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java @@ -91,7 +91,7 @@ public class VoicemailEntryText { return secondaryText.toString(); } - private static String getVoicemailDuration(Context context, VoicemailEntry voicemailEntry) { + static String getVoicemailDuration(Context context, VoicemailEntry voicemailEntry) { long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.duration()); long seconds = voicemailEntry.duration() - TimeUnit.MINUTES.toSeconds(minutes); diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml index a21b6aa6c..e8e560059 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml @@ -55,13 +55,11 @@ android:max="0" android:progress="0"/> - <!-- TODO(uabdullah): Remove android:text and replace with real value when binding --> <TextView android:id="@+id/playback_seek_total_duration" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" - android:text="03:00" android:textSize="@dimen/voicemail_duration_size"/> </LinearLayout> |