mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
make drawable optional
This commit is contained in:
parent
45c04a0af6
commit
437438fd56
@ -1,6 +1,7 @@
|
|||||||
package com.github.libretube.adapters
|
package com.github.libretube.adapters
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.databinding.BottomSheetItemBinding
|
import com.github.libretube.databinding.BottomSheetItemBinding
|
||||||
@ -23,7 +24,7 @@ class BottomSheetAdapter(
|
|||||||
val item = items[position]
|
val item = items[position]
|
||||||
holder.binding.apply {
|
holder.binding.apply {
|
||||||
title.text = if (item.currentValue != null) "${item.title} (${item.currentValue})" else item.title
|
title.text = if (item.currentValue != null) "${item.title} (${item.currentValue})" else item.title
|
||||||
drawable.setImageResource(item.drawable)
|
if (item.drawable != null) drawable.setImageResource(item.drawable) else drawable.visibility = View.GONE
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
listener.invoke(position)
|
listener.invoke(position)
|
||||||
|
@ -110,10 +110,7 @@ class SubscriptionsFragment : BaseFragment() {
|
|||||||
val sortOptionValues = resources.getStringArray(R.array.sortOptionsValues)
|
val sortOptionValues = resources.getStringArray(R.array.sortOptionsValues)
|
||||||
val items = mutableListOf<BottomSheetItem>()
|
val items = mutableListOf<BottomSheetItem>()
|
||||||
sortOptions.forEach {
|
sortOptions.forEach {
|
||||||
items += BottomSheetItem(
|
items += BottomSheetItem(it)
|
||||||
it,
|
|
||||||
R.drawable.ic_arrow_down
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val bottomSheet = BottomSheet().apply {
|
val bottomSheet = BottomSheet().apply {
|
||||||
|
@ -2,6 +2,6 @@ package com.github.libretube.obj
|
|||||||
|
|
||||||
data class BottomSheetItem(
|
data class BottomSheetItem(
|
||||||
val title: String,
|
val title: String,
|
||||||
val drawable: Int,
|
val drawable: Int? = null,
|
||||||
val currentValue: String? = null
|
val currentValue: String? = null
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
android:id="@+id/drawable"
|
android:id="@+id/drawable"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="10dp"
|
||||||
tools:src="@drawable/ic_download" />
|
tools:src="@drawable/ic_download" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
Loading…
x
Reference in New Issue
Block a user