reduced cursor moving call
This commit is contained in:
parent
d1dd995167
commit
5574067e08
|
@ -151,18 +151,11 @@ abstract class ParcelableStatusesAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isGapItem(position: Int): Boolean {
|
override fun isGapItem(position: Int): Boolean {
|
||||||
val dataPosition = position - statusStartIndex
|
return getFieldValue(position, { info ->
|
||||||
val statusCount = getStatusCount(false)
|
return@getFieldValue info.gap
|
||||||
if (dataPosition < 0 || dataPosition >= statusCount) return false
|
}, { status ->
|
||||||
// Don't show gap if it's last item
|
return@getFieldValue status.is_gap
|
||||||
if (dataPosition == statusCount - 1) return false
|
}, false)
|
||||||
if (data is ObjectCursor) {
|
|
||||||
val cursor = (data as ObjectCursor).cursor
|
|
||||||
if (!cursor.moveToPosition(dataPosition)) return false
|
|
||||||
val indices = (data as ObjectCursor).indices
|
|
||||||
return cursor.safeGetInt(indices[Statuses.IS_GAP]) == 1
|
|
||||||
}
|
|
||||||
return getStatus(position).is_gap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStatus(position: Int, raw: Boolean): ParcelableStatus {
|
override fun getStatus(position: Int, raw: Boolean): ParcelableStatus {
|
||||||
|
|
Loading…
Reference in New Issue