mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 06:13:54 +01:00
Swapped over to the ViewBinding version of adapterdelegates4 (#4687)
This commit is contained in:
parent
8168f454ed
commit
3dcd271980
6 changed files with 72 additions and 58 deletions
|
|
@ -1,18 +1,18 @@
|
|||
package fr.free.nrw.commons.notification
|
||||
|
||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateLayoutContainer
|
||||
import fr.free.nrw.commons.R
|
||||
import kotlinx.android.synthetic.main.activity_login.title
|
||||
import kotlinx.android.synthetic.main.item_notification.*
|
||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||
import fr.free.nrw.commons.databinding.ItemNotificationBinding
|
||||
import org.wikipedia.util.StringUtil
|
||||
|
||||
|
||||
fun notificationDelegate(onNotificationClicked: (Notification) -> Unit) =
|
||||
adapterDelegateLayoutContainer<Notification, Notification>(R.layout.item_notification) {
|
||||
containerView.setOnClickListener { onNotificationClicked(item) }
|
||||
adapterDelegateViewBinding<Notification, Notification, ItemNotificationBinding>({ layoutInflater, parent ->
|
||||
ItemNotificationBinding.inflate(layoutInflater, parent, false)
|
||||
}) {
|
||||
binding.root.setOnClickListener { onNotificationClicked(item) }
|
||||
bind {
|
||||
title.text = item.processedNotificationText
|
||||
time.text = item.date
|
||||
binding.title.text = item.processedNotificationText
|
||||
binding.time.text = item.date
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue