diff options
-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 */); } /** |