[Android] AndroidTv: refresh ml after storage perm granted

Duncan McNamara git at videolan.org
Tue Jan 24 12:46:59 UTC 2023


vlc-android | branch: 3.5.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Jan 19 16:12:17 2023 +0100| [6daa6fdc93f193741aa9e640a1276d06e48b9afb] | committer: Nicolas Pomepuy

AndroidTv: refresh ml after storage perm granted

After granting storage permission, if calling activity is an instance
of CustomActionController, it will trigger onStorageAccessGranted
callback. Added implementation to MainTvActivity to trigger ML refresh
on storage permission granting so that the main ui doesn't stay stuck on
the request permission headers.


(cherry picked from commit b790c79469a31c0429db7fac2f9dde8b676fa546)

> https://code.videolan.org/videolan/vlc-android/commit/6daa6fdc93f193741aa9e640a1276d06e48b9afb
---

 .../src/main/java/org/videolan/television/ui/MainTvActivity.kt     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/MainTvActivity.kt b/application/television/src/main/java/org/videolan/television/ui/MainTvActivity.kt
index 801b3077c7..c5a7c0c5ba 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MainTvActivity.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MainTvActivity.kt
@@ -37,11 +37,12 @@ import org.videolan.tools.RESULT_RESTART_APP
 import org.videolan.tools.WeakHandler
 import org.videolan.vlc.ScanProgress
 import org.videolan.vlc.StartActivity
+import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate
 import org.videolan.vlc.reloadLibrary
 import org.videolan.vlc.util.Util
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
-class MainTvActivity : BaseTvActivity() {
+class MainTvActivity : BaseTvActivity(), StoragePermissionsDelegate.CustomActionController {
 
     private lateinit var browseFragment: MainTvFragment
     private lateinit var progressBar: ProgressBar
@@ -114,6 +115,10 @@ class MainTvActivity : BaseTvActivity() {
         handler.sendEmptyMessageDelayed(HIDE_LOADING, 500)
     }
 
+    override fun onStorageAccessGranted() {
+        refresh()
+    }
+
     override fun refresh() {
         this.reloadLibrary()
     }



More information about the Android mailing list