[Android] Add the dialog listener to the More fragment for stream authentication
Nicolas Pomepuy
git at videolan.org
Tue May 18 04:19:27 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May 17 10:25:30 2021 +0200| [9046c298f35b041e67b1450517aa4560ac920f7d] | committer: Nicolas Pomepuy
Add the dialog listener to the More fragment for stream authentication
Fixes #2016
> https://code.videolan.org/videolan/vlc-android/commit/9046c298f35b041e67b1450517aa4560ac920f7d
---
.../vlc-android/src/org/videolan/vlc/gui/MoreFragment.kt | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/MoreFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/MoreFragment.kt
index 91084f4e0..34acc3081 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/MoreFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/MoreFragment.kt
@@ -36,6 +36,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.onEach
+import org.videolan.libvlc.Dialog
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.resources.ACTIVITY_RESULT_PREFERENCES
@@ -56,6 +57,8 @@ import org.videolan.vlc.interfaces.IHistory
import org.videolan.vlc.interfaces.IRefreshable
import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.media.PlaylistManager
+import org.videolan.vlc.util.DialogDelegate
+import org.videolan.vlc.util.IDialogManager
import org.videolan.vlc.util.launchWhenStarted
import org.videolan.vlc.viewmodels.HistoryModel
import org.videolan.vlc.viewmodels.StreamsModel
@@ -65,7 +68,7 @@ private const val KEY_SELECTION = "key_selection"
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
-class MoreFragment : BaseFragment(), IRefreshable, IHistory,
+class MoreFragment : BaseFragment(), IRefreshable, IHistory, IDialogManager,
IStreamsFragmentDelegate by StreamsFragmentDelegate() {
private lateinit var streamsAdapter: MRLAdapter
@@ -78,10 +81,12 @@ class MoreFragment : BaseFragment(), IRefreshable, IHistory,
override fun hasFAB() = false
fun getMultiHelper(): MultiSelectHelper<HistoryModel>? = historyAdapter.multiSelectHelper as? MultiSelectHelper<HistoryModel>
private var savedSelection = ArrayList<Int>()
+ private val dialogsDelegate = DialogDelegate()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(savedInstanceState?.getIntegerArrayList(KEY_SELECTION))?.let { savedSelection = it }
+ dialogsDelegate.observeDialogs(this, this)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@@ -294,4 +299,11 @@ class MoreFragment : BaseFragment(), IRefreshable, IHistory,
if (actionMode == null) startActionMode()
invalidateActionMode()
}
+
+ override fun fireDialog(dialog: Dialog) {
+ DialogActivity.dialog = dialog
+ startActivity(Intent(DialogActivity.KEY_DIALOG, null, requireActivity(), DialogActivity::class.java))
+ }
+
+ override fun dialogCanceled(dialog: Dialog?) { }
}
More information about the Android
mailing list