diff options
author | Nancy Chen <nancychen@google.com> | 2015-07-17 14:50:21 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2015-07-17 17:25:15 -0700 |
commit | 85647649a10d680faeb2e73a3d191191058b7d66 (patch) | |
tree | 4567dfe489f6988089174190ae00b5fc6d237f8e /src/com | |
parent | 515575ebcf136c215579536c209d9e2644da16ce (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')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 2 | ||||
-rw-r--r-- | src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java | 27 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 458c90bdc..00e9ea016 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -151,7 +151,7 @@ public class CallLogAdapter extends GroupingListAdapter if (mVoicemailPlaybackPresenter != null) { // Always reset the voicemail playback state on expand or collapse. - mVoicemailPlaybackPresenter.reset(); + mVoicemailPlaybackPresenter.resetAll(); } if (viewHolder.getAdapterPosition() == mCurrentlyExpandedPosition) { 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 */); } /** |