2016-08-21 15:30:07 +02:00
|
|
|
package org.mariotaku.ktextension
|
|
|
|
|
2020-01-26 08:35:15 +01:00
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2016-08-21 15:30:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by mariotaku on 16/8/21.
|
|
|
|
*/
|
|
|
|
fun RecyclerView.Adapter<*>.findPositionByItemId(itemId: Long): Int {
|
2020-06-08 23:01:17 +02:00
|
|
|
return (0 until itemCount).firstOrNull { getItemId(it) == itemId } ?: RecyclerView.NO_POSITION
|
2016-08-21 15:30:07 +02:00
|
|
|
}
|