mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-31 07:09:53 +02:00
Fix initialize Paper for android auto
This commit is contained in:
parent
a69054fefa
commit
a06796d9ca
2 changed files with 9 additions and 7 deletions
|
@ -16,6 +16,8 @@ import kotlin.coroutines.suspendCoroutine
|
||||||
class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||||
val tag = "MediaManager"
|
val tag = "MediaManager"
|
||||||
|
|
||||||
|
var isPaperInitialized = false
|
||||||
|
|
||||||
var serverLibraryItems = listOf<LibraryItem>()
|
var serverLibraryItems = listOf<LibraryItem>()
|
||||||
var selectedLibraryId = ""
|
var selectedLibraryId = ""
|
||||||
|
|
||||||
|
@ -28,8 +30,11 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||||
var serverConfigIdUsed:String? = null
|
var serverConfigIdUsed:String? = null
|
||||||
|
|
||||||
fun initializeAndroidAuto() {
|
fun initializeAndroidAuto() {
|
||||||
Log.d(tag, "Android Auto started when MainActivity was never started - initializing Paper")
|
if (!isPaperInitialized) {
|
||||||
Paper.init(ctx)
|
Log.d(tag, "Android Auto started when MainActivity was never started - initializing Paper")
|
||||||
|
Paper.init(ctx)
|
||||||
|
isPaperInitialized = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIsLibrary(id:String) : Boolean {
|
fun getIsLibrary(id:String) : Boolean {
|
||||||
|
|
|
@ -701,11 +701,8 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
// No further calls will be made to other media browsing methods.
|
// No further calls will be made to other media browsing methods.
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
if (!isStarted) {
|
isStarted = true
|
||||||
Log.d(tag, "AA Not yet started")
|
mediaManager.initializeAndroidAuto()
|
||||||
mediaManager.initializeAndroidAuto()
|
|
||||||
isStarted = true
|
|
||||||
}
|
|
||||||
mediaManager.checkResetServerItems() // Reset any server items if no longer connected to server
|
mediaManager.checkResetServerItems() // Reset any server items if no longer connected to server
|
||||||
|
|
||||||
isAndroidAuto = true
|
isAndroidAuto = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue