Skip to content

Commit

Permalink
Merge pull request #128 from jeancsanchez/feat/resumeView
Browse files Browse the repository at this point in the history
Adding resume method for view getting current player status
  • Loading branch information
jeancsanchez authored Jan 21, 2022
2 parents 4e7833b + 20aa730 commit 1832a15
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ private constructor(private val serviceConnection: JcServiceConnection) : JcPlay
val currentAudio: JcAudio?
get() = jcPlayerService?.currentAudio

var currentStatus: JcStatus? = null
private set

var onShuffleMode: Boolean = false

var repeatPlaylist: Boolean = false
Expand Down Expand Up @@ -255,6 +258,7 @@ private constructor(private val serviceConnection: JcServiceConnection) : JcPlay


override fun onPreparedListener(status: JcStatus) {
currentStatus = status
updatePositionAudioList()

for (listener in managerListeners) {
Expand All @@ -263,6 +267,8 @@ private constructor(private val serviceConnection: JcServiceConnection) : JcPlay
}

override fun onTimeChangedListener(status: JcStatus) {
currentStatus = status

for (listener in managerListeners) {
listener.onTimeChanged(status)

Expand All @@ -273,6 +279,8 @@ private constructor(private val serviceConnection: JcServiceConnection) : JcPlay
}

override fun onContinueListener(status: JcStatus) {
currentStatus = status

for (listener in managerListeners) {
listener.onContinueAudio(status)
}
Expand All @@ -285,12 +293,16 @@ private constructor(private val serviceConnection: JcServiceConnection) : JcPlay
}

override fun onPausedListener(status: JcStatus) {
currentStatus = status

for (listener in managerListeners) {
listener.onPaused(status)
}
}

override fun onStoppedListener(status: JcStatus) {
currentStatus = status

for (listener in managerListeners) {
listener.onStopped(status)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.example.jean.jcplayer.general;

import android.support.annotation.Nullable;

import com.example.jean.jcplayer.model.JcAudio;

/**
* Created by rio on 02 January 2017.
*/
public class JcStatus {
@Nullable
private JcAudio jcAudio;
private long duration;
private long currentPosition;
Expand Down
Loading

0 comments on commit 1832a15

Please sign in to comment.