-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/WIP: Started creating some UI and fixed playing state not being …
…well updated Signed-off-by: Gabriel Fontán <[email protected]>
- Loading branch information
Showing
6 changed files
with
237 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/queue/EmptyQueue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.bobbyesp.mediaplayer.service.queue | ||
|
||
import androidx.media3.common.MediaItem | ||
import androidx.media3.common.MediaMetadata | ||
|
||
object EmptyQueue : Queue { | ||
override val preloadItem: MediaMetadata? | ||
get() = null | ||
|
||
override suspend fun getInitialData(): Queue.Data = Queue.Data.empty() | ||
override fun hasNextPage(): Boolean = false | ||
override suspend fun nextPage(): List<MediaItem> = emptyList() | ||
} |
22 changes: 22 additions & 0 deletions
22
app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/queue/Queue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.bobbyesp.mediaplayer.service.queue | ||
|
||
import androidx.media3.common.MediaItem | ||
import androidx.media3.common.MediaMetadata | ||
|
||
interface Queue { | ||
val preloadItem: MediaMetadata? | ||
suspend fun getInitialData(): Data | ||
fun hasNextPage(): Boolean | ||
suspend fun nextPage(): List<MediaItem> | ||
|
||
data class Data( | ||
val title: String?, | ||
val items: List<MediaItem>, | ||
val mediaItemIndex: Int, | ||
val position: Long = 0L, | ||
) { | ||
companion object { | ||
fun empty() = Data(null, emptyList(), -1, 0L) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app/mediaplayer/src/main/java/com/bobbyesp/mediaplayer/service/queue/SongsQueue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.bobbyesp.mediaplayer.service.queue | ||
|
||
import androidx.media3.common.MediaItem | ||
import androidx.media3.common.MediaMetadata | ||
|
||
data class SongsQueue( | ||
val title: String? = null, | ||
val items: List<MediaItem>, | ||
val startIndex: Int = 0, | ||
val position: Long = 0L, | ||
) : Queue { | ||
override val preloadItem: MediaMetadata? = null | ||
override suspend fun getInitialData(): Queue.Data = | ||
Queue.Data(title, items, startIndex, position) | ||
|
||
override fun hasNextPage(): Boolean = false | ||
override suspend fun nextPage() = throw UnsupportedOperationException() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.