Add support for collapsed statuses to search results

This commit is contained in:
HellPie 2018-08-31 05:19:56 +02:00 committed by HellPie
parent 4dbed269f3
commit d64573de8c
1 changed files with 12 additions and 1 deletions

View File

@ -236,7 +236,18 @@ class SearchFragment : SFragment(), StatusActionListener, Injectable {
}
override fun onContentCollapsedChange(isCollapsed: Boolean, position: Int) {
TODO("not implemented")
// TODO: No out-of-bounds check in getConcreteStatusAtPosition
val status = searchAdapter.getConcreteStatusAtPosition(position)
if(status == null) {
Log.e(TAG, String.format("Tried to access status but got null at position: %d", position))
return
}
val updatedStatus = StatusViewData.Builder(status)
.setCollapsed(isCollapsed)
.createStatusViewData()
searchAdapter.updateStatusAtPosition(updatedStatus, position)
searchRecyclerView.post { searchAdapter.notifyItemChanged(position, updatedStatus) }
}
companion object {