mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Selection state should be tested through room id
This commit is contained in:
parent
7dc7b4b8eb
commit
e06d95b8e3
3 changed files with 7 additions and 6 deletions
|
@ -79,7 +79,7 @@ class RoomListFragment : RiotFragment(), RoomSummaryController.Callback {
|
|||
|
||||
override fun onRoomSelected(room: RoomSummary) {
|
||||
withState(viewModel) {
|
||||
if (it.selectedRoom != room) {
|
||||
if (it.selectedRoom?.roomId != room.roomId) {
|
||||
viewModel.accept(RoomListActions.SelectRoom(room))
|
||||
homeNavigator.openRoomDetail(room.roomId)
|
||||
}
|
||||
|
|
|
@ -7,14 +7,15 @@ import im.vector.matrix.android.api.session.room.model.RoomSummary
|
|||
|
||||
data class RoomListViewState(
|
||||
val roomSummaries: Async<List<RoomSummary>> = Uninitialized,
|
||||
val selectedRoom: RoomSummary? = null
|
||||
val selectedRoom: RoomSummary? = null,
|
||||
private var _showLastSelectedRoom: Boolean = true
|
||||
) : MvRxState {
|
||||
|
||||
var showLastSelectedRoom: Boolean = true
|
||||
var showLastSelectedRoom: Boolean = _showLastSelectedRoom
|
||||
private set
|
||||
get() {
|
||||
if (field) {
|
||||
field = false
|
||||
if (_showLastSelectedRoom) {
|
||||
_showLastSelectedRoom = false
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -15,7 +15,7 @@ class RoomSummaryController(private val context: Context,
|
|||
RoomSummaryItem(
|
||||
title = it.displayName,
|
||||
avatarDrawable = roomSummaryViewHelper.avatarDrawable(context),
|
||||
isSelected = it == selected,
|
||||
isSelected = it.roomId == selected?.roomId,
|
||||
listener = { callback?.onRoomSelected(it) }
|
||||
)
|
||||
.id(it.roomId)
|
||||
|
|
Loading…
Reference in a new issue