Benoit code review fixes.

This commit is contained in:
Onuray Sahin 2020-10-12 18:32:31 +03:00
parent f82aee6089
commit d6b94802d8
2 changed files with 14 additions and 17 deletions

View File

@ -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
}
}

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
@ -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" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>