mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
bugfix on lib startup
This commit is contained in:
parent
c1b5f5c128
commit
e1d4a46309
1 changed files with 20 additions and 17 deletions
|
@ -1112,23 +1112,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
|
||||
MainAPI.settingsForProvider = settingsForProvider
|
||||
|
||||
// Change library icon with logo of current api in sync
|
||||
libraryViewModel = ViewModelProvider(this)[LibraryViewModel::class.java]
|
||||
libraryViewModel?.currentApiName?.observe(this) {
|
||||
val syncAPI = libraryViewModel?.currentSyncApi
|
||||
Log.i("SYNC_API", "${syncAPI?.name}, ${syncAPI?.idPrefix}")
|
||||
val icon = if (syncAPI?.idPrefix == localListApi.idPrefix) {
|
||||
R.drawable.library_icon
|
||||
} else {
|
||||
syncAPI?.icon ?: R.drawable.library_icon
|
||||
}
|
||||
|
||||
binding?.apply {
|
||||
navRailView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||
navView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||
}
|
||||
}
|
||||
|
||||
loadThemes(this)
|
||||
updateLocale()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -1538,6 +1521,26 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
logError(e)
|
||||
}
|
||||
}
|
||||
|
||||
// we need to run this after we init all apis, otherwise currentSyncApi will fuck itself
|
||||
this@MainActivity.runOnUiThread {
|
||||
// Change library icon with logo of current api in sync
|
||||
libraryViewModel = ViewModelProvider(this@MainActivity)[LibraryViewModel::class.java]
|
||||
libraryViewModel?.currentApiName?.observe(this@MainActivity) {
|
||||
val syncAPI = libraryViewModel?.currentSyncApi
|
||||
Log.i("SYNC_API", "${syncAPI?.name}, ${syncAPI?.idPrefix}")
|
||||
val icon = if (syncAPI?.idPrefix == localListApi.idPrefix) {
|
||||
R.drawable.library_icon
|
||||
} else {
|
||||
syncAPI?.icon ?: R.drawable.library_icon
|
||||
}
|
||||
|
||||
binding?.apply {
|
||||
navRailView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||
navView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SearchResultBuilder.updateCache(this)
|
||||
|
|
Loading…
Reference in a new issue