Commit 512ff925 authored by Geoffrey Métais's avatar Geoffrey Métais

Disable pull-to-refresh on file browser root level

parent 39c5c199
......@@ -130,10 +130,13 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
layoutManager = LinearLayoutManager(activity)
binding.networkList.layoutManager = layoutManager
binding.networkList.adapter = adapter
mSwipeRefreshLayout.setOnRefreshListener(this)
registerSwiperRefreshlayout()
viewModel.dataset.observe(this, Observer<MutableList<MediaLibraryItem>> { mediaLibraryItems -> adapter.update(mediaLibraryItems!!) })
viewModel.getDescriptionUpdate().observe(this, Observer { pair -> if (pair != null) adapter.notifyItemChanged(pair.first, pair.second) })
}
open fun registerSwiperRefreshlayout() = mSwipeRefreshLayout.setOnRefreshListener(this)
override fun setBreadcrumb() {
val ariane = requireActivity().findViewById<RecyclerView>(R.id.ariane) ?: return
val media = currentMedia
......
......@@ -63,6 +63,12 @@ public class FileBrowserFragment extends BaseBrowserFragment {
setupBrowser();
}
@Override
public void registerSwiperRefreshlayout() {
if (!isRootDirectory()) super.registerSwiperRefreshlayout();
else mSwipeRefreshLayout.setEnabled(false);
}
protected void setupBrowser() {
if (isRootDirectory()) viewModel = ViewModelProviders.of(requireActivity(), new BrowserModel.Factory(requireContext(), null, BrowserModelKt.TYPE_FILE, getShowHiddenFiles())).get(BrowserModel.class);
else viewModel = ViewModelProviders.of(this, new BrowserModel.Factory(requireContext(), getMrl(), BrowserModelKt.TYPE_FILE, getShowHiddenFiles())).get(BrowserModel.class);
......
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