[Android] Fix IllegalStateException
Nicolas Pomepuy
git at videolan.org
Thu Oct 17 13:38:14 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Oct 17 07:54:19 2024 +0200| [e9667f39f40adceb0b4f886a7738463963eca879] | committer: Duncan McNamara
Fix IllegalStateException
> https://code.videolan.org/videolan/vlc-android/commit/e9667f39f40adceb0b4f886a7738463963eca879
---
.../vlc/gui/browser/BaseBrowserFragment.kt | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 8a9c68fcb9..619cc9478e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -198,17 +198,6 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
isRootDirectory = defineIsRoot()
browserFavRepository = BrowserFavRepository.getInstance(requireContext())
- lifecycleScope.launch(Dispatchers.Main) {
- viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
- needRefresh.observe(this at BaseBrowserFragment) {
-
- if (it) {
- viewModel.refreshMW()
- needRefresh.postValue(false)
- }
- }
- }
- }
}
private fun manageDisplay() {
@@ -288,6 +277,17 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
inCards = Settings.getInstance(requireActivity()).getBoolean(BROWSER_DISPLAY_IN_CARDS, false)
+ lifecycleScope.launch(Dispatchers.Main) {
+ viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
+ needRefresh.observe(viewLifecycleOwner) {
+
+ if (it) {
+ viewModel.refreshMW()
+ needRefresh.postValue(false)
+ }
+ }
+ }
+ }
}
override fun onDisplaySettingChanged(key: String, value: Any) {
More information about the Android
mailing list