Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bd03630 authored by Nancy Chen's avatar Nancy Chen Committed by Android Git Automerger
Browse files

am 4c0d05b7: am e8cde28c: am fb229aa0: Merge "Reset voicemail playback when...

am 4c0d05b7: am e8cde28c: am fb229aa0: Merge "Reset voicemail playback when call log is paused." into mnc-dev

* commit '4c0d05b7':
  Reset voicemail playback when call log is paused.
parents 135be5be 4c0d05b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+17 −10
Original line number Diff line number Diff line
@@ -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 */);
    }

    /**