mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Adds new space list controller
This commit is contained in:
parent
55d8b6a819
commit
aa24debd87
11 changed files with 447 additions and 21 deletions
|
@ -37,6 +37,7 @@ import im.vector.app.features.themes.ThemeUtils
|
|||
@EpoxyModelClass
|
||||
abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Holder>(R.layout.item_space) {
|
||||
|
||||
@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)
|
||||
|
|
|
@ -28,8 +28,8 @@ import com.airbnb.mvrx.activityViewModel
|
|||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import com.google.android.material.badge.BadgeDrawable
|
||||
import im.vector.app.AppStateHandler
|
||||
import im.vector.app.R
|
||||
import im.vector.app.SpaceStateHandler
|
||||
import im.vector.app.core.extensions.commitTransaction
|
||||
import im.vector.app.core.extensions.toMvRxBundle
|
||||
import im.vector.app.core.platform.OnBackPressed
|
||||
|
@ -47,6 +47,7 @@ import im.vector.app.features.call.dialpad.DialPadFragment
|
|||
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||
import im.vector.app.features.home.room.list.RoomListFragment
|
||||
import im.vector.app.features.home.room.list.RoomListParams
|
||||
import im.vector.app.features.home.room.list.home.HomeRoomListFragment
|
||||
import im.vector.app.features.popup.PopupAlertManager
|
||||
import im.vector.app.features.popup.VerificationVectorAlert
|
||||
import im.vector.app.features.settings.VectorLocale
|
||||
|
@ -69,7 +70,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
private val alertManager: PopupAlertManager,
|
||||
private val callManager: WebRtcCallManager,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val appStateHandler: AppStateHandler,
|
||||
private val spaceStateHandler: SpaceStateHandler,
|
||||
private val session: Session,
|
||||
) : VectorBaseFragment<FragmentNewHomeDetailBinding>(),
|
||||
KeysBackupBanner.Delegate,
|
||||
|
@ -178,13 +179,13 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun navigateBack() {
|
||||
val previousSpaceId = appStateHandler.getSpaceBackstack().removeLastOrNull()
|
||||
val parentSpaceId = appStateHandler.getCurrentSpace()?.flattenParentIds?.lastOrNull()
|
||||
val previousSpaceId = spaceStateHandler.getSpaceBackstack().removeLastOrNull()
|
||||
val parentSpaceId = spaceStateHandler.getCurrentSpace()?.flattenParentIds?.lastOrNull()
|
||||
setCurrentSpace(previousSpaceId ?: parentSpaceId)
|
||||
}
|
||||
|
||||
private fun setCurrentSpace(spaceId: String?) {
|
||||
appStateHandler.setCurrentSpace(spaceId, isForwardNavigation = false)
|
||||
spaceStateHandler.setCurrentSpace(spaceId, isForwardNavigation = false)
|
||||
sharedActionViewModel.post(HomeActivitySharedAction.OnCloseSpace)
|
||||
}
|
||||
|
||||
|
@ -207,7 +208,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun refreshSpaceState() {
|
||||
appStateHandler.getCurrentSpace()?.let {
|
||||
spaceStateHandler.getCurrentSpace()?.let {
|
||||
onSpaceChange(it)
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +341,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
when (tab) {
|
||||
is HomeTab.RoomList -> {
|
||||
val params = RoomListParams(tab.displayMode)
|
||||
add(R.id.roomListContainer, RoomListFragment::class.java, params.toMvRxBundle(), fragmentTag)
|
||||
add(R.id.roomListContainer, HomeRoomListFragment::class.java, params.toMvRxBundle(), fragmentTag)
|
||||
}
|
||||
is HomeTab.DialPad -> {
|
||||
add(R.id.roomListContainer, createDialPadFragment(), fragmentTag)
|
||||
|
@ -453,7 +454,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
return this
|
||||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean) = if (appStateHandler.getCurrentSpace() != null) {
|
||||
override fun onBackPressed(toolbarButton: Boolean) = if (spaceStateHandler.getCurrentSpace() != null) {
|
||||
navigateBack()
|
||||
true
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 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
|
||||
|
||||
@EpoxyModelClass
|
||||
abstract class NewSpaceAddItem : VectorEpoxyModel<NewSpaceAddItem.Holder>(R.layout.item_new_space_add) {
|
||||
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var listener: ClickListener? = null
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.view.onClick(listener)
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder()
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 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()
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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 com.airbnb.epoxy.EpoxyController
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.features.grouplist.homeSpaceSummaryItem
|
||||
import im.vector.app.features.home.AvatarRenderer
|
||||
import im.vector.app.features.home.room.list.UnreadCounterBadgeView
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
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.util.toMatrixItem
|
||||
import javax.inject.Inject
|
||||
|
||||
class NewSpaceSummaryController @Inject constructor(
|
||||
private val avatarRenderer: AvatarRenderer,
|
||||
private val stringProvider: StringProvider,
|
||||
) : EpoxyController() {
|
||||
|
||||
var callback: Callback? = null
|
||||
private var viewState: SpaceListViewState? = null
|
||||
|
||||
private val subSpaceComparator: Comparator<SpaceChildInfo> = compareBy<SpaceChildInfo> { it.order }.thenBy { it.childRoomId }
|
||||
|
||||
fun update(viewState: SpaceListViewState) {
|
||||
this.viewState = viewState
|
||||
requestModelBuild()
|
||||
}
|
||||
|
||||
override fun buildModels() {
|
||||
val nonNullViewState = viewState ?: return
|
||||
buildGroupModels(
|
||||
nonNullViewState.selectedSpace,
|
||||
nonNullViewState.rootSpacesOrdered,
|
||||
nonNullViewState.homeAggregateCount
|
||||
)
|
||||
}
|
||||
|
||||
private fun buildGroupModels(
|
||||
selectedSpace: RoomSummary?,
|
||||
rootSpaces: List<RoomSummary>?,
|
||||
homeCount: RoomAggregateNotificationCount
|
||||
) {
|
||||
val host = this
|
||||
|
||||
newSpaceListHeaderItem {
|
||||
id("space_list_header")
|
||||
}
|
||||
|
||||
homeSpaceSummaryItem {
|
||||
id("space_home")
|
||||
text(this@NewSpaceSummaryController.stringProvider.getString(R.string.all_chats))
|
||||
selected(selectedSpace == null)
|
||||
countState(UnreadCounterBadgeView.State(homeCount.totalCount, homeCount.isHighlight))
|
||||
listener { host.callback?.onSpaceSelected(null) }
|
||||
}
|
||||
|
||||
rootSpaces
|
||||
?.filter { it.membership != Membership.INVITE }
|
||||
?.forEach { roomSummary ->
|
||||
val isSelected = roomSummary.roomId == selectedSpace?.roomId
|
||||
|
||||
newSpaceSummaryItem {
|
||||
avatarRenderer(host.avatarRenderer)
|
||||
id(roomSummary.roomId)
|
||||
matrixItem(roomSummary.toMatrixItem())
|
||||
selected(isSelected)
|
||||
canDrag(true)
|
||||
onMore { host.callback?.onSpaceSettings(roomSummary) }
|
||||
listener { host.callback?.onSpaceSelected(roomSummary) }
|
||||
countState(
|
||||
UnreadCounterBadgeView.State(
|
||||
roomSummary.notificationCount,
|
||||
roomSummary.highlightCount > 0
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
newSpaceAddItem {
|
||||
id("create")
|
||||
listener { host.callback?.onAddSpaceSelected() }
|
||||
}
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
fun onSpaceSelected(spaceSummary: RoomSummary?)
|
||||
fun onSpaceInviteSelected(spaceSummary: RoomSummary)
|
||||
fun onSpaceSettings(spaceSummary: RoomSummary)
|
||||
fun onAddSpaceSelected()
|
||||
fun sendFeedBack()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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 NewSpaceSummaryItem : VectorEpoxyModel<NewSpaceSummaryItem.Holder>(R.layout.item_new_space) {
|
||||
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) lateinit var avatarRenderer: AvatarRenderer
|
||||
@EpoxyAttribute lateinit var matrixItem: MatrixItem
|
||||
@EpoxyAttribute var selected: Boolean = false
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var listener: ClickListener? = null
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var onMore: ClickListener? = null
|
||||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var toggleExpand: ClickListener? = null
|
||||
@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 description: String? = null
|
||||
@EpoxyAttribute var showSeparator: Boolean = false
|
||||
@EpoxyAttribute var canDrag: Boolean = true
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.rootView.onClick(listener)
|
||||
holder.groupNameView.text = matrixItem.displayName
|
||||
holder.rootView.isChecked = selected
|
||||
|
||||
avatarRenderer.render(matrixItem, holder.avatarImageView)
|
||||
holder.counterBadgeView.render(countState)
|
||||
}
|
||||
|
||||
override fun unbind(holder: Holder) {
|
||||
avatarRenderer.clear(holder.avatarImageView)
|
||||
super.unbind(holder)
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder() {
|
||||
val rootView by bind<CheckableConstraintLayout>(R.id.root)
|
||||
val avatarImageView by bind<ImageView>(R.id.avatar)
|
||||
val groupNameView by bind<TextView>(R.id.name)
|
||||
val counterBadgeView by bind<UnreadCounterBadgeView>(R.id.unread_counter)
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ import im.vector.app.core.extensions.configureWith
|
|||
import im.vector.app.core.platform.StateView
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.databinding.FragmentSpaceListBinding
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.home.HomeActivitySharedAction
|
||||
import im.vector.app.features.home.HomeSharedActionViewModel
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
|
@ -42,8 +43,10 @@ import javax.inject.Inject
|
|||
* is displaying the space hierarchy, with some actions on Spaces.
|
||||
*/
|
||||
class SpaceListFragment @Inject constructor(
|
||||
private val spaceController: SpaceSummaryController
|
||||
) : VectorBaseFragment<FragmentSpaceListBinding>(), SpaceSummaryController.Callback {
|
||||
private val spaceController: SpaceSummaryController,
|
||||
private val newSpaceController: NewSpaceSummaryController,
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
) : VectorBaseFragment<FragmentSpaceListBinding>(), SpaceSummaryController.Callback, NewSpaceSummaryController.Callback {
|
||||
|
||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||
private val viewModel: SpaceListViewModel by fragmentViewModel()
|
||||
|
@ -54,10 +57,24 @@ class SpaceListFragment @Inject constructor(
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
sharedActionViewModel = activityViewModelProvider.get(HomeSharedActionViewModel::class.java)
|
||||
spaceController.callback = this
|
||||
sharedActionViewModel = activityViewModelProvider[HomeSharedActionViewModel::class.java]
|
||||
views.stateView.contentView = views.groupListView
|
||||
views.groupListView.configureWith(spaceController)
|
||||
setupSpaceController()
|
||||
enableDragAndDrop()
|
||||
observeViewEvents()
|
||||
}
|
||||
|
||||
private fun setupSpaceController() {
|
||||
if (vectorFeatures.isNewAppLayoutEnabled()) {
|
||||
newSpaceController.callback = this
|
||||
views.groupListView.configureWith(newSpaceController)
|
||||
} else {
|
||||
spaceController.callback = this
|
||||
views.groupListView.configureWith(spaceController)
|
||||
}
|
||||
}
|
||||
|
||||
private fun enableDragAndDrop() {
|
||||
EpoxyTouchHelper.initDragging(spaceController)
|
||||
.withRecyclerView(views.groupListView)
|
||||
.forVerticalList()
|
||||
|
@ -100,14 +117,14 @@ class SpaceListFragment @Inject constructor(
|
|||
return model?.canDrag == true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is SpaceListViewEvents.OpenSpaceSummary -> sharedActionViewModel.post(HomeActivitySharedAction.OpenSpacePreview(it.id))
|
||||
is SpaceListViewEvents.AddSpace -> sharedActionViewModel.post(HomeActivitySharedAction.AddSpace)
|
||||
is SpaceListViewEvents.OpenSpaceInvite -> sharedActionViewModel.post(HomeActivitySharedAction.OpenSpaceInvite(it.id))
|
||||
SpaceListViewEvents.CloseDrawer -> sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
|
||||
}
|
||||
private fun observeViewEvents() = viewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is SpaceListViewEvents.OpenSpaceSummary -> sharedActionViewModel.post(HomeActivitySharedAction.OpenSpacePreview(it.id))
|
||||
is SpaceListViewEvents.AddSpace -> sharedActionViewModel.post(HomeActivitySharedAction.AddSpace)
|
||||
is SpaceListViewEvents.OpenSpaceInvite -> sharedActionViewModel.post(HomeActivitySharedAction.OpenSpaceInvite(it.id))
|
||||
SpaceListViewEvents.CloseDrawer -> sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +141,12 @@ class SpaceListFragment @Inject constructor(
|
|||
is Success -> views.stateView.state = StateView.State.Content
|
||||
else -> Unit
|
||||
}
|
||||
spaceController.update(state)
|
||||
|
||||
if (vectorFeatures.isNewAppLayoutEnabled()) {
|
||||
newSpaceController.update(state)
|
||||
} else {
|
||||
spaceController.update(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSpaceSelected(spaceSummary: RoomSummary?) {
|
||||
|
|
11
vector/src/main/res/drawable/ic_plus.xml
Normal file
11
vector/src/main/res/drawable/ic_plus.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12.7822,4.2963C12.7822,3.8641 12.4318,3.5137 11.9996,3.5137C11.5673,3.5137 11.217,3.8641 11.217,4.2963V11.2173L4.2963,11.2173C3.8641,11.2173 3.5137,11.5676 3.5137,11.9999C3.5137,12.4321 3.8641,12.7825 4.2963,12.7825H11.217V19.7038C11.217,20.136 11.5673,20.4864 11.9996,20.4864C12.4318,20.4864 12.7822,20.136 12.7822,19.7038V12.7825H19.7038C20.136,12.7825 20.4864,12.4321 20.4864,11.9999C20.4864,11.5676 20.136,11.2173 19.7038,11.2173L12.7822,11.2173V4.2963Z"
|
||||
android:fillColor="#17191C"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
||||
|
77
vector/src/main/res/layout/item_new_space.xml
Normal file
77
vector/src/main/res/layout/item_new_space.xml
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?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_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintEnd_toStartOf="@id/unread_counter"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Element Corp" />
|
||||
|
||||
<im.vector.app.features.home.room.list.UnreadCounterBadgeView
|
||||
android:id="@+id/unread_counter"
|
||||
style="@style/Widget.Vector.TextView.Micro"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:minWidth="16dp"
|
||||
android:minHeight="16dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:textColor="?colorOnError"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/chevron"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:background="@drawable/bg_unread_highlight"
|
||||
tools:text="147"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chevron"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="21dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:tint="?vctr_content_secondary"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</im.vector.app.core.platform.CheckableConstraintLayout>
|
54
vector/src/main/res/layout/item_new_space_add.xml
Normal file
54
vector/src/main/res/layout/item_new_space_add.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?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/itemGroupLayout"
|
||||
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">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:background="?attr/vctr_system"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/groupAvatarImageView"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:background="@drawable/rounded_rect_shape_8"
|
||||
android:backgroundTint="#4D8D97A5"
|
||||
android:duplicateParentState="true"
|
||||
android:importantForAccessibility="no"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_plus"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/groupNameView"
|
||||
style="@style/Widget.Vector.TextView.Subtitle.Medium"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/create_space"
|
||||
android:textColor="?vctr_message_text_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/groupAvatarImageView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</im.vector.app.core.platform.CheckableConstraintLayout>
|
13
vector/src/main/res/layout/item_new_space_list_header.xml
Normal file
13
vector/src/main/res/layout/item_new_space_list_header.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?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:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:text="@string/all_chats"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?vctr_content_tertiary"
|
||||
android:textSize="14sp"
|
||||
tools:viewBindingIgnore="true" />
|
Loading…
Reference in a new issue