mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #4066 from Bnyro/master
Show nothing here indicator if home tab is empty
This commit is contained in:
commit
c09f470146
@ -4,6 +4,8 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.isGone
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
@ -91,6 +93,13 @@ class HomeFragment : Fragment() {
|
|||||||
async { if (visibleItems.contains(FEATURED)) loadFeed() },
|
async { if (visibleItems.contains(FEATURED)) loadFeed() },
|
||||||
async { if (visibleItems.contains(PLAYLISTS)) loadPlaylists() },
|
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) {
|
private fun makeVisible(vararg views: View) {
|
||||||
views.forEach {
|
views.forEach {
|
||||||
it.visibility = View.VISIBLE
|
it.isVisible = true
|
||||||
}
|
}
|
||||||
val binding = _binding ?: return
|
val binding = _binding ?: return
|
||||||
binding.progress.visibility = View.GONE
|
binding.progress.isGone = true
|
||||||
binding.scroll.visibility = View.VISIBLE
|
binding.scroll.isVisible = true
|
||||||
binding.refresh.isRefreshing = false
|
binding.refresh.isRefreshing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,4 +89,28 @@
|
|||||||
|
|
||||||
</com.github.libretube.ui.views.CustomSwipeToRefresh>
|
</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:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_list" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="@string/emptyList"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
@ -87,31 +87,28 @@
|
|||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:id="@+id/nothing_here"
|
android:id="@+id/nothing_here"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="35dp"
|
android:layout_marginBottom="35dp"
|
||||||
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/listIV"
|
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_list" />
|
android:src="@drawable/ic_list" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_like"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/listIV"
|
android:layout_gravity="center"
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/emptyList"
|
android:text="@string/emptyList"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/playlist_recView"
|
android:id="@+id/playlist_recView"
|
||||||
|
@ -14,33 +14,30 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:id="@+id/emptyFeed"
|
android:id="@+id/emptyFeed"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/boogh"
|
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_gravity="center"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:src="@drawable/ic_list" />
|
android:src="@drawable/ic_list" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textLike"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/boogh"
|
android:layout_gravity="center"
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginHorizontal="10dp"
|
android:layout_marginHorizontal="10dp"
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/emptyList"
|
android:text="@string/emptyList"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.github.libretube.ui.views.CustomSwipeToRefresh
|
<com.github.libretube.ui.views.CustomSwipeToRefresh
|
||||||
android:id="@+id/sub_refresh"
|
android:id="@+id/sub_refresh"
|
||||||
@ -147,8 +144,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginEnd="6dp"
|
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_edit" />
|
android:src="@drawable/ic_edit" />
|
||||||
|
|
||||||
@ -156,8 +153,8 @@
|
|||||||
android:id="@+id/channel_groups"
|
android:id="@+id/channel_groups"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:checkedChip="@id/chip_all"
|
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
|
app:checkedChip="@id/chip_all"
|
||||||
app:selectionRequired="true"
|
app:selectionRequired="true"
|
||||||
app:singleLine="true"
|
app:singleLine="true"
|
||||||
app:singleSelection="true">
|
app:singleSelection="true">
|
||||||
|
Loading…
Reference in New Issue
Block a user