diff --git a/library/ui-styles/src/main/res/values/colors.xml b/library/ui-styles/src/main/res/values/colors.xml index e3ec542c89..ca6f6d3142 100644 --- a/library/ui-styles/src/main/res/values/colors.xml +++ b/library/ui-styles/src/main/res/values/colors.xml @@ -13,9 +13,6 @@ #14368BD6 @color/palette_azure - #0F0DBD8B - @color/element_system_light - @color/palette_azure @color/palette_melon diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt index 5bb732bdde..46e3edca44 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt @@ -17,6 +17,7 @@ package im.vector.app.features.home.room.detail.timeline.view import android.content.Context +import android.content.res.ColorStateList import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.View @@ -26,12 +27,14 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.core.content.ContextCompat import androidx.core.content.withStyledAttributes +import androidx.core.graphics.ColorUtils import androidx.core.view.updateLayoutParams import com.google.android.material.shape.CornerFamily import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.shape.ShapeAppearanceModel import im.vector.app.R import im.vector.app.core.utils.DimensionConverter +import im.vector.app.features.themes.ThemeUtils class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) @@ -116,7 +119,6 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri } applyTo(bubbleView) } - } private fun createBackgroundDrawable(): Drawable { @@ -133,14 +135,16 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri val shapeAppearanceModelBuilder = ShapeAppearanceModel().toBuilder() val backgroundColor: Int if (isIncoming) { - backgroundColor = R.color.bubble_background_incoming + backgroundColor = ThemeUtils.getColor(context, R.attr.vctr_system) shapeAppearanceModelBuilder .setTopRightCorner(CornerFamily.ROUNDED, cornerRadius) .setBottomRightCorner(CornerFamily.ROUNDED, cornerRadius) .setTopLeftCorner(topCornerFamily, topRadius) .setBottomLeftCorner(bottomCornerFamily, bottomRadius) } else { - backgroundColor = R.color.bubble_background_outgoing + val resolvedColor = ContextCompat.getColor(context, R.color.palette_element_green) + val alpha = if (ThemeUtils.isLightTheme(context)) 0x0E else 0x26 + backgroundColor = ColorUtils.setAlphaComponent(resolvedColor, alpha) shapeAppearanceModelBuilder .setTopLeftCorner(CornerFamily.ROUNDED, cornerRadius) .setBottomLeftCorner(CornerFamily.ROUNDED, cornerRadius) @@ -149,7 +153,7 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri } val shapeAppearanceModel = shapeAppearanceModelBuilder.build() return MaterialShapeDrawable(shapeAppearanceModel).apply { - fillColor = ContextCompat.getColorStateList(context, backgroundColor) + fillColor = ColorStateList.valueOf(backgroundColor) } } } diff --git a/vector/src/main/res/drawable/bg_timeline_incoming_message.xml b/vector/src/main/res/drawable/bg_timeline_incoming_message.xml deleted file mode 100644 index 2cbca33702..0000000000 --- a/vector/src/main/res/drawable/bg_timeline_incoming_message.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/vector/src/main/res/drawable/bg_timeline_outgoing_message.xml b/vector/src/main/res/drawable/bg_timeline_outgoing_message.xml deleted file mode 100644 index 0f75705a77..0000000000 --- a/vector/src/main/res/drawable/bg_timeline_outgoing_message.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/vector/src/main/res/layout/view_message_bubble.xml b/vector/src/main/res/layout/view_message_bubble.xml index 8e9a95222a..8570a3dee2 100644 --- a/vector/src/main/res/layout/view_message_bubble.xml +++ b/vector/src/main/res/layout/view_message_bubble.xml @@ -91,7 +91,6 @@ android:layout_marginStart="0dp" android:layout_marginEnd="0dp" android:addStatesFromChildren="true" - android:background="@drawable/bg_timeline_incoming_message" android:paddingStart="4dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent">