update Commons with some recyclerview improvements
This commit is contained in:
parent
b642561616
commit
aa04c74ae0
5 changed files with 13 additions and 17 deletions
|
@ -47,7 +47,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.0.3'
|
||||
implementation 'com.simplemobiletools:commons:3.0.5'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.android.support:multidex:1.0.2'
|
||||
|
|
|
@ -49,8 +49,8 @@ class DayEventsAdapter(activity: SimpleActivity, val events: List<Event>, val li
|
|||
|
||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||
val event = events[position]
|
||||
val view = holder.bindView(event) {
|
||||
setupView(it, event)
|
||||
val view = holder.bindView(event) { itemView, layoutPosition ->
|
||||
setupView(itemView, event)
|
||||
}
|
||||
bindViewHolder(holder, position, view)
|
||||
}
|
||||
|
|
|
@ -62,11 +62,11 @@ class EventListAdapter(activity: SimpleActivity, val listItems: List<ListItem>,
|
|||
|
||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||
val listItem = listItems[position]
|
||||
val view = holder.bindView(listItem, allowLongClick) {
|
||||
val view = holder.bindView(listItem, allowLongClick) { itemView, layoutPosition ->
|
||||
if (listItem is ListSection) {
|
||||
setupListSection(it, listItem, position)
|
||||
setupListSection(itemView, listItem, position)
|
||||
} else if (listItem is ListEvent) {
|
||||
setupListEvent(it, listItem)
|
||||
setupListEvent(itemView, listItem)
|
||||
}
|
||||
}
|
||||
bindViewHolder(holder, position, view)
|
||||
|
|
|
@ -45,8 +45,8 @@ class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: List<Eve
|
|||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val eventType = eventTypes[position]
|
||||
val view = holder.bindView(eventType) {
|
||||
setupView(it, eventType)
|
||||
val view = holder.bindView(eventType) { itemView, layoutPosition ->
|
||||
setupView(itemView, eventType)
|
||||
}
|
||||
bindViewHolder(holder, position, view)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.res.Resources
|
|||
import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.support.v7.widget.DividerItemDecoration
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -138,15 +137,12 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DeleteEventsListen
|
|||
if (activity == null)
|
||||
return
|
||||
|
||||
val eventsAdapter = DayEventsAdapter(activity as SimpleActivity, events, this, mHolder.day_events) {
|
||||
DayEventsAdapter(activity as SimpleActivity, events, this, mHolder.day_events) {
|
||||
editEvent(it as Event)
|
||||
}
|
||||
eventsAdapter.setupDragListener(true)
|
||||
|
||||
mHolder.day_events.adapter = eventsAdapter
|
||||
DividerItemDecoration(context, DividerItemDecoration.VERTICAL).apply {
|
||||
setDrawable(context!!.resources.getDrawable(R.drawable.divider))
|
||||
mHolder.day_events.addItemDecoration(this)
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
addVerticalDividers(true)
|
||||
mHolder.day_events.adapter = this
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue