mirror of
https://github.com/element-hq/element-android
synced 2024-12-18 15:24:33 +03:00
Adds missing space list header
This commit is contained in:
parent
b3eac52e3f
commit
593a04ea25
4 changed files with 51 additions and 0 deletions
|
@ -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>
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
16
vector/src/main/res/layout/item_new_space_list_header.xml
Normal file
16
vector/src/main/res/layout/item_new_space_list_header.xml
Normal 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" />
|
Loading…
Reference in a new issue