Commit 91d8ee2a authored by Valere's avatar Valere
Browse files

Space panel room ordering

parent f9820cde
...@@ -43,6 +43,8 @@ class SpaceSummaryController @Inject constructor( ...@@ -43,6 +43,8 @@ class SpaceSummaryController @Inject constructor(
var callback: Callback? = null var callback: Callback? = null
private var viewState: SpaceListViewState? = null private var viewState: SpaceListViewState? = null
private val subSpaceComparator: Comparator<SpaceChildInfo> = compareBy<SpaceChildInfo> { it.order }.thenBy { it.childRoomId }
init { init {
requestModelBuild() requestModelBuild()
} }
...@@ -132,13 +134,13 @@ class SpaceSummaryController @Inject constructor( ...@@ -132,13 +134,13 @@ class SpaceSummaryController @Inject constructor(
} }
rootSpaces rootSpaces
?.sortedBy { it.displayName } ?.sortedBy { it.roomId }
?.forEach { groupSummary -> ?.forEach { groupSummary ->
val isSelected = selected is RoomGroupingMethod.BySpace && groupSummary.roomId == selected.space()?.roomId val isSelected = selected is RoomGroupingMethod.BySpace && groupSummary.roomId == selected.space()?.roomId
// does it have children? // does it have children?
val subSpaces = groupSummary.spaceChildren?.filter { childInfo -> val subSpaces = groupSummary.spaceChildren?.filter { childInfo ->
summaries?.indexOfFirst { it.roomId == childInfo.childRoomId } != -1 summaries?.indexOfFirst { it.roomId == childInfo.childRoomId } != -1
} }?.sortedWith(subSpaceComparator)
val hasChildren = (subSpaces?.size ?: 0) > 0 val hasChildren = (subSpaces?.size ?: 0) > 0
val expanded = expandedStates[groupSummary.roomId] == true val expanded = expandedStates[groupSummary.roomId] == true
...@@ -183,7 +185,7 @@ class SpaceSummaryController @Inject constructor( ...@@ -183,7 +185,7 @@ class SpaceSummaryController @Inject constructor(
// does it have children? // does it have children?
val subSpaces = childSum.spaceChildren?.filter { childInfo -> val subSpaces = childSum.spaceChildren?.filter { childInfo ->
summaries.indexOfFirst { it.roomId == childInfo.childRoomId } != -1 summaries.indexOfFirst { it.roomId == childInfo.childRoomId } != -1
} }?.sortedWith(subSpaceComparator)
val expanded = expandedStates[childSum.roomId] == true val expanded = expandedStates[childSum.roomId] == true
val isSelected = selected is RoomGroupingMethod.BySpace && childSum.roomId == selected.space()?.roomId val isSelected = selected is RoomGroupingMethod.BySpace && childSum.roomId == selected.space()?.roomId
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment