Restore pre-v1.4.4 toolbar

New one has borked presence indicator, and overall doesn't look as nice
as the old one, including the new typing indicator, imo.

Change-Id: I9e1fa0f6677905d051f0d9557f8a79b3c4c86e2b
This commit is contained in:
SpiritCroc 2022-03-10 20:04:26 +01:00
parent 9cb64f0592
commit 38cfd2ab2f
2 changed files with 62 additions and 25 deletions

View File

@ -22,6 +22,7 @@ import android.content.Intent
import android.content.res.ColorStateList
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
@ -172,6 +173,7 @@ import im.vector.app.features.home.room.detail.upgrade.MigrateRoomBottomSheet
import im.vector.app.features.home.room.detail.views.RoomDetailLazyLoadedViews
import im.vector.app.features.home.room.detail.widget.RoomWidgetsBottomSheet
import im.vector.app.features.home.room.threads.arguments.ThreadTimelineArgs
import im.vector.app.features.home.room.typing.TypingHelper
import im.vector.app.features.html.EventHtmlRenderer
import im.vector.app.features.html.PillImageSpan
import im.vector.app.features.html.PillsPostProcessor
@ -265,6 +267,7 @@ class TimelineFragment @Inject constructor(
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
private val callManager: WebRtcCallManager,
private val voiceMessagePlaybackTracker: VoiceMessagePlaybackTracker,
private val typingHelper: TypingHelper,
private val clock: Clock
) :
VectorBaseFragment<FragmentTimelineBinding>(),
@ -1704,6 +1707,14 @@ class TimelineFragment @Inject constructor(
}
private fun renderTypingMessageNotification(roomSummary: RoomSummary?, state: RoomDetailViewState) {
// SC-TODO: setting?
// Old-school toolbar indicator
if (roomSummary != null) {
val typingMessage = typingHelper.getTypingMessage(state.typingUsers ?: listOf())
renderSubTitle(typingMessage, roomSummary.topic)
return
}
/* New bottom typing indicator
if (!isThreadTimeLine() && roomSummary != null) {
views.typingMessageView.isInvisibleOrGone = state.typingUsers.isNullOrEmpty()
state.typingUsers
@ -1712,6 +1723,7 @@ class TimelineFragment @Inject constructor(
} else {
views.typingMessageView.isInvisibleOrGone = true
}
*/
}
private fun renderToolbar(roomSummary: RoomSummary?) {
@ -1741,6 +1753,20 @@ class TimelineFragment @Inject constructor(
}
}
private fun renderSubTitle(typingMessage: String?, topic: String) {
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="34dp"
android:layout_height="34dp"
android:layout_width="40dp"
android:layout_height="40dp"
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="11dp"
android:layout_height="13dp"
app:layout_constraintCircle="@id/roomToolbarAvatarImageView"
app:layout_constraintCircleAngle="120"
app:layout_constraintCircleRadius="18dp"
tools:ignore="MissingConstraints" />
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" />
<im.vector.app.core.ui.views.PresenceStateImageView
android:id="@+id/roomToolbarPresenceImageView"
android:layout_width="11dp"
android:layout_width="12dp"
android:layout_height="12dp"
android:background="@drawable/toolbar_background_circle"
android:padding="2dp"
android:visibility="gone"
app:layout_constraintCircle="@id/roomToolbarAvatarImageView"
app:layout_constraintCircleAngle="0"
app:layout_constraintCircleRadius="0dp"
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="20dp"
tools:ignore="MissingConstraints"
tools:layout_constraintCircleAngle="60"
tools:layout_constraintCircleRadius="18dp"
tools:layout_constraintCircleRadius="8dp"
tools:src="@drawable/ic_presence_offline"
tools:visibility="visible" />
@ -58,32 +58,43 @@
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="20dp"
tools:ignore="MissingConstraints"
tools:visibility="invisible" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/imageGroupBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="roomToolbarDecorationImageView,roomToolbarAvatarImageView,roomToolbarPresenceImageView,roomToolbarPublicImageView" />
tools:visibility="visible" />
<TextView
android:id="@+id/roomToolbarTitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.Vector.Widget.ActionBarTitle"
app:layout_constraintBottom_toBottomOf="@id/roomToolbarAvatarImageView"
app:layout_constraintBottom_toTopOf="@id/roomToolbarSubtitleView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/imageGroupBarrier"
app:layout_constraintTop_toTopOf="@id/roomToolbarAvatarImageView"
app:layout_constraintStart_toEndOf="@id/roomToolbarDecorationImageView"
app:layout_constraintTop_toTopOf="parent"
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>