mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-01 22:41:56 +01:00
Created a non-functional button in HeaderWithMenuItem.kt
This commit is contained in:
parent
2a98cca801
commit
8482bf9fed
@ -269,6 +269,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
||||
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter)
|
||||
feedGroupsSortMenuItem = HeaderWithMenuItem(
|
||||
getString(R.string.feed_groups_header_title),
|
||||
R.drawable.ic_list,
|
||||
R.drawable.ic_sort,
|
||||
menuItemOnClickListener = ::openReorderDialog
|
||||
)
|
||||
|
@ -11,8 +11,10 @@ import org.schabi.newpipe.databinding.HeaderWithMenuItemBinding
|
||||
class HeaderWithMenuItem(
|
||||
val title: String,
|
||||
@DrawableRes val itemIcon: Int = 0,
|
||||
@DrawableRes val itemIconListView: Int = 0,
|
||||
var showMenuItem: Boolean = true,
|
||||
private val onClickListener: (() -> Unit)? = null,
|
||||
private val onClickListenerListView: (() -> Unit)? = null,
|
||||
private val menuItemOnClickListener: (() -> Unit)? = null
|
||||
) : BindableItem<HeaderWithMenuItemBinding>() {
|
||||
companion object {
|
||||
@ -32,11 +34,15 @@ class HeaderWithMenuItem(
|
||||
|
||||
override fun bind(viewBinding: HeaderWithMenuItemBinding, position: Int) {
|
||||
viewBinding.headerTitle.text = title
|
||||
viewBinding.headerMenuItem.setImageResource(itemIcon)
|
||||
viewBinding.headerMenuItem2.setImageResource(itemIcon)
|
||||
viewBinding.headerMenuItem.setImageResource(itemIconListView)
|
||||
|
||||
val listener = onClickListener?.let { OnClickListener { onClickListener.invoke() } }
|
||||
viewBinding.root.setOnClickListener(listener)
|
||||
|
||||
val listenerListView = onClickListenerListView?.let { OnClickListener { onClickListenerListView.invoke() } }
|
||||
viewBinding.root.setOnClickListener(listenerListView)
|
||||
|
||||
val menuItemListener = menuItemOnClickListener?.let { OnClickListener { menuItemOnClickListener.invoke() } }
|
||||
viewBinding.headerMenuItem.setOnClickListener(menuItemListener)
|
||||
updateMenuItemVisibility(viewBinding)
|
||||
|
@ -22,6 +22,14 @@
|
||||
android:textStyle="bold"
|
||||
tools:text="Header" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/header_menu_item2"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
tools:src="@drawable/ic_bookmark" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/header_menu_item"
|
||||
android:layout_width="24dp"
|
||||
|
Loading…
Reference in New Issue
Block a user