mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-02 06:50:13 +01:00
Created a list view for channel group.
This commit is contained in:
parent
29e56b9f2d
commit
78547b4fa4
@ -26,7 +26,7 @@ class FeedGroupCarouselDecoration(context: Context) : RecyclerView.ItemDecoratio
|
|||||||
|
|
||||||
outRect.set(marginBetweenItems, marginTopBottom, 0, marginTopBottom)
|
outRect.set(marginBetweenItems, marginTopBottom, 0, marginTopBottom)
|
||||||
|
|
||||||
if (childAdapterPosition == 0) {
|
if (childAdapterPosition >= 0) {
|
||||||
outRect.left = marginStartEnd
|
outRect.left = marginStartEnd
|
||||||
} else if (childAdapterPosition == childAdapterCount - 1) {
|
} else if (childAdapterPosition == childAdapterCount - 1) {
|
||||||
outRect.right = marginStartEnd
|
outRect.right = marginStartEnd
|
||||||
|
@ -21,7 +21,7 @@ data class FeedGroupCardItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayout(): Int = R.layout.feed_group_card_item
|
override fun getLayout(): Int = R.layout.feed_group_list_item
|
||||||
|
|
||||||
override fun bind(viewBinding: FeedGroupCardItemBinding, position: Int) {
|
override fun bind(viewBinding: FeedGroupCardItemBinding, position: Int) {
|
||||||
viewBinding.title.text = name
|
viewBinding.title.text = name
|
||||||
|
@ -36,7 +36,7 @@ class FeedGroupCarouselItem(
|
|||||||
override fun initializeViewBinding(view: View): FeedItemCarouselBinding {
|
override fun initializeViewBinding(view: View): FeedItemCarouselBinding {
|
||||||
val viewHolder = FeedItemCarouselBinding.bind(view)
|
val viewHolder = FeedItemCarouselBinding.bind(view)
|
||||||
|
|
||||||
linearLayoutManager = LinearLayoutManager(view.context, RecyclerView.HORIZONTAL, false)
|
linearLayoutManager = LinearLayoutManager(view.context, RecyclerView.VERTICAL, false)
|
||||||
|
|
||||||
viewHolder.recyclerView.apply {
|
viewHolder.recyclerView.apply {
|
||||||
layoutManager = linearLayoutManager
|
layoutManager = linearLayoutManager
|
||||||
|
43
app/src/main/res/layout/feed_group_list_item.xml
Normal file
43
app/src/main/res/layout/feed_group_list_item.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackground"
|
||||||
|
app:cardBackgroundColor="?attr/card_item_background_color">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="51dp"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
|
tools:src="@drawable/ic_fastfood" />
|
||||||
|
|
||||||
|
<org.schabi.newpipe.views.NewPipeTextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="start"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="?attr/colorAccent"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="ALL" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
Loading…
Reference in New Issue
Block a user