diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-12 23:18:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-12 23:18:50 +0000 |
commit | 888e6b1499f7be68f2d33f870a57cd7e2a58dd93 (patch) | |
tree | 85148446a15528867fba0d7353b024081d9e0a5a /java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java | |
parent | ab544521b21566b12a42e539d119c76dd5243a2d (diff) | |
parent | 75d67f5d83bdb28c6254cf064d09ac24fc9ae928 (diff) |
Merge changes I45978ea4,Ia85b1008,I9e68c561,I9255dd3c
* changes:
BEGIN_PUBLIC Automated rollback of changelist 172683494
BEGIN_PUBLIC Automated rollback of changelist 172956409
Download and play voicemails from server when not locally available.
Updated writing of PhoneLookup columns in annotated call log.
Diffstat (limited to 'java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java')
-rw-r--r-- | java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java index 2d59b241b..48062a87d 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayer.java @@ -23,6 +23,7 @@ import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnPreparedListener; import android.net.Uri; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import java.io.IOException; @@ -38,6 +39,7 @@ public class NewVoicemailMediaPlayer { private OnPreparedListener newVoicemailMediaPlayerOnPreparedListener; private OnCompletionListener newVoicemailMediaPlayerOnCompletionListener; private Uri pausedUri; + @Nullable private Uri voicemailRequestedToDownload; public NewVoicemailMediaPlayer(@NonNull MediaPlayer player) { mediaPlayer = Assert.isNotNull(player); @@ -94,6 +96,7 @@ public class NewVoicemailMediaPlayer { mediaPlayer.start(); voicemailLastPlayedOrPlayingUri = startPlayingVoicemailUri; pausedUri = null; + voicemailRequestedToDownload = null; } public void reset() { @@ -102,6 +105,7 @@ public class NewVoicemailMediaPlayer { voicemailLastPlayedOrPlayingUri = null; voicemailUriLastPreparedOrPreparingToPlay = null; pausedUri = null; + voicemailRequestedToDownload = null; } public void pauseMediaPlayer(Uri voicemailUri) { @@ -134,6 +138,11 @@ public class NewVoicemailMediaPlayer { newVoicemailMediaPlayerOnCompletionListener = onCompletionListener; } + public void setVoicemailRequestedToDownload(@NonNull Uri uri) { + Assert.isNotNull(uri, "cannot download a null voicemail"); + voicemailRequestedToDownload = uri; + } + /** * Note: In some cases it's possible mediaPlayer.isPlaying() can return true, but * mediaPlayer.getCurrentPosition() can be greater than mediaPlayer.getDuration(), after which @@ -182,6 +191,17 @@ public class NewVoicemailMediaPlayer { return mediaPlayer.getDuration(); } + /** + * A null v/s non-value is important for the {@link NewVoicemailAdapter} to differentiate between + * a underlying table change due to a voicemail being downloaded or something else (e.g delete). + * + * @return if there was a Uri that was requested to be downloaded from the server, null otherwise. + */ + @Nullable + public Uri getVoicemailRequestedToDownload() { + return voicemailRequestedToDownload; + } + public boolean isPaused() { return pausedUri != null; } |