mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 20:29:10 +03:00
Space Switching: Space Invites (#6924)
This commit is contained in:
parent
3319ed95dd
commit
b0fb1f908e
21 changed files with 245 additions and 53 deletions
1
changelog.d/6924.wip
Normal file
1
changelog.d/6924.wip
Normal file
|
@ -0,0 +1 @@
|
|||
[New Layout] Adds space invites
|
|
@ -40,7 +40,7 @@ abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Hold
|
|||
@EpoxyAttribute var text: String = ""
|
||||
@EpoxyAttribute var selected: Boolean = false
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var listener: ClickListener? = null
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
@EpoxyAttribute var showSeparator: Boolean = false
|
||||
|
||||
override fun getViewType(): Int {
|
||||
|
|
|
@ -39,7 +39,7 @@ abstract class NewHomeSpaceSummaryItem : VectorEpoxyModel<NewHomeSpaceSummaryIte
|
|||
@EpoxyAttribute var text: String = ""
|
||||
@EpoxyAttribute var selected: Boolean = false
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var listener: ClickListener? = null
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
@EpoxyAttribute var showSeparator: Boolean = false
|
||||
|
||||
override fun getViewType() = R.id.space_item_home
|
||||
|
|
|
@ -170,7 +170,7 @@ class HomeDetailFragment :
|
|||
|
||||
unreadMessagesSharedViewModel.onEach { state ->
|
||||
views.drawerUnreadCounterBadgeView.render(
|
||||
UnreadCounterBadgeView.State(
|
||||
UnreadCounterBadgeView.State.Count(
|
||||
count = state.otherSpacesUnread.totalCount,
|
||||
highlighted = state.otherSpacesUnread.isHighlight
|
||||
)
|
||||
|
|
|
@ -50,7 +50,7 @@ abstract class BreadcrumbsItem : VectorEpoxyModel<BreadcrumbsItem.Holder>(R.layo
|
|||
holder.unreadIndentIndicator.isVisible = hasUnreadMessage
|
||||
avatarRenderer.render(matrixItem, holder.avatarImageView)
|
||||
holder.avatarImageView.contentDescription = matrixItem.getBestName()
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State.Count(unreadNotificationCount, showHighlighted))
|
||||
holder.draftIndentIndicator.isVisible = hasDraft
|
||||
holder.typingIndicator.isVisible = hasTypingUsers
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>(R.la
|
|||
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
|
||||
DrawableCompat.setTint(it, tintColor)
|
||||
}
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State.Count(unreadNotificationCount, showHighlighted))
|
||||
holder.titleView.text = title
|
||||
holder.counterView.text = itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
||||
holder.counterView.setCompoundDrawablesWithIntrinsicBounds(null, null, expandedArrowDrawable, null)
|
||||
|
|
|
@ -113,7 +113,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>(R.layo
|
|||
itemLongClickListener?.onLongClick(it) ?: false
|
||||
}
|
||||
holder.titleView.text = matrixItem.getBestName()
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State.Count(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadIndentIndicator.isVisible = hasUnreadMessage
|
||||
holder.draftView.isVisible = hasDraft
|
||||
avatarRenderer.render(matrixItem, holder.avatarImageView)
|
||||
|
|
|
@ -97,7 +97,9 @@ class SectionHeaderAdapter constructor(
|
|||
binding.root.isClickable = roomsSectionData.isCollapsable
|
||||
binding.roomCategoryCounterView.setCompoundDrawablesWithIntrinsicBounds(null, null, collapsableArrowDrawable, null)
|
||||
binding.roomCategoryCounterView.text = roomsSectionData.itemCount.takeIf { it > 0 }?.toString().orEmpty()
|
||||
binding.roomCategoryUnreadCounterBadgeView.render(UnreadCounterBadgeView.State(roomsSectionData.notificationCount, roomsSectionData.isHighlighted))
|
||||
binding.roomCategoryUnreadCounterBadgeView.render(
|
||||
UnreadCounterBadgeView.State.Count(roomsSectionData.notificationCount, roomsSectionData.isHighlighted)
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -30,22 +30,44 @@ class UnreadCounterBadgeView : MaterialTextView {
|
|||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
|
||||
fun render(state: State) {
|
||||
if (state.count == 0) {
|
||||
visibility = View.INVISIBLE
|
||||
} else {
|
||||
visibility = View.VISIBLE
|
||||
val bgRes = if (state.highlighted) {
|
||||
R.drawable.bg_unread_highlight
|
||||
} else {
|
||||
R.drawable.bg_unread_notification
|
||||
}
|
||||
setBackgroundResource(bgRes)
|
||||
text = RoomSummaryFormatter.formatUnreadMessagesCounter(state.count)
|
||||
when (state) {
|
||||
is State.Count -> renderAsCount(state)
|
||||
is State.Text -> renderAsText(state)
|
||||
}
|
||||
}
|
||||
|
||||
data class State(
|
||||
val count: Int,
|
||||
val highlighted: Boolean
|
||||
)
|
||||
private fun renderAsCount(state: State.Count) {
|
||||
val view = this
|
||||
|
||||
with(state) {
|
||||
if (count == 0) {
|
||||
visibility = View.INVISIBLE
|
||||
} else {
|
||||
visibility = View.VISIBLE
|
||||
val bgRes = if (highlighted) {
|
||||
R.drawable.bg_unread_highlight
|
||||
} else {
|
||||
R.drawable.bg_unread_notification
|
||||
}
|
||||
setBackgroundResource(bgRes)
|
||||
view.text = RoomSummaryFormatter.formatUnreadMessagesCounter(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderAsText(state: State.Text) {
|
||||
val view = this
|
||||
|
||||
with(state) {
|
||||
visibility = View.VISIBLE
|
||||
val bgRes = if (highlighted) R.drawable.bg_unread_highlight else R.drawable.bg_unread_notification
|
||||
setBackgroundResource(bgRes)
|
||||
view.text = text
|
||||
}
|
||||
}
|
||||
|
||||
sealed class State {
|
||||
data class Count(val count: Int, val highlighted: Boolean) : State()
|
||||
data class Text(val text: String, val highlighted: Boolean) : State()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ abstract class InviteCounterItem : VectorEpoxyModel<InviteCounterItem.Holder>(R.
|
|||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.view.setOnClickListener(listener)
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(invitesCount, true))
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State.Count(invitesCount, true))
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder() {
|
||||
|
|
|
@ -58,7 +58,7 @@ abstract class RecentRoomItem : VectorEpoxyModel<RecentRoomItem.Holder>(R.layout
|
|||
|
||||
avatarRenderer.render(matrixItem, holder.avatarImageView)
|
||||
holder.avatarImageView.contentDescription = matrixItem.getBestName()
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State.Count(unreadNotificationCount, showHighlighted))
|
||||
holder.title.text = matrixItem.getBestName()
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership
|
|||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.SpaceChildInfo
|
||||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
||||
import org.matrix.android.sdk.api.session.user.model.User
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -47,24 +48,13 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
|
||||
override fun buildModels() {
|
||||
val nonNullViewState = viewState ?: return
|
||||
buildGroupModels(
|
||||
nonNullViewState.spaces,
|
||||
nonNullViewState.selectedSpace,
|
||||
nonNullViewState.rootSpacesOrdered,
|
||||
nonNullViewState.homeAggregateCount,
|
||||
nonNullViewState.expandedStates,
|
||||
)
|
||||
buildGroupModels(nonNullViewState)
|
||||
}
|
||||
|
||||
private fun buildGroupModels(
|
||||
spaceSummaries: List<RoomSummary>?,
|
||||
selectedSpace: RoomSummary?,
|
||||
rootSpaces: List<RoomSummary>?,
|
||||
homeCount: RoomAggregateNotificationCount,
|
||||
expandedStates: Map<String, Boolean>,
|
||||
) {
|
||||
addHomeItem(selectedSpace == null, homeCount)
|
||||
addSpaces(spaceSummaries, selectedSpace, rootSpaces, expandedStates)
|
||||
private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) {
|
||||
addHomeItem(selectedSpace == null, homeAggregateCount)
|
||||
addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates)
|
||||
addInvites(selectedSpace, rootSpacesOrdered, inviters)
|
||||
addCreateItem()
|
||||
}
|
||||
|
||||
|
@ -74,7 +64,7 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
id("space_home")
|
||||
text(host.stringProvider.getString(R.string.all_chats))
|
||||
selected(selected)
|
||||
countState(UnreadCounterBadgeView.State(homeCount.totalCount, homeCount.isHighlight))
|
||||
countState(UnreadCounterBadgeView.State.Count(homeCount.totalCount, homeCount.isHighlight))
|
||||
listener { host.callback?.onSpaceSelected(null) }
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +77,7 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
) {
|
||||
val host = this
|
||||
|
||||
rootSpaces?.filter { it.membership != Membership.INVITE }
|
||||
rootSpaces?.filterNot { it.membership == Membership.INVITE }
|
||||
?.forEach { spaceSummary ->
|
||||
val subSpaces = spaceSummary.spaceChildren?.filter { spaceChild -> spaceSummaries.containsSpaceId(spaceChild.childRoomId) }
|
||||
val hasChildren = (subSpaces?.size ?: 0) > 0
|
||||
|
@ -97,7 +87,7 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
newSpaceSummaryItem {
|
||||
id(spaceSummary.roomId)
|
||||
avatarRenderer(host.avatarRenderer)
|
||||
countState(UnreadCounterBadgeView.State(spaceSummary.notificationCount, spaceSummary.highlightCount > 0))
|
||||
countState(UnreadCounterBadgeView.State.Count(spaceSummary.notificationCount, spaceSummary.highlightCount > 0))
|
||||
expanded(expanded)
|
||||
hasChildren(hasChildren)
|
||||
matrixItem(spaceSummary.toMatrixItem())
|
||||
|
@ -128,7 +118,7 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
val host = this
|
||||
val childSummary = spaceSummaries?.firstOrNull { it.roomId == info.childRoomId } ?: return
|
||||
val id = "$idPrefix:${childSummary.roomId}"
|
||||
val countState = UnreadCounterBadgeView.State(childSummary.notificationCount, childSummary.highlightCount > 0)
|
||||
val countState = UnreadCounterBadgeView.State.Count(childSummary.notificationCount, childSummary.highlightCount > 0)
|
||||
val expanded = expandedStates[childSummary.roomId] == true
|
||||
val isSelected = childSummary.roomId == selectedSpace?.roomId
|
||||
val subSpaces = childSummary.spaceChildren?.filter { childSpace -> spaceSummaries.containsSpaceId(childSpace.childRoomId) }
|
||||
|
@ -155,6 +145,30 @@ class NewSpaceSummaryController @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun addInvites(
|
||||
selectedSpace: RoomSummary?,
|
||||
rootSpaces: List<RoomSummary>?,
|
||||
inviters: List<User>,
|
||||
) {
|
||||
val host = this
|
||||
|
||||
rootSpaces?.filter { it.membership == Membership.INVITE }
|
||||
?.forEach { spaceSummary ->
|
||||
val isSelected = spaceSummary.roomId == selectedSpace?.roomId
|
||||
val inviter = inviters.find { it.userId == spaceSummary.inviterId }
|
||||
|
||||
spaceInviteItem {
|
||||
id(spaceSummary.roomId)
|
||||
avatarRenderer(host.avatarRenderer)
|
||||
inviter(inviter?.displayName.orEmpty())
|
||||
matrixItem(spaceSummary.toMatrixItem())
|
||||
onLongClickListener { host.callback?.onSpaceSettings(spaceSummary) }
|
||||
onInviteSelectedListener { host.callback?.onSpaceInviteSelected(spaceSummary) }
|
||||
selected(isSelected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addCreateItem() {
|
||||
val host = this
|
||||
newSpaceAddItem {
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.matrix.android.sdk.api.util.MatrixItem
|
|||
abstract class NewSpaceSummaryItem : VectorEpoxyModel<NewSpaceSummaryItem.Holder>(R.layout.item_new_space) {
|
||||
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) lateinit var avatarRenderer: AvatarRenderer
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
@EpoxyAttribute var expanded: Boolean = false
|
||||
@EpoxyAttribute var hasChildren: Boolean = false
|
||||
@EpoxyAttribute lateinit var matrixItem: MatrixItem
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.matrix.android.sdk.api.util.MatrixItem
|
|||
abstract class NewSubSpaceSummaryItem : VectorEpoxyModel<NewSubSpaceSummaryItem.Holder>(R.layout.item_new_sub_space) {
|
||||
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) lateinit var avatarRenderer: AvatarRenderer
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
@EpoxyAttribute var expanded: Boolean = false
|
||||
@EpoxyAttribute var hasChildren: Boolean = false
|
||||
@EpoxyAttribute var indent: Int = 0
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2021 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 android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.epoxy.ClickListener
|
||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||
import im.vector.app.core.epoxy.onClick
|
||||
import im.vector.app.core.platform.CheckableConstraintLayout
|
||||
import im.vector.app.features.home.AvatarRenderer
|
||||
import im.vector.app.features.home.room.list.UnreadCounterBadgeView
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
||||
@EpoxyModelClass
|
||||
abstract class SpaceInviteItem : VectorEpoxyModel<SpaceInviteItem.Holder>(R.layout.item_space_invite) {
|
||||
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) lateinit var avatarRenderer: AvatarRenderer
|
||||
@EpoxyAttribute var inviter: String = ""
|
||||
@EpoxyAttribute lateinit var matrixItem: MatrixItem
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var onLongClickListener: ClickListener? = null
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var onInviteSelectedListener: ClickListener? = null
|
||||
@EpoxyAttribute var selected: Boolean = false
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
val context = holder.root.context
|
||||
holder.root.isChecked = selected
|
||||
holder.root.onClick(onInviteSelectedListener)
|
||||
holder.root.setOnLongClickListener { onLongClickListener?.invoke(holder.root).let { true } }
|
||||
holder.name.text = matrixItem.displayName
|
||||
holder.invitedBy.text = context.getString(R.string.invited_by, inviter)
|
||||
|
||||
avatarRenderer.render(matrixItem, holder.avatar)
|
||||
holder.notificationBadge.render(UnreadCounterBadgeView.State.Text("!", true))
|
||||
}
|
||||
|
||||
override fun unbind(holder: Holder) {
|
||||
avatarRenderer.clear(holder.avatar)
|
||||
super.unbind(holder)
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder() {
|
||||
val root by bind<CheckableConstraintLayout>(R.id.root)
|
||||
val avatar by bind<ImageView>(R.id.avatar)
|
||||
val name by bind<TextView>(R.id.name)
|
||||
val invitedBy by bind<TextView>(R.id.invited_by)
|
||||
val notificationBadge by bind<UnreadCounterBadgeView>(R.id.notification_badge)
|
||||
}
|
||||
}
|
|
@ -271,11 +271,14 @@ class SpaceListViewModel @AssistedInject constructor(
|
|||
?.content.toModel<SpaceOrderContent>()
|
||||
?.safeOrder()
|
||||
}
|
||||
val inviterIds = spaces.mapNotNull { it.inviterId }
|
||||
val inviters = inviterIds.mapNotNull { session.userService().getUser(it) }
|
||||
copy(
|
||||
asyncSpaces = asyncSpaces,
|
||||
spaces = spaces,
|
||||
inviters = inviters,
|
||||
rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)),
|
||||
spaceOrderInfo = orders
|
||||
spaceOrderInfo = orders,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.airbnb.mvrx.MavericksState
|
|||
import com.airbnb.mvrx.Uninitialized
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
||||
import org.matrix.android.sdk.api.session.user.model.User
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
||||
data class SpaceListViewState(
|
||||
|
@ -28,6 +29,7 @@ data class SpaceListViewState(
|
|||
val asyncSpaces: Async<List<RoomSummary>> = Uninitialized,
|
||||
val spaces: List<RoomSummary> = emptyList(),
|
||||
val selectedSpace: RoomSummary? = null,
|
||||
val inviters: List<User> = emptyList(),
|
||||
val rootSpacesOrdered: List<RoomSummary>? = null,
|
||||
val spaceOrderInfo: Map<String, String?>? = null,
|
||||
val spaceOrderLocalEchos: Map<String, String?>? = null,
|
||||
|
|
|
@ -76,7 +76,7 @@ class SpaceSummaryController @Inject constructor(
|
|||
avatarRenderer(host.avatarRenderer)
|
||||
id("invite_${roomSummary.roomId}")
|
||||
matrixItem(roomSummary.toMatrixItem())
|
||||
countState(UnreadCounterBadgeView.State(1, true))
|
||||
countState(UnreadCounterBadgeView.State.Count(1, true))
|
||||
selected(false)
|
||||
description(host.stringProvider.getString(R.string.you_are_invited))
|
||||
canDrag(false)
|
||||
|
@ -87,7 +87,7 @@ class SpaceSummaryController @Inject constructor(
|
|||
homeSpaceSummaryItem {
|
||||
id("space_home")
|
||||
selected(selectedSpace == null)
|
||||
countState(UnreadCounterBadgeView.State(homeCount.totalCount, homeCount.isHighlight))
|
||||
countState(UnreadCounterBadgeView.State.Count(homeCount.totalCount, homeCount.isHighlight))
|
||||
listener { host.callback?.onSpaceSelected(null) }
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ class SpaceSummaryController @Inject constructor(
|
|||
listener { host.callback?.onSpaceSelected(roomSummary) }
|
||||
toggleExpand { host.callback?.onToggleExpand(roomSummary) }
|
||||
countState(
|
||||
UnreadCounterBadgeView.State(
|
||||
UnreadCounterBadgeView.State.Count(
|
||||
roomSummary.notificationCount,
|
||||
roomSummary.highlightCount > 0
|
||||
)
|
||||
|
@ -169,7 +169,7 @@ class SpaceSummaryController @Inject constructor(
|
|||
toggleExpand { host.callback?.onToggleExpand(childSummary) }
|
||||
indent(currentDepth)
|
||||
countState(
|
||||
UnreadCounterBadgeView.State(
|
||||
UnreadCounterBadgeView.State.Count(
|
||||
childSummary.notificationCount,
|
||||
childSummary.highlightCount > 0
|
||||
)
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class SpaceSummaryItem : VectorEpoxyModel<SpaceSummaryItem.Holder>(R.la
|
|||
@EpoxyAttribute var expanded: Boolean = false
|
||||
@EpoxyAttribute var hasChildren: Boolean = false
|
||||
@EpoxyAttribute var indent: Int = 0
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
@EpoxyAttribute var description: String? = null
|
||||
@EpoxyAttribute var showSeparator: Boolean = false
|
||||
@EpoxyAttribute var canDrag: Boolean = true
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class SubSpaceSummaryItem : VectorEpoxyModel<SubSpaceSummaryItem.Holder
|
|||
@EpoxyAttribute var expanded: Boolean = false
|
||||
@EpoxyAttribute var hasChildren: Boolean = false
|
||||
@EpoxyAttribute var indent: Int = 0
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
|
||||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State.Count(0, false)
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
|
|
80
vector/src/main/res/layout/item_space_invite.xml
Normal file
80
vector/src/main/res/layout/item_space_invite.xml
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<im.vector.app.core.platform.CheckableConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"
|
||||
android:background="@drawable/bg_space_item"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
tools:viewBindingIgnore="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:duplicateParentState="true"
|
||||
android:importantForAccessibility="no"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@sample/space_avatars" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/Widget.Vector.TextView.Subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?vctr_content_primary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintBottom_toTopOf="@id/invited_by"
|
||||
app:layout_constraintEnd_toStartOf="@id/unread_counter"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Element Corp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/invited_by"
|
||||
style="@style/Widget.Vector.TextView.Body"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/unread_counter"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
tools:text="Invited by John Smith" />
|
||||
|
||||
<im.vector.app.features.home.room.list.UnreadCounterBadgeView
|
||||
android:id="@+id/notification_badge"
|
||||
style="@style/Widget.Vector.TextView.Micro"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="52dp"
|
||||
android:gravity="center"
|
||||
android:minWidth="16dp"
|
||||
android:minHeight="16dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:textColor="?colorOnError"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="@drawable/bg_unread_highlight"
|
||||
tools:text="!"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</im.vector.app.core.platform.CheckableConstraintLayout>
|
Loading…
Add table
Reference in a new issue