From e6508e8a5a7fca71d9f1d10c52a158cacd407657 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Fri, 5 Aug 2022 16:08:05 +0200 Subject: [PATCH] Cleans up epoxy class for NewSpaceSummaryItem and adds ellipsize to header --- .../spaces/NewSpaceSummaryController.kt | 4 ---- .../features/spaces/NewSpaceSummaryItem.kt | 22 ++++++------------- .../app/features/spaces/SpaceListFragment.kt | 6 +---- .../res/layout/item_new_space_list_header.xml | 2 ++ 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt index 781d6942bc..7c4435bf59 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt @@ -108,8 +108,6 @@ class NewSpaceSummaryController @Inject constructor( id(subSpaceSummary.roomId) matrixItem(subSpaceSummary.toMatrixItem()) selected(false) - canDrag(true) - onMore { host.callback?.onSpaceSettings(subSpaceSummary) } listener { host.callback?.onSpaceSelected(subSpaceSummary) } countState( UnreadCounterBadgeView.State( @@ -135,8 +133,6 @@ class NewSpaceSummaryController @Inject constructor( avatarRenderer(host.avatarRenderer) id(roomSummary.roomId) matrixItem(roomSummary.toMatrixItem()) - canDrag(true) - onMore { host.callback?.onSpaceSettings(roomSummary) } listener { host.callback?.onSpaceSelected(roomSummary) } countState(UnreadCounterBadgeView.State(roomSummary.notificationCount, roomSummary.highlightCount > 0)) } diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryItem.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryItem.kt index eecb02b320..778b9c933e 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryItem.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryItem.kt @@ -37,35 +37,27 @@ abstract class NewSpaceSummaryItem : VectorEpoxyModel(R.id.root) - val avatarImageView by bind(R.id.avatar) - val groupNameView by bind(R.id.name) - val counterBadgeView by bind(R.id.unread_counter) + val avatar by bind(R.id.avatar) + val name by bind(R.id.name) + val unreadCounter by bind(R.id.unread_counter) } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt index 70bf7c3839..7b034356b4 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt @@ -96,7 +96,7 @@ class SpaceListFragment @Inject constructor( toPositionM = null fromPositionM = null model?.matrixItem?.id?.let { - viewModel.handle(SpaceListAction.OnStartDragging(it, model.expanded)) + viewModel.handle(SpaceListAction.OnStartDragging(it, false)) } itemView?.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) initialElevation = itemView?.elevation @@ -122,10 +122,6 @@ class SpaceListFragment @Inject constructor( itemView?.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) } } - - override fun isDragEnabledForModel(model: NewSpaceSummaryItem?): Boolean { - return model?.canDrag == true - } }) } diff --git a/vector/src/main/res/layout/item_new_space_list_header.xml b/vector/src/main/res/layout/item_new_space_list_header.xml index 15dceb9b7f..2c52304249 100644 --- a/vector/src/main/res/layout/item_new_space_list_header.xml +++ b/vector/src/main/res/layout/item_new_space_list_header.xml @@ -5,8 +5,10 @@ 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"