From 593a04ea25cce918b5a01f0987888d947fbe3960 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 6 Sep 2022 15:41:30 +0200 Subject: [PATCH] Adds missing space list header --- .../src/main/res/values/strings.xml | 1 + .../features/spaces/NewSpaceListHeaderItem.kt | 27 +++++++++++++++++++ .../spaces/NewSpaceSummaryController.kt | 7 +++++ .../res/layout/item_new_space_list_header.xml | 16 +++++++++++ 4 files changed, 51 insertions(+) create mode 100644 vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt create mode 100644 vector/src/main/res/layout/item_new_space_list_header.xml diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 8c2af01e52..cbd56dc7ea 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -139,6 +139,7 @@ All Chats Start Chat Create Room + Change Space Explore Rooms Expand %s children diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt new file mode 100644 index 0000000000..33bc547faa --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.spaces + +import com.airbnb.epoxy.EpoxyModelClass +import im.vector.app.R +import im.vector.app.core.epoxy.VectorEpoxyHolder +import im.vector.app.core.epoxy.VectorEpoxyModel + +@EpoxyModelClass +abstract class NewSpaceListHeaderItem : VectorEpoxyModel(R.layout.item_new_space_list_header) { + class Holder : VectorEpoxyHolder() +} diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt index 24c7e13271..5061eb4036 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt @@ -52,12 +52,19 @@ class NewSpaceSummaryController @Inject constructor( } private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) { + addHeaderItem() addHomeItem(selectedSpace == null, homeAggregateCount) addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates) addInvites(selectedSpace, rootSpacesOrdered, inviters) addCreateItem() } + private fun addHeaderItem() { + newSpaceListHeaderItem { + id("space_list_header") + } + } + private fun addHomeItem(selected: Boolean, homeCount: RoomAggregateNotificationCount) { val host = this newHomeSpaceSummaryItem { diff --git a/vector/src/main/res/layout/item_new_space_list_header.xml b/vector/src/main/res/layout/item_new_space_list_header.xml new file mode 100644 index 0000000000..2c52304249 --- /dev/null +++ b/vector/src/main/res/layout/item_new_space_list_header.xml @@ -0,0 +1,16 @@ + +