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 @@ <string name="all_chats">All Chats</string> <string name="start_chat">Start Chat</string> <string name="create_room">Create Room</string> + <string name="change_space">Change Space</string> <string name="explore_rooms">Explore Rooms</string> <!-- Note to translators: %s refers to the space whose children is being expanded --> <string name="a11y_expand_space_children">Expand %s children</string> 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<NewSpaceListHeaderItem.Holder>(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 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + style="@style/TextAppearance.Vector.Body.Medium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/bg_space_item" + android:ellipsize="middle" + android:orientation="vertical" + android:padding="16dp" + android:singleLine="true" + android:text="@string/change_space" + android:textAllCaps="true" + android:textColor="?vctr_content_tertiary" + android:textSize="14sp" + tools:viewBindingIgnore="true" />