From 46684702a157070e0bcd879af72bfd4aade72180 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 25 Jul 2022 09:46:41 +0200 Subject: [PATCH 01/12] Hiding bottom sheet when no more lives --- .../location/live/map/LocationLiveMapViewFragment.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt b/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt index e19580f13b..bbb838a41a 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt @@ -22,6 +22,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.graphics.drawable.toBitmap +import androidx.core.view.isGone +import androidx.core.view.isVisible import androidx.lifecycle.lifecycleScope import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState @@ -57,7 +59,6 @@ import javax.inject.Inject /** * Screen showing a map with all the current users sharing their live location in a room. */ - @AndroidEntryPoint class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment() { @@ -173,7 +174,13 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment) { - bottomSheetController.setData(userLocations) + if (userLocations.isEmpty()) { + views.bottomSheet.isGone = true + // TODO show Live location ended view + } else { + views.bottomSheet.isVisible = true + bottomSheetController.setData(userLocations) + } } private fun updateMap(userLiveLocations: List) { From 1276b1218888bb1ef5a52ac423658f41889e84ea Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 25 Jul 2022 09:48:26 +0200 Subject: [PATCH 02/12] Renaming banner view for running live --- .../timeline/item/MessageLiveLocationItem.kt | 10 +-- ...ew.kt => LocationLiveRunningBannerView.kt} | 6 +- .../item_timeline_event_location_stub.xml | 2 +- .../view_location_live_running_banner.xml | 67 +++++++++++++++++++ 4 files changed, 76 insertions(+), 9 deletions(-) rename vector/src/main/java/im/vector/app/features/location/live/{LocationLiveMessageBannerView.kt => LocationLiveRunningBannerView.kt} (96%) create mode 100644 vector/src/main/res/layout/view_location_live_running_banner.xml diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationItem.kt index 84080eaad9..03b9a04008 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationItem.kt @@ -26,7 +26,7 @@ import im.vector.app.core.resources.toTimestamp import im.vector.app.core.utils.DimensionConverter import im.vector.app.features.home.room.detail.RoomDetailAction import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout -import im.vector.app.features.location.live.LocationLiveMessageBannerView +import im.vector.app.features.location.live.LocationLiveRunningBannerView import im.vector.app.features.location.live.LocationLiveMessageBannerViewState import org.threeten.bp.LocalDateTime @@ -52,9 +52,9 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem(R.id.locationLiveMessageBanner) + val locationLiveRunningBanner by bind(R.id.locationLiveMessageBanner) } companion object { diff --git a/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveRunningBannerView.kt similarity index 96% rename from vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt rename to vector/src/main/java/im/vector/app/features/location/live/LocationLiveRunningBannerView.kt index 51c7caed3a..1786ccdb8b 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveRunningBannerView.kt @@ -31,19 +31,19 @@ import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners import im.vector.app.R import im.vector.app.core.glide.GlideApp import im.vector.app.core.utils.TextUtils -import im.vector.app.databinding.ViewLocationLiveMessageBannerBinding +import im.vector.app.databinding.ViewLocationLiveRunningBannerBinding import im.vector.app.features.themes.ThemeUtils import org.threeten.bp.Duration private const val REMAINING_TIME_COUNTER_INTERVAL_IN_MS = 1000L -class LocationLiveMessageBannerView @JvmOverloads constructor( +class LocationLiveRunningBannerView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr) { - private val binding = ViewLocationLiveMessageBannerBinding.inflate( + private val binding = ViewLocationLiveRunningBannerBinding.inflate( LayoutInflater.from(context), this ) diff --git a/vector/src/main/res/layout/item_timeline_event_location_stub.xml b/vector/src/main/res/layout/item_timeline_event_location_stub.xml index a696140669..54de86e57f 100644 --- a/vector/src/main/res/layout/item_timeline_event_location_stub.xml +++ b/vector/src/main/res/layout/item_timeline_event_location_stub.xml @@ -45,7 +45,7 @@ app:layout_constraintTop_toBottomOf="@id/staticMapPinImageView" tools:visibility="visible" /> - + + + + + + + + + + +