A few more minor Kotlin cleanups.

This commit is contained in:
casey langen 2017-07-05 17:52:20 -07:00
parent ab58993c0f
commit dae40fba2a
2 changed files with 16 additions and 11 deletions

View File

@ -14,7 +14,10 @@ import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.*
import android.widget.CheckBox
import android.widget.CompoundButton
import android.widget.SeekBar
import android.widget.TextView
import io.casey.musikcube.remote.playback.PlaybackService
import io.casey.musikcube.remote.playback.PlaybackState
import io.casey.musikcube.remote.playback.RepeatMode

View File

@ -771,20 +771,21 @@ class StreamingPlaybackService(context: Context) : PlaybackService {
override val playlistQueryFactory: TrackListSlidingWindow.QueryFactory = object : TrackListSlidingWindow.QueryFactory() {
override fun getRequeryMessage(): SocketMessage? {
val params = params
if (params != null) {
if (Strings.notEmpty(params?.category) && (params?.categoryId ?: -1) >= 0) {
if (Strings.notEmpty(params.category) && (params.categoryId >= 0)) {
return SocketMessage.Builder
.request(Messages.Request.QueryTracksByCategory)
.addOption(Messages.Key.CATEGORY, params?.category)
.addOption(Messages.Key.ID, params?.categoryId)
.addOption(Messages.Key.FILTER, params?.filter)
.addOption(Messages.Key.CATEGORY, params.category)
.addOption(Messages.Key.ID, params.categoryId)
.addOption(Messages.Key.FILTER, params.filter)
.addOption(Messages.Key.COUNT_ONLY, true)
.build()
}
else {
return SocketMessage.Builder
.request(Messages.Request.QueryTracks)
.addOption(Messages.Key.FILTER, params?.filter)
.addOption(Messages.Key.FILTER, params.filter)
.addOption(Messages.Key.COUNT_ONLY, true)
.build()
}
@ -794,13 +795,14 @@ class StreamingPlaybackService(context: Context) : PlaybackService {
}
override fun getPageAroundMessage(offset: Int, limit: Int): SocketMessage? {
val params = params
if (params != null) {
if (Strings.notEmpty(params?.category) && (params?.categoryId ?: -1) >= 0) {
if (Strings.notEmpty(params.category) && (params.categoryId >= 0)) {
return SocketMessage.Builder
.request(Messages.Request.QueryTracksByCategory)
.addOption(Messages.Key.CATEGORY, params?.category)
.addOption(Messages.Key.ID, params?.categoryId)
.addOption(Messages.Key.FILTER, params?.filter)
.addOption(Messages.Key.CATEGORY, params.category)
.addOption(Messages.Key.ID, params.categoryId)
.addOption(Messages.Key.FILTER, params.filter)
.addOption(Messages.Key.LIMIT, limit)
.addOption(Messages.Key.OFFSET, offset)
.build()
@ -808,7 +810,7 @@ class StreamingPlaybackService(context: Context) : PlaybackService {
else {
return SocketMessage.Builder
.request(Messages.Request.QueryTracks)
.addOption(Messages.Key.FILTER, params?.filter)
.addOption(Messages.Key.FILTER, params.filter)
.addOption(Messages.Key.LIMIT, limit)
.addOption(Messages.Key.OFFSET, offset)
.build()