[merge-features] Fix voice messsage bubble layout + SC themes

Change-Id: Idd2dddc8c8f6333ca90fa5411c69e084e3a4cdcf
This commit is contained in:
SpiritCroc 2021-08-01 09:57:01 +02:00
parent 899168e84c
commit 3959a838d1
9 changed files with 31 additions and 5 deletions

View File

@ -18,6 +18,7 @@
<attr name="message_highlight_bg_color" format="color" /> <attr name="message_highlight_bg_color" format="color" />
<attr name="code_block_bg_color" format="color" /> <attr name="code_block_bg_color" format="color" />
<attr name="quote_bar_color" format="color" /> <attr name="quote_bar_color" format="color" />
<attr name="voice_message_playback_background_color" format="color" />
<attr name="user_color_pl_100" format="color" /> <attr name="user_color_pl_100" format="color" />
<attr name="user_color_pl_95" format="color" /> <attr name="user_color_pl_95" format="color" />

View File

@ -133,6 +133,7 @@
<item name="user_color_pl_51">@color/user_color_element_pl_51</item> <item name="user_color_pl_51">@color/user_color_element_pl_51</item>
<item name="user_color_pl_95">@color/user_color_element_pl_95</item> <item name="user_color_pl_95">@color/user_color_element_pl_95</item>
<item name="user_color_pl_100">@color/user_color_element_pl_100</item> <item name="user_color_pl_100">@color/user_color_element_pl_100</item>
<item name="voice_message_playback_background_color">?vctr_content_quinary</item>
<item name="android:statusBarColor">@color/android_status_bar_background_dark</item> <item name="android:statusBarColor">@color/android_status_bar_background_dark</item>
<item name="android:navigationBarColor">@color/android_navigation_bar_background_dark</item> <item name="android:navigationBarColor">@color/android_navigation_bar_background_dark</item>

View File

@ -133,6 +133,7 @@
<item name="user_color_pl_51">@color/user_color_element_pl_51</item> <item name="user_color_pl_51">@color/user_color_element_pl_51</item>
<item name="user_color_pl_95">@color/user_color_element_pl_95</item> <item name="user_color_pl_95">@color/user_color_element_pl_95</item>
<item name="user_color_pl_100">@color/user_color_element_pl_100</item> <item name="user_color_pl_100">@color/user_color_element_pl_100</item>
<item name="voice_message_playback_background_color">?vctr_content_quinary</item>
<!-- Use dark color, to have enough contrast with icons color. windowLightStatusBar is only available in API 23+ --> <!-- Use dark color, to have enough contrast with icons color. windowLightStatusBar is only available in API 23+ -->
<item name="android:statusBarColor">@color/android_status_bar_background_dark</item> <item name="android:statusBarColor">@color/android_status_bar_background_dark</item>

View File

@ -94,6 +94,7 @@
<item name="user_color_pl_51">@color/user_color_sc_pl_51</item> <item name="user_color_pl_51">@color/user_color_sc_pl_51</item>
<item name="user_color_pl_95">@color/user_color_sc_pl_95</item> <item name="user_color_pl_95">@color/user_color_sc_pl_95</item>
<item name="user_color_pl_100">@color/user_color_sc_pl_100</item> <item name="user_color_pl_100">@color/user_color_sc_pl_100</item>
<item name="voice_message_playback_background_color">#1fffffff</item>
<item name="android:statusBarColor">@color/background_black_sc</item> <item name="android:statusBarColor">@color/background_black_sc</item>
<item name="android:navigationBarColor">@color/background_black_sc</item> <item name="android:navigationBarColor">@color/background_black_sc</item>

View File

@ -94,6 +94,7 @@
<item name="user_color_pl_51">@color/user_color_sc_pl_51</item> <item name="user_color_pl_51">@color/user_color_sc_pl_51</item>
<item name="user_color_pl_95">@color/user_color_sc_pl_95</item> <item name="user_color_pl_95">@color/user_color_sc_pl_95</item>
<item name="user_color_pl_100">@color/user_color_sc_pl_100</item> <item name="user_color_pl_100">@color/user_color_sc_pl_100</item>
<item name="voice_message_playback_background_color">#1f000000</item>
<item name="android:statusBarColor">@color/background_black_sc</item> <item name="android:statusBarColor">@color/background_black_sc</item>
<item name="android:navigationBarColor">@color/background_black_sc</item> <item name="android:navigationBarColor">@color/background_black_sc</item>

View File

@ -16,10 +16,12 @@
package im.vector.app.features.home.room.detail.timeline.item package im.vector.app.features.home.room.detail.timeline.item
import android.content.Context
import android.text.format.DateUtils import android.text.format.DateUtils
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.TextView import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.EpoxyModelClass
@ -29,6 +31,7 @@ import im.vector.app.core.epoxy.ClickListener
import im.vector.app.features.home.room.detail.timeline.helper.ContentDownloadStateTrackerBinder import im.vector.app.features.home.room.detail.timeline.helper.ContentDownloadStateTrackerBinder
import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
import im.vector.app.features.home.room.detail.timeline.helper.VoiceMessagePlaybackTracker import im.vector.app.features.home.room.detail.timeline.helper.VoiceMessagePlaybackTracker
import im.vector.app.features.themes.BubbleThemeUtils
@EpoxyModelClass(layout = R.layout.item_timeline_event_base) @EpoxyModelClass(layout = R.layout.item_timeline_event_base)
abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() { abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
@ -128,9 +131,24 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
val voicePlaybackTime by bind<TextView>(R.id.voicePlaybackTime) val voicePlaybackTime by bind<TextView>(R.id.voicePlaybackTime)
val voicePlaybackWaveform by bind<AudioRecordView>(R.id.voicePlaybackWaveform) val voicePlaybackWaveform by bind<AudioRecordView>(R.id.voicePlaybackWaveform)
val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout) val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout)
val voicePlaybackLayout by bind<ConstraintLayout>(R.id.voicePlaybackLayout)
} }
companion object { companion object {
private const val STUB_ID = R.id.messageContentVoiceStub private const val STUB_ID = R.id.messageContentVoiceStub
} }
override fun messageBubbleAllowed(context: Context): Boolean {
return true
}
override fun setBubbleLayout(holder: Holder, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean) {
super.setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
if (BubbleThemeUtils.drawsActualBubbles(bubbleStyle)) {
(holder.voiceLayout.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0
} else {
(holder.voiceLayout.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = holder.voiceLayout.resources.getDimensionPixelSize(R.dimen.no_bubble_margin_end)
}
}
} }

View File

@ -189,9 +189,8 @@
<ViewStub <ViewStub
android:id="@+id/messageContentVoiceStub" android:id="@+id/messageContentVoiceStub"
style="@style/TimelineContentStubBaseParams" style="@style/TimelineContentStubBaseParams"
android:layout_marginEnd="56dp"
android:layout="@layout/item_timeline_event_voice_stub" android:layout="@layout/item_timeline_event_voice_stub"
tools:visibility="visible" /> tools:visibility="gone" />
</FrameLayout> </FrameLayout>

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/voiceLayout" android:id="@+id/voiceLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:minWidth="999999dp"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -11,7 +12,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_voice_playback" android:background="@drawable/bg_voice_playback"
android:backgroundTint="?vctr_content_quinary" android:backgroundTint="?voice_message_playback_background_color"
android:minHeight="48dp" android:minHeight="48dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingTop="6dp" android:paddingTop="6dp"
@ -77,4 +78,4 @@
app:layout_constraintTop_toBottomOf="@+id/voicePlaybackLayout" app:layout_constraintTop_toBottomOf="@+id/voicePlaybackLayout"
tools:visibility="visible" /> tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,4 +6,7 @@
<!-- messageAvatarImageView.marginStart --> <!-- messageAvatarImageView.marginStart -->
<dimen name="dual_bubble_one_side_avatar_offset">8dp</dimen> <dimen name="dual_bubble_one_side_avatar_offset">8dp</dimen>
</resources> <!-- As found in various layout stubs in item_timeline_event_base.xml -->
<dimen name="no_bubble_margin_end">56dp</dimen>
</resources>