Commit 4b24528f authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais
Browse files

TV file browser empty view

parent 0b1e6cdd
......@@ -10,6 +10,10 @@
<variable
name="loading"
type="boolean" />
<variable
name="empty"
type="boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -18,6 +22,24 @@
android:layout_height="match_parent"
tools:theme="@style/Theme.VLC.TV">
<TextView
android:id="@+id/textview_nomedia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/default_margin"
android:drawableTop="@drawable/ic_no_media"
android:drawablePadding="@dimen/default_margin"
android:gravity="center"
android:maxWidth="600dp"
android:text="@string/nomedia"
android:textSize="22sp"
android:visibility="@{empty ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintBottom_toBottomOf="@+id/list"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<FrameLayout
android:id="@+id/headerListContainer"
android:layout_width="match_parent"
......
......@@ -90,6 +90,7 @@ abstract class BaseBrowserTvFragment : Fragment(), BrowserFragmentInterface, IEv
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = SongBrowserBinding.inflate(inflater, container, false)
binding.empty = false
return binding.root
}
......
......@@ -34,7 +34,10 @@ import org.videolan.vlc.util.CATEGORY
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.ITEM
import org.videolan.vlc.util.isSchemeSupported
import org.videolan.vlc.viewmodels.browser.*
import org.videolan.vlc.viewmodels.browser.BrowserModel
import org.videolan.vlc.viewmodels.browser.NetworkModel
import org.videolan.vlc.viewmodels.browser.TYPE_FILE
import org.videolan.vlc.viewmodels.browser.TYPE_NETWORK
private const val TAG = "FileBrowserTvFragment"
@UseExperimental(ObsoleteCoroutinesApi::class)
......@@ -108,6 +111,7 @@ class FileBrowserTvFragment : BaseBrowserTvFragment(), PathAdapterListener {
}
}
}
binding.empty = if (isRootLevel && getCategory() == TYPE_NETWORK) false else items.isEmpty()
if (BuildConfig.DEBUG) Log.d(TAG, "Submit list of ${items.size} items")
if (BuildConfig.DEBUG) Log.d(TAG, "header size: ${viewModel.provider.headers.size()}")
......
......@@ -74,6 +74,8 @@ class MediaBrowserTvFragment : BaseBrowserTvFragment() {
(viewModel.provider as MedialibraryProvider<*>).pagedList.observe(this, Observer { items ->
submitList(items)
binding.empty = items.isEmpty()
//headers
val nbColumns = if ((viewModel as MediaBrowserViewModel).sort == AbstractMedialibrary.SORT_ALPHA || (viewModel as MediaBrowserViewModel).sort == AbstractMedialibrary.SORT_DEFAULT) 9 else 1
......
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