mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00: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)
|
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter)
|
||||||
feedGroupsSortMenuItem = HeaderWithMenuItem(
|
feedGroupsSortMenuItem = HeaderWithMenuItem(
|
||||||
getString(R.string.feed_groups_header_title),
|
getString(R.string.feed_groups_header_title),
|
||||||
|
R.drawable.ic_list,
|
||||||
R.drawable.ic_sort,
|
R.drawable.ic_sort,
|
||||||
menuItemOnClickListener = ::openReorderDialog
|
menuItemOnClickListener = ::openReorderDialog
|
||||||
)
|
)
|
||||||
|
@ -11,8 +11,10 @@ import org.schabi.newpipe.databinding.HeaderWithMenuItemBinding
|
|||||||
class HeaderWithMenuItem(
|
class HeaderWithMenuItem(
|
||||||
val title: String,
|
val title: String,
|
||||||
@DrawableRes val itemIcon: Int = 0,
|
@DrawableRes val itemIcon: Int = 0,
|
||||||
|
@DrawableRes val itemIconListView: Int = 0,
|
||||||
var showMenuItem: Boolean = true,
|
var showMenuItem: Boolean = true,
|
||||||
private val onClickListener: (() -> Unit)? = null,
|
private val onClickListener: (() -> Unit)? = null,
|
||||||
|
private val onClickListenerListView: (() -> Unit)? = null,
|
||||||
private val menuItemOnClickListener: (() -> Unit)? = null
|
private val menuItemOnClickListener: (() -> Unit)? = null
|
||||||
) : BindableItem<HeaderWithMenuItemBinding>() {
|
) : BindableItem<HeaderWithMenuItemBinding>() {
|
||||||
companion object {
|
companion object {
|
||||||
@ -32,11 +34,15 @@ class HeaderWithMenuItem(
|
|||||||
|
|
||||||
override fun bind(viewBinding: HeaderWithMenuItemBinding, position: Int) {
|
override fun bind(viewBinding: HeaderWithMenuItemBinding, position: Int) {
|
||||||
viewBinding.headerTitle.text = title
|
viewBinding.headerTitle.text = title
|
||||||
viewBinding.headerMenuItem.setImageResource(itemIcon)
|
viewBinding.headerMenuItem2.setImageResource(itemIcon)
|
||||||
|
viewBinding.headerMenuItem.setImageResource(itemIconListView)
|
||||||
|
|
||||||
val listener = onClickListener?.let { OnClickListener { onClickListener.invoke() } }
|
val listener = onClickListener?.let { OnClickListener { onClickListener.invoke() } }
|
||||||
viewBinding.root.setOnClickListener(listener)
|
viewBinding.root.setOnClickListener(listener)
|
||||||
|
|
||||||
|
val listenerListView = onClickListenerListView?.let { OnClickListener { onClickListenerListView.invoke() } }
|
||||||
|
viewBinding.root.setOnClickListener(listenerListView)
|
||||||
|
|
||||||
val menuItemListener = menuItemOnClickListener?.let { OnClickListener { menuItemOnClickListener.invoke() } }
|
val menuItemListener = menuItemOnClickListener?.let { OnClickListener { menuItemOnClickListener.invoke() } }
|
||||||
viewBinding.headerMenuItem.setOnClickListener(menuItemListener)
|
viewBinding.headerMenuItem.setOnClickListener(menuItemListener)
|
||||||
updateMenuItemVisibility(viewBinding)
|
updateMenuItemVisibility(viewBinding)
|
||||||
|
@ -22,6 +22,14 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="Header" />
|
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
|
<ImageButton
|
||||||
android:id="@+id/header_menu_item"
|
android:id="@+id/header_menu_item"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user