diff options
author | Nancy Chen <nancychen@google.com> | 2015-07-22 20:17:04 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-22 20:17:04 +0000 |
commit | 43bc27c3f9255f8480661088c61e7cbb50e9095a (patch) | |
tree | 8656a516d8371840bb84463f553b2cf679529f38 | |
parent | 27ba15b5594405f6996d359e423f94d09e0545ea (diff) | |
parent | fb229aa0b59763c91adff25936feede8d7f561c8 (diff) |
am fb229aa0: Merge "Reset voicemail playback when call log is paused." into mnc-dev
* commit 'fb229aa0b59763c91adff25936feede8d7f561c8':
Reset voicemail playback when call log is paused.
-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 b8b9f0bfc..9609e4d6f 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -153,7 +153,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 c54dfe0c3..7270af787 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java @@ -266,7 +266,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) { @@ -276,13 +286,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()); + } } /** @@ -297,16 +309,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 */); } /** |