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

View file

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