diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt index f38877ca6b..77337d7208 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt @@ -58,6 +58,15 @@ class RoomMemberListFragment @Inject constructor( setupSearchView() setupInviteUsersButton() recyclerView.configureWith(roomMemberListController, hasFixedSize = true) + viewModel.selectSubscribe(this, RoomMemberListViewState::actionsPermissions) { + invalidateOptionsMenu() + } + } + + private fun setupInviteUsersButton() { + inviteUsersButton.debouncedClicks { + navigator.openInviteUsersToRoom(requireContext(), roomProfileArgs.roomId) + } // Hide FAB when list is scrolling recyclerView.addOnScrollListener( object : RecyclerView.OnScrollListener() { @@ -76,15 +85,6 @@ class RoomMemberListFragment @Inject constructor( } } ) - viewModel.selectSubscribe(this, RoomMemberListViewState::actionsPermissions) { - invalidateOptionsMenu() - } - } - - private fun setupInviteUsersButton() { - inviteUsersButton.debouncedClicks { - navigator.openInviteUsersToRoom(requireContext(), roomProfileArgs.roomId) - } } private fun setupSearchView() { @@ -110,6 +110,7 @@ class RoomMemberListFragment @Inject constructor( override fun invalidate() = withState(viewModel) { viewState -> roomMemberListController.setData(viewState) renderRoomSummary(viewState) + inviteUsersButton.isVisible = viewState.actionsPermissions.canInvite } override fun onRoomMemberClicked(roomMember: RoomMemberSummary) { @@ -137,6 +138,5 @@ class RoomMemberListFragment @Inject constructor( roomSettingsToolbarTitleView.text = it.displayName avatarRenderer.render(it.toMatrixItem(), roomSettingsToolbarAvatarImageView) } - inviteUsersButton.isVisible = state.actionsPermissions.canInvite } } diff --git a/vector/src/main/res/layout/fragment_room_member_list.xml b/vector/src/main/res/layout/fragment_room_member_list.xml index cfc7e2a891..e144ddb6e3 100644 --- a/vector/src/main/res/layout/fragment_room_member_list.xml +++ b/vector/src/main/res/layout/fragment_room_member_list.xml @@ -1,7 +1,6 @@ - @@ -11,14 +10,12 @@ android:id="@+id/inviteUsersButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_gravity="bottom|end" android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" android:contentDescription="@string/add_members_to_room" android:scaleType="center" android:src="@drawable/ic_fab_add_members" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:maxImageSize="36dp" - tools:visibility="visible" /> + app:maxImageSize="36dp" /> - \ No newline at end of file + \ No newline at end of file