summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/voicemail
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-07-17 14:50:21 -0700
committerNancy Chen <nancychen@google.com>2015-07-17 17:25:15 -0700
commit85647649a10d680faeb2e73a3d191191058b7d66 (patch)
tree4567dfe489f6988089174190ae00b5fc6d237f8e /src/com/android/dialer/voicemail
parent515575ebcf136c215579536c209d9e2644da16ce (diff)
Reset voicemail playback when call log is paused.
If the user navigates away from the call log, reset the currently playing voicemail playback. Which includes resetting the start point, pausing playback, and refreshing the play icon. Bug: 22530093 Change-Id: I78eda2d86cf0f5b24136a7a9ba299214f155672b
Diffstat (limited to 'src/com/android/dialer/voicemail')
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index f76af59a4..fb9e3edfb 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -260,7 +260,17 @@ public class VoicemailPlaybackPresenter
}
/**
- * Reset the presenter for playback.
+ * Reset the presenter for playback back to its original state.
+ */
+ public void resetAll() {
+ reset();
+
+ mView = null;
+ mVoicemailUri = null;
+ }
+
+ /**
+ * Reset the presenter such that it is as if the voicemail has not been played.
*/
public void reset() {
if (mMediaPlayer != null) {
@@ -270,13 +280,15 @@ public class VoicemailPlaybackPresenter
disableProximitySensor(false /* waitForFarState */);
- mView = null;
- mVoicemailUri = null;
-
mIsPrepared = false;
mIsPlaying = false;
mPosition = 0;
mDuration.set(0);
+
+ if (mView != null) {
+ mView.onPlaybackStopped();
+ mView.setClipPosition(0, mDuration.get());
+ }
}
/**
@@ -291,16 +303,11 @@ public class VoicemailPlaybackPresenter
}
// Release the media player, otherwise there may be failures.
- if (mMediaPlayer != null) {
- mMediaPlayer.release();
- mMediaPlayer = null;
- mIsPrepared = false;
- }
+ reset();
if (mActivity != null) {
mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
- disableProximitySensor(false /* waitForFarState */);
}
/**