1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Created a button in SubscriptionFragment.kt that reads whether button is clicked

This commit is contained in:
Samuel Wu 2022-10-24 16:55:12 +11:00
parent 8482bf9fed
commit 29e56b9f2d
2 changed files with 8 additions and 3 deletions

View File

@ -221,6 +221,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
FeedGroupReorderDialog().show(parentFragmentManager, null)
}
private fun temp() {
println("This button is clicked")
}
private fun requestExportResult(result: ActivityResult) {
if (result.data != null && result.resultCode == Activity.RESULT_OK) {
activity.startService(
@ -271,6 +275,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
getString(R.string.feed_groups_header_title),
R.drawable.ic_list,
R.drawable.ic_sort,
listViewOnClickListener = ::temp,
menuItemOnClickListener = ::openReorderDialog
)
add(Section(feedGroupsSortMenuItem, listOf(feedGroupsCarousel)))

View File

@ -14,7 +14,7 @@ class HeaderWithMenuItem(
@DrawableRes val itemIconListView: Int = 0,
var showMenuItem: Boolean = true,
private val onClickListener: (() -> Unit)? = null,
private val onClickListenerListView: (() -> Unit)? = null,
private val listViewOnClickListener: (() -> Unit)? = null,
private val menuItemOnClickListener: (() -> Unit)? = null
) : BindableItem<HeaderWithMenuItemBinding>() {
companion object {
@ -40,8 +40,8 @@ class HeaderWithMenuItem(
val listener = onClickListener?.let { OnClickListener { onClickListener.invoke() } }
viewBinding.root.setOnClickListener(listener)
val listenerListView = onClickListenerListView?.let { OnClickListener { onClickListenerListView.invoke() } }
viewBinding.root.setOnClickListener(listenerListView)
val listViewListener = listViewOnClickListener?.let { OnClickListener { listViewOnClickListener.invoke() } }
viewBinding.headerMenuItem2.setOnClickListener(listViewListener)
val menuItemListener = menuItemOnClickListener?.let { OnClickListener { menuItemOnClickListener.invoke() } }
viewBinding.headerMenuItem.setOnClickListener(menuItemListener)