Fix glitch when opening a room invite

Composer and mic was shown for a few milliseconds
Also hide the mic if the uer cannot send event, or if the room has been tombstoned.
This commit is contained in:
Benoit Marty 2021-07-12 13:55:44 +02:00
parent e49290b8ac
commit 8b852a2ab2
2 changed files with 18 additions and 11 deletions

View file

@ -1285,9 +1285,9 @@ class RoomDetailFragment @Inject constructor(
return
}
if (text.isNotBlank()) {
// We collapse ASAP, if not there will be a slight anoying delay
// We collapse ASAP, if not there will be a slight annoying delay
views.composerLayout.collapse(true)
views.voiceMessageRecorderView.isVisible = true && vectorPreferences.labsUseVoiceMessage()
views.voiceMessageRecorderView.isVisible = vectorPreferences.labsUseVoiceMessage()
lockSendButton = true
roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled()))
emojiPopup.dismiss()
@ -1336,23 +1336,26 @@ class RoomDetailFragment @Inject constructor(
views.jumpToBottomView.count = summary.notificationCount
views.jumpToBottomView.drawBadge = summary.hasUnreadMessages
timelineEventController.update(state)
views.inviteView.visibility = View.GONE
views.inviteView.isVisible = false
if (state.tombstoneEvent == null) {
if (state.canSendMessage) {
views.composerLayout.visibility = View.VISIBLE
views.composerLayout.isVisible = true
views.voiceMessageRecorderView.isVisible = vectorPreferences.labsUseVoiceMessage()
views.composerLayout.setRoomEncrypted(summary.isEncrypted)
views.notificationAreaView.render(NotificationAreaView.State.Hidden)
views.composerLayout.alwaysShowSendButton = !vectorPreferences.labsUseVoiceMessage()
} else {
views.composerLayout.visibility = View.GONE
views.composerLayout.isVisible = false
views.voiceMessageRecorderView.isVisible = false
views.notificationAreaView.render(NotificationAreaView.State.NoPermissionToPost)
}
} else {
views.composerLayout.visibility = View.GONE
views.composerLayout.isVisible = false
views.voiceMessageRecorderView.isVisible = false
views.notificationAreaView.render(NotificationAreaView.State.Tombstone(state.tombstoneEvent))
}
} else if (summary?.membership == Membership.INVITE && inviter != null) {
views.inviteView.visibility = View.VISIBLE
views.inviteView.isVisible = true
views.inviteView.render(inviter, VectorInviteView.Mode.LARGE, state.changeMembershipState)
// Intercept click event
views.inviteView.setOnClickListener { }

View file

@ -130,14 +130,14 @@
<com.google.android.material.chip.Chip
android:id="@+id/jumpToReadMarkerView"
style="?vctr_jump_to_unread_style"
app:chipIcon="@drawable/ic_jump_to_unread"
app:closeIcon="@drawable/ic_close_24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="24dp"
android:text="@string/room_jump_to_first_unread"
android:visibility="invisible"
app:chipIcon="@drawable/ic_jump_to_unread"
app:closeIcon="@drawable/ic_close_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/activeConferenceView"
@ -170,17 +170,21 @@
android:background="?android:colorBackground"
android:minHeight="56dp"
android:transitionName="composer"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<im.vector.app.features.home.room.detail.composer.VoiceMessageRecorderView
android:id="@+id/voiceMessageRecorderView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<im.vector.app.features.invite.VectorInviteView
android:id="@+id/inviteView"