From 985e09a68cfff6d7b0abecd9c96ffc679ba1cf15 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 11:03:15 +0200 Subject: [PATCH 1/7] Remove abandoned TODO --- .../timeline/factory/LiveLocationShareMessageItemFactory.kt | 1 - 1 file changed, 1 deletion(-) 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) From d632c866a2a6a3b7c27b7d7df91e4a23406ddd92 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 11:28:28 +0200 Subject: [PATCH 2/7] Center crop the map --- .../timeline/item/DefaultLiveLocationShareStatusItem.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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..df114fe101 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 @@ -20,6 +20,8 @@ import android.content.res.Resources import android.graphics.drawable.ColorDrawable import android.widget.ImageView 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 @@ -51,7 +53,7 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem { } GlideApp.with(mapImageView) .load(R.drawable.bg_no_location_map) - .transform(mapCornerTransformation) + .transform(MultiTransformation(CenterCrop(), mapCornerTransformation)) .into(mapImageView) } From 2a0331dc04e7b009eb3a1bf9233a9e60ae24d6fc Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 11:46:12 +0200 Subject: [PATCH 3/7] Fixing title position inside banner for loading and stop items --- .../item_timeline_event_live_location_inactive_stub.xml | 7 +++++-- .../item_timeline_event_live_location_start_stub.xml | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) 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 @@ From 4bb9a68603e9fa5fc9f16f90512030b72d6054f5 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 12:00:39 +0200 Subject: [PATCH 4/7] Fixing title position inside banner for active live item --- .../res/layout/view_location_live_message_banner.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 @@ From 7f43a1bb06a3244657250f89ea1ac7aafa5bdbe0 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 12:18:07 +0200 Subject: [PATCH 5/7] Updating reply description text --- .../sdk/internal/session/room/send/LocalEchoEventFactory.kt | 2 +- .../im/vector/app/features/home/room/detail/TimelineFragment.kt | 2 +- .../app/features/location/LocationSharingAndroidService.kt | 2 +- vector/src/main/res/values/strings.xml | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) 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/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/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 From 4a817fd9f56912c996008d15c7280f7310780c2e Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 14:49:52 +0200 Subject: [PATCH 6/7] Fixing dark/light loading of the correct map drawable --- .../detail/timeline/item/DefaultLiveLocationShareStatusItem.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 df114fe101..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,6 +19,7 @@ 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 @@ -52,7 +53,7 @@ class DefaultLiveLocationShareStatusItem : LiveLocationShareStatusItem { height = mapHeight } GlideApp.with(mapImageView) - .load(R.drawable.bg_no_location_map) + .load(ContextCompat.getDrawable(mapImageView.context, R.drawable.bg_no_location_map)) .transform(MultiTransformation(CenterCrop(), mapCornerTransformation)) .into(mapImageView) } From d1c631b55c525397e614e680314f4f3beee88bfe Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 20 Jul 2022 14:50:03 +0200 Subject: [PATCH 7/7] Adding changelog entry --- changelog.d/6607.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6607.misc 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