mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 19:05:56 +03:00
Don't reserve space for typing view until somebody is typing
Once we show it, keep it, to not make the timeline jump around too much. Change-Id: I8f863d8d21f3b06ff86f62615d8e6aefe81bde2e
This commit is contained in:
parent
27fd6a2819
commit
10c77f2b59
2 changed files with 14 additions and 2 deletions
|
@ -50,6 +50,7 @@ import androidx.core.text.toSpannable
|
|||
import androidx.core.util.Pair
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.forEach
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.setFragmentResultListener
|
||||
|
@ -1692,14 +1693,24 @@ class TimelineFragment @Inject constructor(
|
|||
voiceMessageRecorderView.isVisible = false
|
||||
}
|
||||
|
||||
// Fully hide the typing message view with isGone, until the first user actually types
|
||||
inline var View.isInvisibleOrGone: Boolean
|
||||
get() = visibility != View.VISIBLE
|
||||
set(value) {
|
||||
// Set to invisible, unless it is already gone.
|
||||
if (!value || !isGone) {
|
||||
visibility = if (value) View.INVISIBLE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderTypingMessageNotification(roomSummary: RoomSummary?, state: RoomDetailViewState) {
|
||||
if (!isThreadTimeLine() && roomSummary != null) {
|
||||
views.typingMessageView.isInvisible = state.typingUsers.isNullOrEmpty()
|
||||
views.typingMessageView.isInvisibleOrGone = state.typingUsers.isNullOrEmpty()
|
||||
state.typingUsers
|
||||
?.take(MAX_TYPING_MESSAGE_USERS_COUNT)
|
||||
?.let { senders -> views.typingMessageView.render(senders, avatarRenderer) }
|
||||
} else {
|
||||
views.typingMessageView.isInvisible = true
|
||||
views.typingMessageView.isInvisibleOrGone = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_height="20dp"/>
|
||||
|
||||
|
|
Loading…
Reference in a new issue