mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Show nothing here indicator if home tab is empty
This commit is contained in:
parent
2e56db0219
commit
4e001d881c
@ -4,6 +4,8 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@ -91,6 +93,13 @@ class HomeFragment : Fragment() {
|
||||
async { if (visibleItems.contains(FEATURED)) loadFeed() },
|
||||
async { if (visibleItems.contains(PLAYLISTS)) loadPlaylists() },
|
||||
)
|
||||
|
||||
val binding = _binding ?: return@repeatOnLifecycle
|
||||
// No category is shown because they are either empty or disabled
|
||||
if (binding.progress.isVisible) {
|
||||
binding.progress.isGone = true
|
||||
binding.nothingHere.isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,11 +199,11 @@ class HomeFragment : Fragment() {
|
||||
|
||||
private fun makeVisible(vararg views: View) {
|
||||
views.forEach {
|
||||
it.visibility = View.VISIBLE
|
||||
it.isVisible = true
|
||||
}
|
||||
val binding = _binding ?: return
|
||||
binding.progress.visibility = View.GONE
|
||||
binding.scroll.visibility = View.VISIBLE
|
||||
binding.progress.isGone = true
|
||||
binding.scroll.isVisible = true
|
||||
binding.refresh.isRefreshing = false
|
||||
}
|
||||
|
||||
|
@ -89,4 +89,27 @@
|
||||
|
||||
</com.github.libretube.ui.views.CustomSwipeToRefresh>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/nothing_here"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/listIV"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/ic_list" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/emptyList"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user