Skip to content

Commit da88b37

Browse files
authored
Merge pull request #7040 from vector-im/bugfix/eric/new-layout-missing-header
New Layout - Adds missing space list header
2 parents c5d3eaf + ef17aac commit da88b37

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

changelog.d/7040.wip

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[New Layout] Adds header to spaces bottom sheet

library/ui-strings/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<string name="all_chats">All Chats</string>
140140
<string name="start_chat">Start Chat</string>
141141
<string name="create_room">Create Room</string>
142+
<string name="change_space">Change Space</string>
142143
<string name="explore_rooms">Explore Rooms</string>
143144
<!-- Note to translators: %s refers to the space whose children is being expanded -->
144145
<string name="a11y_expand_space_children">Expand %s children</string>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2022 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.spaces
18+
19+
import com.airbnb.epoxy.EpoxyModelClass
20+
import im.vector.app.R
21+
import im.vector.app.core.epoxy.VectorEpoxyHolder
22+
import im.vector.app.core.epoxy.VectorEpoxyModel
23+
24+
@EpoxyModelClass
25+
abstract class NewSpaceListHeaderItem : VectorEpoxyModel<NewSpaceListHeaderItem.Holder>(R.layout.item_new_space_list_header) {
26+
class Holder : VectorEpoxyHolder()
27+
}

vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt

+7
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,19 @@ class NewSpaceSummaryController @Inject constructor(
5252
}
5353

5454
private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) {
55+
addHeaderItem()
5556
addHomeItem(selectedSpace == null, homeAggregateCount)
5657
addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates)
5758
addInvites(selectedSpace, rootSpacesOrdered, inviters)
5859
addCreateItem()
5960
}
6061

62+
private fun addHeaderItem() {
63+
newSpaceListHeaderItem {
64+
id("space_list_header")
65+
}
66+
}
67+
6168
private fun addHomeItem(selected: Boolean, homeCount: RoomAggregateNotificationCount) {
6269
val host = this
6370
newHomeSpaceSummaryItem {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
style="@style/TextAppearance.Vector.Body.Medium"
5+
android:layout_width="match_parent"
6+
android:layout_height="wrap_content"
7+
android:background="@drawable/bg_space_item"
8+
android:ellipsize="middle"
9+
android:orientation="vertical"
10+
android:padding="16dp"
11+
android:singleLine="true"
12+
android:text="@string/change_space"
13+
android:textAllCaps="true"
14+
android:textColor="?vctr_content_tertiary"
15+
android:textSize="14sp"
16+
tools:viewBindingIgnore="true" />

0 commit comments

Comments
 (0)