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