Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Layout - Adds missing space list header #7040

Merged
merged 2 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7040.wip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[New Layout] Adds header to spaces bottom sheet
1 change: 1 addition & 0 deletions library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 16 additions & 0 deletions vector/src/main/res/layout/item_new_space_list_header.xml
Original file line number Diff line number Diff line change
@@ -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" />