Commit ca5a4af9 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix root tap on the breadcrumb for sub picking and in browser

parent 6e8d63bc
Pipeline #48667 passed with stage
in 2 minutes and 36 seconds
......@@ -179,6 +179,10 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
}
override fun backTo(tag: String) {
if (tag == "root") {
requireActivity().finish()
return
}
val supportFragmentManager = requireActivity().supportFragmentManager
var poped = false
for (i in 0 until supportFragmentManager.backStackEntryCount) {
......
......@@ -30,6 +30,7 @@ import android.os.Bundle
import android.view.View
import androidx.core.net.toUri
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.ViewModelProviders
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
......@@ -44,7 +45,6 @@ import org.videolan.vlc.R
import org.videolan.vlc.gui.ContentActivity
import org.videolan.vlc.repository.DirectoryRepository
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.isSchemeFile
import org.videolan.vlc.viewmodels.browser.BrowserModel
import org.videolan.vlc.viewmodels.browser.TYPE_PICKER
......@@ -92,6 +92,19 @@ class FilePickerFragment : FileBrowserFragment(), BrowserContainer<MediaLibraryI
}
override fun backTo(tag: String) {
if (tag == "root") {
val supportFragmentManager = requireActivity().supportFragmentManager
for (i in 0 until supportFragmentManager.backStackEntryCount) {
supportFragmentManager.popBackStack(tag, FragmentManager.POP_BACK_STACK_INCLUSIVE)
}
viewModel.setDestination(MLServiceLocator.getAbstractMediaWrapper(tag.toUri()))
supportFragmentManager.beginTransaction().detach(this).attach(this).commit()
return
}
super.backTo(tag)
}
override fun onImageClick(v: View, position: Int, item: MediaLibraryItem) {}
private fun pickFile(mw: MediaWrapper) {
......
......@@ -126,6 +126,7 @@ open class FileBrowserProvider(
}
loading.postValue(false)
}
url == "root" -> launch { browseRootImpl() }
else -> super.browse(url)
}
}
......
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