[Android] Fix CalledFromWrongThreadException
Nicolas Pomepuy
git at videolan.org
Mon Sep 23 18:10:23 CEST 2019
vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Sep 11 08:18:21 2019 +0200| [70ae39663c445b081f55ad44006f2621fb10bec4] | committer: Geoffrey Métais
Fix CalledFromWrongThreadException
(cherry picked from commit 25f8fb78d0028f4719acf5fa971eb6c90202ffe2)
> https://code.videolan.org/videolan/vlc-android/commit/70ae39663c445b081f55ad44006f2621fb10bec4
---
.../src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
index e18195b58..055208a74 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
@@ -196,8 +196,10 @@ class FileBrowserTvFragment : BaseBrowserTvFragment(), PathAdapterListener {
else -> browserFavRepository.addNetworkFavItem(mw.uri, mw.title, mw.artworkURL)
}
favExists = !favExists
- binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv else R.drawable.ic_menu_not_fav_tv)
- binding.imageButtonFavorite.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv_normal else R.drawable.ic_menu_not_fav_tv_normal)
+ withContext(Dispatchers.Main) {
+ binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv else R.drawable.ic_menu_not_fav_tv)
+ binding.imageButtonFavorite.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv_normal else R.drawable.ic_menu_not_fav_tv_normal)
+ }
}
}
}
More information about the Android
mailing list