Commit 84e5f03d authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Nicolas Pomepuy
Browse files

Browser: Load network browser for network urls

Fix #1306,#1307
parent 4cfc8be5
Pipeline #17023 passed with stage
in 3 minutes and 59 seconds
...@@ -34,22 +34,28 @@ import com.google.android.material.appbar.AppBarLayout ...@@ -34,22 +34,28 @@ import com.google.android.material.appbar.AppBarLayout
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.videolan.medialibrary.interfaces.Medialibrary import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.resources.AndroidDevices import org.videolan.resources.AndroidDevices
import org.videolan.resources.KEY_FOLDER import org.videolan.resources.KEY_FOLDER
import org.videolan.resources.KEY_GROUP import org.videolan.resources.KEY_GROUP
import org.videolan.resources.util.applyOverscanMargin import org.videolan.resources.util.applyOverscanMargin
import org.videolan.tools.RESULT_RESCAN import org.videolan.tools.RESULT_RESCAN
import org.videolan.tools.RESULT_RESTART import org.videolan.tools.RESULT_RESTART
import org.videolan.tools.isValidUrl
import org.videolan.tools.removeFileProtocole
import org.videolan.vlc.R import org.videolan.vlc.R
import org.videolan.vlc.gui.audio.AudioAlbumsSongsFragment import org.videolan.vlc.gui.audio.AudioAlbumsSongsFragment
import org.videolan.vlc.gui.audio.AudioBrowserFragment import org.videolan.vlc.gui.audio.AudioBrowserFragment
import org.videolan.vlc.gui.browser.FileBrowserFragment import org.videolan.vlc.gui.browser.FileBrowserFragment
import org.videolan.vlc.gui.browser.KEY_MEDIA import org.videolan.vlc.gui.browser.KEY_MEDIA
import org.videolan.vlc.gui.browser.NetworkBrowserFragment
import org.videolan.vlc.gui.browser.StorageBrowserFragment import org.videolan.vlc.gui.browser.StorageBrowserFragment
import org.videolan.vlc.gui.helpers.UiTools import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.network.MRLPanelFragment import org.videolan.vlc.gui.network.MRLPanelFragment
import org.videolan.vlc.gui.video.VideoGridFragment import org.videolan.vlc.gui.video.VideoGridFragment
import org.videolan.vlc.reloadLibrary import org.videolan.vlc.reloadLibrary
import org.videolan.vlc.util.isSchemeNetwork
import org.videolan.vlc.util.validateLocation
@ExperimentalCoroutinesApi @ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi @ObsoleteCoroutinesApi
...@@ -155,9 +161,12 @@ class SecondaryActivity : ContentActivity() { ...@@ -155,9 +161,12 @@ class SecondaryActivity : ContentActivity() {
setResult(RESULT_RESTART) setResult(RESULT_RESTART)
} }
FILE_BROWSER -> { FILE_BROWSER -> {
fragment = FileBrowserFragment().apply { val media = intent.getParcelableExtra(KEY_MEDIA) as MediaWrapper
fragment = if(media.uri.scheme.isSchemeNetwork()) NetworkBrowserFragment()
else FileBrowserFragment()
fragment?.apply {
arguments = Bundle(2).apply { arguments = Bundle(2).apply {
putParcelable(KEY_MEDIA, intent.getParcelableExtra(KEY_MEDIA)) putParcelable(KEY_MEDIA, media)
} }
} }
} }
......
...@@ -28,7 +28,11 @@ import org.videolan.vlc.mediadb.models.BrowserFav ...@@ -28,7 +28,11 @@ import org.videolan.vlc.mediadb.models.BrowserFav
import java.io.File import java.io.File
fun isSchemeSupported(scheme: String?) = when(scheme) { fun isSchemeSupported(scheme: String?) = when(scheme) {
"file", "smb", "ssh", "nfs", "content" -> true "file", "smb", "ssh", "nfs", "ftp", "ftps", "content" -> true
else -> false
}
fun String?.isSchemeNetwork() = when(this) {
"smb", "ssh", "nfs", "ftp", "ftps" -> true
else -> false else -> false
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment