Update the top bar in a room (#5213)

Remove typing message notification from room toolbar.

Signed-off-by: Ahmed Radhouane Belkilani <arbelkilani@gmail.com>
This commit is contained in:
Ahmed Radhouane Belkilani 2022-03-04 16:38:53 +01:00 committed by GitHub
parent 57bbec4ffd
commit bcdf004082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 54 deletions

1
changelog.d/4642.bugfix Normal file
View file

@ -0,0 +1 @@
Update the top bar in a room: remove topic and typing information

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.Vector.ActionButton" parent="Widget.AppCompat.ActionButton">
<item name="android:paddingStart">5dp</item>
<item name="android:paddingEnd">5dp</item>
<item name="android:minWidth">0dp</item>
</style>
</resources>

View file

@ -141,6 +141,9 @@
<item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item>
<item name="vctr_toast_background">@color/vctr_toast_background_dark</item>
<item name="android:actionButtonStyle">@style/Widget.Vector.ActionButton</item>
</style>
<style name="Theme.Vector.Dark" parent="Base.Theme.Vector.Dark" />

View file

@ -142,6 +142,9 @@
<item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item>
<item name="vctr_toast_background">@color/vctr_toast_background_light</item>
<item name="android:actionButtonStyle">@style/Widget.Vector.ActionButton</item>
</style>
<style name="Theme.Vector.Light" parent="Base.Theme.Vector.Light" />

View file

@ -21,7 +21,6 @@ import android.app.Activity
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.Typeface
import android.net.Uri
import android.os.Build
import android.os.Bundle
@ -1545,7 +1544,7 @@ class TimelineFragment @Inject constructor(
override fun invalidate() = withState(timelineViewModel, messageComposerViewModel) { mainState, messageComposerState ->
invalidateOptionsMenu()
val summary = mainState.asyncRoomSummary()
renderToolbar(summary, mainState.formattedTypingUsers)
renderToolbar(summary)
renderTypingMessageNotification(summary, mainState)
views.removeJitsiWidgetView.render(mainState)
if (mainState.hasFailedSending) {
@ -1614,7 +1613,7 @@ class TimelineFragment @Inject constructor(
}
}
private fun renderToolbar(roomSummary: RoomSummary?, typingMessage: String?) {
private fun renderToolbar(roomSummary: RoomSummary?) {
if (!isThreadTimeLine()) {
views.includeRoomToolbar.roomToolbarContentView.isVisible = true
views.includeThreadToolbar.roomToolbarThreadConstraintLayout.isVisible = false
@ -1624,7 +1623,6 @@ class TimelineFragment @Inject constructor(
views.includeRoomToolbar.roomToolbarContentView.isClickable = roomSummary.membership == Membership.JOIN
views.includeRoomToolbar.roomToolbarTitleView.text = roomSummary.displayName
avatarRenderer.render(roomSummary.toMatrixItem(), views.includeRoomToolbar.roomToolbarAvatarImageView)
renderSubTitle(typingMessage, roomSummary.topic)
views.includeRoomToolbar.roomToolbarDecorationImageView.render(roomSummary.roomEncryptionTrustLevel)
views.includeRoomToolbar.roomToolbarPresenceImageView.render(roomSummary.isDirect, roomSummary.directUserPresence)
views.includeRoomToolbar.roomToolbarPublicImageView.isVisible = roomSummary.isPublic && !roomSummary.isDirect
@ -1642,21 +1640,6 @@ class TimelineFragment @Inject constructor(
}
}
private fun renderSubTitle(typingMessage: String?, topic: String) {
// TODO Temporary place to put typing data
val subtitle = typingMessage?.takeIf { it.isNotBlank() } ?: topic
views.includeRoomToolbar.roomToolbarSubtitleView.apply {
setTextOrHide(subtitle)
if (typingMessage.isNullOrBlank()) {
setTextColor(colorProvider.getColorFromAttribute(R.attr.vctr_content_secondary))
setTypeface(null, Typeface.NORMAL)
} else {
setTextColor(colorProvider.getColorFromAttribute(R.attr.colorPrimary))
setTypeface(null, Typeface.BOLD)
}
}
}
private fun renderSendMessageResult(sendMessageResult: MessageComposerViewEvents.SendMessageResult) {
when (sendMessageResult) {
is MessageComposerViewEvents.SlashCommandLoading -> {

View file

@ -9,8 +9,8 @@
<ImageView
android:id="@+id/roomToolbarAvatarImageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:importantForAccessibility="no"
@ -21,26 +21,26 @@
<im.vector.app.core.ui.views.ShieldImageView
android:id="@+id/roomToolbarDecorationImageView"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
app:layout_constraintBottom_toBottomOf="@id/roomToolbarTitleView"
app:layout_constraintStart_toEndOf="@id/roomToolbarAvatarImageView"
app:layout_constraintTop_toTopOf="@id/roomToolbarTitleView" />
android:layout_width="11dp"
android:layout_height="13dp"
app:layout_constraintCircle="@id/roomToolbarAvatarImageView"
app:layout_constraintCircleAngle="120"
app:layout_constraintCircleRadius="18dp"
tools:ignore="MissingConstraints" />
<im.vector.app.core.ui.views.PresenceStateImageView
android:id="@+id/roomToolbarPresenceImageView"
android:layout_width="12dp"
android:layout_width="11dp"
android:layout_height="12dp"
android:background="@drawable/background_circle"
android:padding="2dp"
android:visibility="gone"
app:layout_constraintCircle="@id/roomToolbarAvatarImageView"
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="20dp"
app:layout_constraintCircleAngle="0"
app:layout_constraintCircleRadius="0dp"
tools:ignore="MissingConstraints"
tools:layout_constraintCircleRadius="8dp"
tools:layout_constraintCircleAngle="60"
tools:layout_constraintCircleRadius="18dp"
tools:src="@drawable/ic_presence_offline"
tools:visibility="visible" />
@ -57,43 +57,25 @@
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="20dp"
tools:ignore="MissingConstraints"
tools:visibility="visible" />
tools:visibility="invisible" />
<TextView
android:id="@+id/roomToolbarTitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.Vector.Widget.ActionBarTitle"
app:layout_constraintBottom_toTopOf="@id/roomToolbarSubtitleView"
app:layout_constraintBottom_toBottomOf="@id/roomToolbarAvatarImageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/roomToolbarDecorationImageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toTopOf="@id/roomToolbarAvatarImageView"
app:layout_constraintVertical_chainStyle="packed"
app:layout_goneMarginStart="7dp"
tools:text="@sample/rooms.json/data/name" />
<TextView
android:id="@+id/roomToolbarSubtitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.Vector.Widget.ActionBarSubTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/roomToolbarAvatarImageView"
app:layout_constraintTop_toBottomOf="@id/roomToolbarTitleView"
tools:text="@sample/rooms.json/data/topic"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>