[merge] Live location theming
Change-Id: Ia10af41b946cb5913ce6805095354d23ac3ca251
This commit is contained in:
parent
f96495ddbb
commit
9ef870b927
|
@ -125,6 +125,9 @@
|
|||
|
||||
<!-- Voice Message -->
|
||||
<item name="vctr_toast_background">?colorBackgroundFloating</item>
|
||||
|
||||
<!-- Location sharing -->
|
||||
<item name="vctr_live_location">?colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Base.SC.Dark">
|
||||
|
|
|
@ -121,6 +121,9 @@
|
|||
|
||||
<!-- Voice Message -->
|
||||
<item name="vctr_toast_background">@color/background_floating_sc</item> <!-- needs dark background -->
|
||||
|
||||
<!-- Location sharing -->
|
||||
<item name="vctr_live_location">?colorAccent</item>
|
||||
</style>
|
||||
|
||||
<!-- Default AppTheme for usage where settings don't apply -->
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.app.features.home.room.detail.timeline.item
|
|||
|
||||
import android.content.res.Resources
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners
|
||||
|
@ -42,6 +43,8 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem {
|
|||
) {
|
||||
val mapCornerTransformation = if (messageLayout is TimelineMessageLayout.Bubble) {
|
||||
messageLayout.cornersRadius.granularRoundedCorners()
|
||||
} else if (messageLayout is TimelineMessageLayout.ScBubble) {
|
||||
RoundedCorners(messageLayout.bubbleAppearance.getBubbleRadiusDp(mapImageView.context).toInt())
|
||||
} else {
|
||||
RoundedCorners(getDefaultLayoutCornerRadiusInDp(mapImageView.resources))
|
||||
}
|
||||
|
@ -49,8 +52,10 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem {
|
|||
width = mapWidth
|
||||
height = mapHeight
|
||||
}
|
||||
// Yes, usually one would do this using drawable-v24... which glide seems to ignore?
|
||||
val resource = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) R.drawable.bg_no_location_map_themed else R.drawable.bg_no_location_map
|
||||
GlideApp.with(mapImageView)
|
||||
.load(R.drawable.bg_no_location_map)
|
||||
.load(resource)
|
||||
.transform(mapCornerTransformation)
|
||||
.into(mapImageView)
|
||||
}
|
||||
|
@ -63,6 +68,9 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem {
|
|||
messageLayout.cornersRadius.bottomEndRadius,
|
||||
messageLayout.cornersRadius.bottomStartRadius
|
||||
)
|
||||
} else if (messageLayout is TimelineMessageLayout.ScBubble) {
|
||||
val radius = messageLayout.bubbleAppearance.getBubbleRadiusDp(bannerImageView.context)
|
||||
GranularRoundedCorners(0f, 0f, radius, radius)
|
||||
} else {
|
||||
val bottomCornerRadius = getDefaultLayoutCornerRadiusInDp(bannerImageView.resources).toFloat()
|
||||
GranularRoundedCorners(0f, 0f, bottomCornerRadius, bottomCornerRadius)
|
||||
|
|
|
@ -78,6 +78,23 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
bottomEndCornerRadiusInDp = messageLayout.cornersRadius.bottomEndRadius,
|
||||
formattedLocalTimeOfEndOfLive = getFormattedLocalTimeEndOfLive(),
|
||||
)
|
||||
messageLayout is TimelineMessageLayout.ScBubble && isEmitter -> {
|
||||
val radius = messageLayout.bubbleAppearance.getBubbleRadiusDp(holder.view.context)
|
||||
LocationLiveMessageBannerViewState.Emitter(
|
||||
remainingTimeInMillis = getRemainingTimeOfLiveInMillis(),
|
||||
bottomStartCornerRadiusInDp = radius,
|
||||
bottomEndCornerRadiusInDp = radius,
|
||||
isStopButtonCenteredVertically = false
|
||||
)
|
||||
}
|
||||
messageLayout is TimelineMessageLayout.ScBubble -> {
|
||||
val radius = messageLayout.bubbleAppearance.getBubbleRadiusDp(holder.view.context)
|
||||
LocationLiveMessageBannerViewState.Watcher(
|
||||
bottomStartCornerRadiusInDp = radius,
|
||||
bottomEndCornerRadiusInDp = radius,
|
||||
formattedLocalTimeOfEndOfLive = getFormattedLocalTimeEndOfLive(),
|
||||
)
|
||||
}
|
||||
isEmitter -> {
|
||||
val cornerRadius = getBannerCornerRadiusForDefaultLayout(holder)
|
||||
LocationLiveMessageBannerViewState.Emitter(
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- map.svg from matrix-react-sdk converted to Android vector graphic -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="212dp"
|
||||
android:height="139dp"
|
||||
android:viewportWidth="848"
|
||||
android:viewportHeight="556">
|
||||
|
||||
<path
|
||||
android:fillColor="?android:colorBackground"
|
||||
android:pathData="M 424.936 -217.916 C 698.735583007 -217.916 920.694 4.04241699339 920.694 277.842 C 920.694 551.641583007 698.735583007 773.6 424.936 773.6 C 151.136416993 773.6 -70.822 551.641583007 -70.822 277.842 C -70.822 4.04241699339 151.136416993 -217.916 424.936 -217.916 Z" />
|
||||
<path
|
||||
android:fillColor="?sc_message_bg_incoming"
|
||||
android:pathData="M424.935 874.689C754.565 874.689 1021.78 607.472 1021.78 277.842C1021.78
|
||||
-51.7871 754.565 -319.005 424.935 -319.005C95.3061 -319.005 -171.911 -51.7871
|
||||
-171.911 277.842C-171.911 607.472 95.3061 874.689 424.935 874.689ZM-46.5437
|
||||
6.90497L920.479 442.347L873.141 547.473L438.188 351.617L218.986 834.499L114.004
|
||||
786.843L333.061 304.28L-93.8812 112.031L-46.5437 6.90497Z" />
|
||||
</vector>
|
|
@ -13,6 +13,7 @@
|
|||
android:contentDescription="@string/a11y_static_map_image"
|
||||
android:src="@drawable/bg_no_location_map"
|
||||
android:scaleType="fitXY"
|
||||
tools:src="@drawable/bg_no_location_map_themed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue