Merge pull request #7040 from vector-im/bugfix/eric/new-layout-missing-header

New Layout - Adds missing space list header
This commit is contained in:
Eric Decanini 2022-09-07 10:31:31 +02:00 committed by GitHub
commit da88b37ec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 0 deletions

1
changelog.d/7040.wip Normal file
View file

@ -0,0 +1 @@
[New Layout] Adds header to spaces bottom sheet

View file

@ -139,6 +139,7 @@
<string name="all_chats">All Chats</string> <string name="all_chats">All Chats</string>
<string name="start_chat">Start Chat</string> <string name="start_chat">Start Chat</string>
<string name="create_room">Create Room</string> <string name="create_room">Create Room</string>
<string name="change_space">Change Space</string>
<string name="explore_rooms">Explore Rooms</string> <string name="explore_rooms">Explore Rooms</string>
<!-- Note to translators: %s refers to the space whose children is being expanded --> <!-- Note to translators: %s refers to the space whose children is being expanded -->
<string name="a11y_expand_space_children">Expand %s children</string> <string name="a11y_expand_space_children">Expand %s children</string>

View file

@ -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()
}

View file

@ -52,12 +52,19 @@ class NewSpaceSummaryController @Inject constructor(
} }
private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) { private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) {
addHeaderItem()
addHomeItem(selectedSpace == null, homeAggregateCount) addHomeItem(selectedSpace == null, homeAggregateCount)
addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates) addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates)
addInvites(selectedSpace, rootSpacesOrdered, inviters) addInvites(selectedSpace, rootSpacesOrdered, inviters)
addCreateItem() addCreateItem()
} }
private fun addHeaderItem() {
newSpaceListHeaderItem {
id("space_list_header")
}
}
private fun addHomeItem(selected: Boolean, homeCount: RoomAggregateNotificationCount) { private fun addHomeItem(selected: Boolean, homeCount: RoomAggregateNotificationCount) {
val host = this val host = this
newHomeSpaceSummaryItem { newHomeSpaceSummaryItem {

View file

@ -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" />