mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Rich Text Editor: fix several inset issues in room screen (#7681)
This commit is contained in:
parent
c8a73a6ac8
commit
0c11778d33
4 changed files with 20 additions and 10 deletions
3
changelog.d/7680.bugfix
Normal file
3
changelog.d/7680.bugfix
Normal file
|
@ -0,0 +1,3 @@
|
|||
Rich Text Editor: fix several issues related to insets:
|
||||
* Empty space displayed at the bottom when you don't have permissions to send messages into a room.
|
||||
* Wrong insets being kept when you exit the room screen and the keyboard is displayed, then come back to it.
|
|
@ -608,26 +608,33 @@ class ExpandingBottomSheetBehavior<V : View> : CoordinatorLayout.Behavior<V> {
|
|||
initialPaddingBottom = view.paddingBottom
|
||||
|
||||
// This should only be used to set initial insets and other edge cases where the insets can't be applied using an animation.
|
||||
var applyInsetsFromAnimation = false
|
||||
var isAnimating = false
|
||||
|
||||
// This will animated inset changes, making them look a lot better. However, it won't update initial insets.
|
||||
// This will animate inset changes, making them look a lot better. However, it won't update initial insets.
|
||||
ViewCompat.setWindowInsetsAnimationCallback(view, object : WindowInsetsAnimationCompat.Callback(DISPATCH_MODE_STOP) {
|
||||
override fun onPrepare(animation: WindowInsetsAnimationCompat) {
|
||||
isAnimating = true
|
||||
}
|
||||
|
||||
override fun onProgress(insets: WindowInsetsCompat, runningAnimations: MutableList<WindowInsetsAnimationCompat>): WindowInsetsCompat {
|
||||
return applyInsets(view, insets)
|
||||
return if (isAnimating) {
|
||||
applyInsets(view, insets)
|
||||
} else {
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEnd(animation: WindowInsetsAnimationCompat) {
|
||||
applyInsetsFromAnimation = false
|
||||
isAnimating = false
|
||||
view.requestApplyInsets()
|
||||
}
|
||||
})
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(view) { _: View, insets: WindowInsetsCompat ->
|
||||
if (!applyInsetsFromAnimation) {
|
||||
applyInsetsFromAnimation = true
|
||||
applyInsets(view, insets)
|
||||
} else {
|
||||
if (isAnimating) {
|
||||
insets
|
||||
} else {
|
||||
applyInsets(view, insets)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
|
|||
) { mainState, messageComposerState, attachmentState ->
|
||||
if (mainState.tombstoneEvent != null) return@withState
|
||||
|
||||
(composer as? View)?.isInvisible = !messageComposerState.isComposerVisible
|
||||
(composer as? View)?.isVisible = messageComposerState.isComposerVisible
|
||||
composer.sendButton.isInvisible = !messageComposerState.isSendButtonVisible
|
||||
(composer as? RichTextComposerLayout)?.isTextFormattingEnabled = attachmentState.isTextFormattingEnabled
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="always"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/notificationAreaView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/removeJitsiWidgetView"
|
||||
|
|
Loading…
Reference in a new issue