Skip to content

Commit

Permalink
addedAt, playedAt, completedAt converted to nullable Date, error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kshivang committed Oct 12, 2019
1 parent 03d2a25 commit 8bb29b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal object GoonjPlayerManager {

fun addTrack(track: Track, index: Int = trackList.size) {
track.state.index = index
track.state.addedAt = Date().time
track.state.addedAt = Date()
mTrackList.add(index, track)
player?.enqueue(track, index)
trackListSubject.onNext(mTrackList)
Expand Down Expand Up @@ -121,7 +121,7 @@ internal object GoonjPlayerManager {
}

fun onTrackComplete(track: Track) {
track.state.completedAt = Date().time
track.state.completedAt = Date()
lastCompletedTrack = track
trackCompleteSubject.onNext(track)
}
Expand Down
2 changes: 1 addition & 1 deletion goonj/src/main/java/ai/rever/goonj/models/Track.kt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ data class TrackState(var index: Int = 0,
}


val Context.defaultBitmap: Bitmap? get() = BitmapFactory.decodeResource(resources, R.drawable.ic_album)
internal val Context.defaultBitmap: Bitmap? get() = BitmapFactory.decodeResource(resources, R.drawable.ic_album)


Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ internal class LocalAudioPlayer: AudioPlayer {
GoonjPlayerManager.currentTrackSubject.onNext(exoTrack)

if (exoTrack.id != lastKnownTrack?.id) {
exoTrack.state.playedAt = Date().time
exoTrack.state.playedAt = Date()
GoonjPlayerManager.onTrackComplete(lastKnownTrack ?: return)
GoonjPlayerManager.autoplayTrackSubject.value?.let {
if (!it) {
Expand Down

0 comments on commit 8bb29b4

Please sign in to comment.