diff --git a/changelog.d/6607.misc b/changelog.d/6607.misc new file mode 100644 index 0000000000..c56c3fca92 --- /dev/null +++ b/changelog.d/6607.misc @@ -0,0 +1 @@ +[Location sharing] - Small improvements of UI for live diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt index 6c5df1f4e4..9f71d476c7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt @@ -713,7 +713,7 @@ internal class LocalEchoEventFactory @Inject constructor( MessageType.MSGTYPE_AUDIO -> return TextContent("sent an audio file.") MessageType.MSGTYPE_IMAGE -> return TextContent("sent an image.") MessageType.MSGTYPE_VIDEO -> return TextContent("sent a video.") - MessageType.MSGTYPE_BEACON_INFO -> return TextContent(content.body.ensureNotEmpty() ?: "shared live location.") + MessageType.MSGTYPE_BEACON_INFO -> return TextContent(content.body.ensureNotEmpty() ?: "Live location") MessageType.MSGTYPE_POLL_START -> { return TextContent((content as? MessagePollContent)?.getBestPollCreationInfo()?.question?.getBestQuestion() ?: "") } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index f336ffc67c..eb27e7d996 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -1257,7 +1257,7 @@ class TimelineFragment @Inject constructor( val nonFormattedBody = when (messageContent) { is MessageAudioContent -> getAudioContentBodyText(messageContent) is MessagePollContent -> messageContent.getBestPollCreationInfo()?.question?.getBestQuestion() - is MessageBeaconInfoContent -> getString(R.string.sent_live_location) + is MessageBeaconInfoContent -> getString(R.string.live_location_description) else -> messageContent?.body.orEmpty() } var formattedBody: CharSequence? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationShareMessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationShareMessageItemFactory.kt index a4c906d97b..493602a291 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationShareMessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationShareMessageItemFactory.kt @@ -102,7 +102,6 @@ class LiveLocationShareMessageItemFactory @Inject constructor( attributes: AbsMessageItem.Attributes, runningState: LiveLocationShareViewState.Running, ): MessageLiveLocationItem { - // TODO only render location if enabled in preferences: to be handled in a next PR val width = timelineMediaSizeProvider.getMaxSize().first val height = dimensionConverter.dpToPx(MessageItemFactory.MESSAGE_LOCATION_ITEM_HEIGHT_IN_DP) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/DefaultLiveLocationShareStatusItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/DefaultLiveLocationShareStatusItem.kt index c421efda12..9a729caa31 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/DefaultLiveLocationShareStatusItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/DefaultLiveLocationShareStatusItem.kt @@ -19,7 +19,10 @@ package im.vector.app.features.home.room.detail.timeline.item import android.content.res.Resources import android.graphics.drawable.ColorDrawable import android.widget.ImageView +import androidx.core.content.ContextCompat import androidx.core.view.updateLayoutParams +import com.bumptech.glide.load.MultiTransformation +import com.bumptech.glide.load.resource.bitmap.CenterCrop import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners import im.vector.app.R @@ -50,8 +53,8 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem { height = mapHeight } GlideApp.with(mapImageView) - .load(R.drawable.bg_no_location_map) - .transform(mapCornerTransformation) + .load(ContextCompat.getDrawable(mapImageView.context, R.drawable.bg_no_location_map)) + .transform(MultiTransformation(CenterCrop(), mapCornerTransformation)) .into(mapImageView) } diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingAndroidService.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingAndroidService.kt index dd18658059..635c0bf87d 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationSharingAndroidService.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingAndroidService.kt @@ -122,7 +122,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca ?.locationSharingService() ?.startLiveLocationShare( timeoutMillis = roomArgs.durationMillis, - description = getString(R.string.sent_live_location) + description = getString(R.string.live_location_description) ) updateLiveResult diff --git a/vector/src/main/res/layout/item_timeline_event_live_location_inactive_stub.xml b/vector/src/main/res/layout/item_timeline_event_live_location_inactive_stub.xml index d5a0cefb28..ba0ff33230 100644 --- a/vector/src/main/res/layout/item_timeline_event_live_location_inactive_stub.xml +++ b/vector/src/main/res/layout/item_timeline_event_live_location_inactive_stub.xml @@ -56,13 +56,16 @@ diff --git a/vector/src/main/res/layout/view_location_live_message_banner.xml b/vector/src/main/res/layout/view_location_live_message_banner.xml index 5c8f3a8970..f13696a5c7 100644 --- a/vector/src/main/res/layout/view_location_live_message_banner.xml +++ b/vector/src/main/res/layout/view_location_live_message_banner.xml @@ -34,11 +34,15 @@ diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index b162814a9d..1da05097f7 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3126,6 +3126,8 @@ You don’t have permission to share live location You need to have the right permissions in order to share live location in this room. Share location + + Live location Show Message bubbles