diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 22599dbbb..b947b644e 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -7,7 +7,8 @@ musikcube:
musikdroid:
-* gapless playback!
+* gapless playback (for supported media)! enable in settings > playback
+ engine > "ExoPlayer Gapless (experimental)"
* album art is now displayed in album rows when browsing
* context menus on most screens with the ability to switch between related
content (e.g. albums by this artist, artists in this genre, etc)
@@ -22,7 +23,6 @@ musikdroid:
* updated Glide from v3 -> v4
* updated to Android Studio 3.0.1 and related tooling
-
sdk:
* removed all Destroy() methods, standardized on Release() across the board
diff --git a/src/musikdroid/README.md b/src/musikdroid/README.md
index a6f67bbc6..2f8ddae1d 100644
--- a/src/musikdroid/README.md
+++ b/src/musikdroid/README.md
@@ -11,7 +11,7 @@ because `musikdroid` is not available in the Google Play store, it uses [fabric.
this should allow you to build and test locally without special keys. TODO: simplify
-the project is currently built using `Android Studio 3.0 Canary 6`
+the project is currently built using `Android Studio 3.0.1`
# attribution
diff --git a/src/musikdroid/app/src/main/AndroidManifest.xml b/src/musikdroid/app/src/main/AndroidManifest.xml
index ff667686f..a14d302c5 100644
--- a/src/musikdroid/app/src/main/AndroidManifest.xml
+++ b/src/musikdroid/app/src/main/AndroidManifest.xml
@@ -51,6 +51,11 @@
+
+
+
(protected val runner: Runner? = null): Runner.TaskCallbacks {
+abstract class ViewModel(protected val runner: Runner? = null): Runner.TaskCallbacks {
val id: Long = nextId.incrementAndGet()
+ private val publisher by lazy { createSubject() }
interface Provider {
fun > createViewModel(): T?
}
- protected var listener: ListenerT? = null
+ protected var listener: T? = null
private set
- fun onPause() {
+ open fun onPause() {
}
- fun onResume() {
+ open fun onResume() {
}
- fun onDestroy() {
+ open fun onDestroy() {
listener = null
handler.postDelayed(cleanup, cleanupDelayMs)
}
- fun observe(listener: ListenerT) {
- this.listener = listener
+ open fun onCleanup() {
+
+ }
+
+ fun observe(): Observable {
+ return publisher
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribeOn(AndroidSchedulers.mainThread())
}
val context: Context = Application.instance!!
- internal val cleanup = object: Runnable {
- override fun run() {
- listener = null
- idToInstance.remove(id)
- }
+ internal val cleanup = Runnable {
+ listener = null
+ idToInstance.remove(id)
+ onCleanup()
+ }
+
+ protected fun publish(value: T) {
+ publisher.onNext(value)
+ }
+
+ open fun createSubject(): Subject {
+ return PublishSubject.create()
}
override fun onTaskError(name: String?, id: Long, task: Task<*, *>?, error: Throwable?) {
diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/remote/RemotePlaybackService.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/remote/RemotePlaybackService.kt
index 1681982a8..258de31a4 100644
--- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/remote/RemotePlaybackService.kt
+++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/remote/RemotePlaybackService.kt
@@ -373,7 +373,6 @@ class RemotePlaybackService : IPlaybackService {
override val playlistQueryFactory: TrackListSlidingWindow.QueryFactory = object : TrackListSlidingWindow.QueryFactory() {
override fun count(): Observable = dataProvider.getPlayQueueTracksCount()
- override fun all(): Observable>? = dataProvider.getPlayQueueTracks()
override fun page(offset: Int, limit: Int): Observable> = dataProvider.getPlayQueueTracks(limit, offset)
override fun offline(): Boolean = false
}
diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/streaming/StreamingPlaybackService.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/streaming/StreamingPlaybackService.kt
index 94d3bcaa7..0795e9017 100644
--- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/streaming/StreamingPlaybackService.kt
+++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/playback/impl/streaming/StreamingPlaybackService.kt
@@ -774,20 +774,6 @@ class StreamingPlaybackService(context: Context) : IPlaybackService {
return null
}
- override fun all(): Observable>? {
- val params = params
- if (params != null) {
- if (Strings.notEmpty(params.category) && (params.categoryId >= 0)) {
- return dataProvider.getTracksByCategory(
- params.category ?: "", params.categoryId, params.filter)
- }
- else {
- return dataProvider.getTracks(params.filter)
- }
- }
- return null
- }
-
override fun page(offset: Int, limit: Int): Observable>? {
val params = params
if (params != null) {
diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/Messages.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/Messages.kt
index a5f9a39e9..bf116b259 100644
--- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/Messages.kt
+++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/Messages.kt
@@ -77,6 +77,7 @@ class Messages {
val ID = "id"
val COUNT = "count"
val COUNT_ONLY = "count_only"
+ val IDS_ONLY = "ids_only"
val OFFSET = "offset"
val LIMIT = "limit"
val INDEX = "index"
diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/WebSocketService.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/WebSocketService.kt
index 5c191ca42..cbf12357b 100644
--- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/WebSocketService.kt
+++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/WebSocketService.kt
@@ -330,6 +330,8 @@ class WebSocketService constructor(private val context: Context) {
subject.onError(ex)
}
+ subject.doOnDispose { cancelMessage(mrd.id) }
+
if (!intercepted) {
socket?.sendText(message.toString())
}
diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/model/IDataProvider.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/model/IDataProvider.kt
index ff48502e7..8f937e474 100644
--- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/model/IDataProvider.kt
+++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/websocket/model/IDataProvider.kt
@@ -22,6 +22,7 @@ interface IDataProvider {
fun getTracks(externalIds: Set): Observable