Safely show toasts in MusicService
This commit is contained in:
parent
cf4c773a67
commit
3aea91eb1e
1 changed files with 9 additions and 4 deletions
|
@ -796,7 +796,9 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
if (success) {
|
||||
play()
|
||||
} else {
|
||||
showToast(resources.getString(R.string.unplayable_file))
|
||||
runOnUiThread {
|
||||
showToast(R.string.unplayable_file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1205,12 +1207,16 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
openQueue(playlistSongs, 0, true)
|
||||
}
|
||||
} else {
|
||||
runOnUiThread {
|
||||
showToast(R.string.playlist_is_empty, Toast.LENGTH_LONG)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
runOnUiThread {
|
||||
showToast(R.string.playlist_is_empty, Toast.LENGTH_LONG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun prepareNext() {
|
||||
prepareNextImpl()
|
||||
|
@ -1355,7 +1361,6 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
const val REPEAT_MODE_NONE = 0
|
||||
const val REPEAT_MODE_ALL = 1
|
||||
const val REPEAT_MODE_THIS = 2
|
||||
const val SAVE_QUEUES = 0
|
||||
private const val MEDIA_SESSION_ACTIONS = (PlaybackStateCompat.ACTION_PLAY
|
||||
or PlaybackStateCompat.ACTION_PAUSE
|
||||
or PlaybackStateCompat.ACTION_PLAY_PAUSE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue