mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Align naming of components for the live location feature
This commit is contained in:
parent
1411fdd99f
commit
be696f5a5c
33 changed files with 191 additions and 191 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="LocationLiveEndedBannerView">
|
||||
<declare-styleable name="LiveLocationEndedBannerView">
|
||||
<attr name="locLiveEndedBkgWithAlpha" format="boolean" />
|
||||
<attr name="locLiveEndedIconMarginStart" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Widget.Vector.Button.Text.OnPrimary.LocationLive">
|
||||
<style name="Widget.Vector.Button.Text.OnPrimary.LiveLocation">
|
||||
<item name="android:foreground">?selectableItemBackground</item>
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<item name="android:insetLeft">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Vector.Button.Text.LocationLive">
|
||||
<style name="Widget.Vector.Button.Text.LiveLocation">
|
||||
<item name="android:foreground">?selectableItemBackground</item>
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance.Vector.Body.Medium</item>
|
||||
|
|
|
@ -347,7 +347,7 @@
|
|||
<activity android:name=".features.spaces.leave.SpaceLeaveAdvancedActivity" />
|
||||
<activity android:name=".features.poll.create.CreatePollActivity" />
|
||||
<activity android:name=".features.location.LocationSharingActivity" />
|
||||
<activity android:name=".features.location.live.map.LocationLiveMapViewActivity" />
|
||||
<activity android:name=".features.location.live.map.LiveLocationMapViewActivity" />
|
||||
<activity android:name=".features.settings.font.FontScaleSettingActivity"/>
|
||||
|
||||
<!-- Services -->
|
||||
|
|
|
@ -55,7 +55,7 @@ import im.vector.app.features.home.room.list.home.HomeRoomListViewModel
|
|||
import im.vector.app.features.homeserver.HomeServerCapabilitiesViewModel
|
||||
import im.vector.app.features.invite.InviteUsersToRoomViewModel
|
||||
import im.vector.app.features.location.LocationSharingViewModel
|
||||
import im.vector.app.features.location.live.map.LocationLiveMapViewModel
|
||||
import im.vector.app.features.location.live.map.LiveLocationMapViewModel
|
||||
import im.vector.app.features.login.LoginViewModel
|
||||
import im.vector.app.features.login2.LoginViewModel2
|
||||
import im.vector.app.features.login2.created.AccountCreatedViewModel
|
||||
|
@ -612,8 +612,8 @@ interface MavericksViewModelModule {
|
|||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@MavericksViewModelKey(LocationLiveMapViewModel::class)
|
||||
fun locationLiveMapViewModelFactory(factory: LocationLiveMapViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
|
||||
@MavericksViewModelKey(LiveLocationMapViewModel::class)
|
||||
fun liveLocationMapViewModelFactory(factory: LiveLocationMapViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
|
|
|
@ -656,8 +656,8 @@ class TimelineFragment @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun navigateToLocationLiveMap() {
|
||||
navigator.openLocationLiveMap(
|
||||
private fun navigateToLiveLocationMap() {
|
||||
navigator.openLiveLocationMap(
|
||||
context = requireContext(),
|
||||
roomId = timelineArgs.roomId
|
||||
)
|
||||
|
@ -857,7 +857,7 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun setupLiveLocationIndicator() {
|
||||
views.locationLiveStatusIndicator.stopButton.debouncedClicks {
|
||||
views.liveLocationStatusIndicator.stopButton.debouncedClicks {
|
||||
timelineViewModel.handle(RoomDetailAction.StopLiveLocationSharing)
|
||||
}
|
||||
views.locationLiveStatusIndicator.debouncedClicks {
|
||||
|
@ -1688,7 +1688,7 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun updateLiveLocationIndicator(isSharingLiveLocation: Boolean) {
|
||||
views.locationLiveStatusIndicator.isVisible = isSharingLiveLocation
|
||||
views.liveLocationStatusIndicator.isVisible = isSharingLiveLocation
|
||||
}
|
||||
|
||||
private fun FragmentTimelineBinding.hideComposerViews() {
|
||||
|
@ -2068,7 +2068,7 @@ class TimelineFragment @Inject constructor(
|
|||
handleShowLocationPreview(messageContent, informationData.senderId)
|
||||
}
|
||||
is MessageBeaconInfoContent -> {
|
||||
navigateToLocationLiveMap()
|
||||
navigateToLiveLocationMap()
|
||||
}
|
||||
else -> {
|
||||
val handled = onThreadSummaryClicked(informationData.eventId, isRootThreadEvent)
|
||||
|
|
|
@ -42,8 +42,8 @@ abstract class MessageLiveLocationInactiveItem :
|
|||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageItem.Holder(STUB_ID) {
|
||||
val bannerImageView by bind<ImageView>(R.id.locationLiveEndedBannerBackground)
|
||||
val noLocationMapImageView by bind<ImageView>(R.id.locationLiveInactiveMap)
|
||||
val bannerImageView by bind<ImageView>(R.id.liveLocationEndedBannerBackground)
|
||||
val noLocationMapImageView by bind<ImageView>(R.id.liveLocationInactiveMap)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -26,8 +26,8 @@ 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.LocationLiveMessageBannerViewState
|
||||
import im.vector.app.features.location.live.LocationLiveRunningBannerView
|
||||
import im.vector.app.features.location.live.LiveLocationMessageBannerViewState
|
||||
import im.vector.app.features.location.live.LiveLocationRunningBannerView
|
||||
import org.threeten.bp.LocalDateTime
|
||||
|
||||
@EpoxyModelClass
|
||||
|
@ -44,17 +44,17 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
bindLocationLiveBanner(holder)
|
||||
bindLiveLocationBanner(holder)
|
||||
}
|
||||
|
||||
private fun bindLocationLiveBanner(holder: Holder) {
|
||||
private fun bindLiveLocationBanner(holder: Holder) {
|
||||
// TODO in a future PR add check on device id to confirm that is the one that sent the beacon
|
||||
val isEmitter = currentUserId != null && currentUserId == locationUserId
|
||||
val messageLayout = attributes.informationData.messageLayout
|
||||
val viewState = buildViewState(holder, messageLayout, isEmitter)
|
||||
holder.locationLiveRunningBanner.isVisible = true
|
||||
holder.locationLiveRunningBanner.render(viewState)
|
||||
holder.locationLiveRunningBanner.stopButton.setOnClickListener {
|
||||
holder.liveLocationRunningBanner.isVisible = true
|
||||
holder.liveLocationRunningBanner.render(viewState)
|
||||
holder.liveLocationRunningBanner.stopButton.setOnClickListener {
|
||||
attributes.callback?.onTimelineItemAction(RoomDetailAction.StopLiveLocationSharing)
|
||||
}
|
||||
}
|
||||
|
@ -63,24 +63,24 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
holder: Holder,
|
||||
messageLayout: TimelineMessageLayout,
|
||||
isEmitter: Boolean
|
||||
): LocationLiveMessageBannerViewState {
|
||||
): LiveLocationMessageBannerViewState {
|
||||
return when {
|
||||
messageLayout is TimelineMessageLayout.Bubble && isEmitter ->
|
||||
LocationLiveMessageBannerViewState.Emitter(
|
||||
LiveLocationMessageBannerViewState.Emitter(
|
||||
remainingTimeInMillis = getRemainingTimeOfLiveInMillis(),
|
||||
bottomStartCornerRadiusInDp = messageLayout.cornersRadius.bottomStartRadius,
|
||||
bottomEndCornerRadiusInDp = messageLayout.cornersRadius.bottomEndRadius,
|
||||
isStopButtonCenteredVertically = false
|
||||
)
|
||||
messageLayout is TimelineMessageLayout.Bubble ->
|
||||
LocationLiveMessageBannerViewState.Watcher(
|
||||
LiveLocationMessageBannerViewState.Watcher(
|
||||
bottomStartCornerRadiusInDp = messageLayout.cornersRadius.bottomStartRadius,
|
||||
bottomEndCornerRadiusInDp = messageLayout.cornersRadius.bottomEndRadius,
|
||||
formattedLocalTimeOfEndOfLive = getFormattedLocalTimeEndOfLive(),
|
||||
)
|
||||
isEmitter -> {
|
||||
val cornerRadius = getBannerCornerRadiusForDefaultLayout(holder)
|
||||
LocationLiveMessageBannerViewState.Emitter(
|
||||
LiveLocationMessageBannerViewState.Emitter(
|
||||
remainingTimeInMillis = getRemainingTimeOfLiveInMillis(),
|
||||
bottomStartCornerRadiusInDp = cornerRadius,
|
||||
bottomEndCornerRadiusInDp = cornerRadius,
|
||||
|
@ -89,7 +89,7 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
}
|
||||
else -> {
|
||||
val cornerRadius = getBannerCornerRadiusForDefaultLayout(holder)
|
||||
LocationLiveMessageBannerViewState.Watcher(
|
||||
LiveLocationMessageBannerViewState.Watcher(
|
||||
bottomStartCornerRadiusInDp = cornerRadius,
|
||||
bottomEndCornerRadiusInDp = cornerRadius,
|
||||
formattedLocalTimeOfEndOfLive = getFormattedLocalTimeEndOfLive(),
|
||||
|
@ -112,7 +112,7 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageLocationItem.Holder(STUB_ID) {
|
||||
val locationLiveRunningBanner by bind<LocationLiveRunningBannerView>(R.id.locationLiveRunningBanner)
|
||||
val liveLocationRunningBanner by bind<LiveLocationRunningBannerView>(R.id.liveLocationRunningBanner)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -42,8 +42,8 @@ abstract class MessageLiveLocationStartItem :
|
|||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageItem.Holder(STUB_ID) {
|
||||
val bannerImageView by bind<ImageView>(R.id.locationLiveStartBanner)
|
||||
val noLocationMapImageView by bind<ImageView>(R.id.locationLiveStartMap)
|
||||
val bannerImageView by bind<ImageView>(R.id.liveLocationStartBanner)
|
||||
val noLocationMapImageView by bind<ImageView>(R.id.liveLocationStartMap)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -24,17 +24,17 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
|||
import androidx.core.content.res.use
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import im.vector.app.R
|
||||
import im.vector.app.databinding.ViewLocationLiveEndedBannerBinding
|
||||
import im.vector.app.databinding.ViewLiveLocationEndedBannerBinding
|
||||
|
||||
private const val BACKGROUND_ALPHA = 0.75f
|
||||
|
||||
class LocationLiveEndedBannerView @JvmOverloads constructor(
|
||||
class LiveLocationEndedBannerView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val binding = ViewLocationLiveEndedBannerBinding.inflate(
|
||||
private val binding = ViewLiveLocationEndedBannerBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
this
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ class LocationLiveEndedBannerView @JvmOverloads constructor(
|
|||
init {
|
||||
context.obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.LocationLiveEndedBannerView,
|
||||
R.styleable.LiveLocationEndedBannerView,
|
||||
0,
|
||||
0
|
||||
).use {
|
||||
|
@ -52,13 +52,13 @@ class LocationLiveEndedBannerView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
private fun setBackgroundAlpha(typedArray: TypedArray) {
|
||||
val withAlpha = typedArray.getBoolean(R.styleable.LocationLiveEndedBannerView_locLiveEndedBkgWithAlpha, false)
|
||||
binding.locationLiveEndedBannerBackground.alpha = if (withAlpha) BACKGROUND_ALPHA else 1f
|
||||
val withAlpha = typedArray.getBoolean(R.styleable.LiveLocationEndedBannerView_locLiveEndedBkgWithAlpha, false)
|
||||
binding.liveLocationEndedBannerBackground.alpha = if (withAlpha) BACKGROUND_ALPHA else 1f
|
||||
}
|
||||
|
||||
private fun setIconMarginStart(typedArray: TypedArray) {
|
||||
val margin = typedArray.getDimensionPixelOffset(R.styleable.LocationLiveEndedBannerView_locLiveEndedIconMarginStart, 0)
|
||||
binding.locationLiveEndedBannerIcon.updateLayoutParams<MarginLayoutParams> {
|
||||
val margin = typedArray.getDimensionPixelOffset(R.styleable.LiveLocationEndedBannerView_locLiveEndedIconMarginStart, 0)
|
||||
binding.liveLocationEndedBannerIcon.updateLayoutParams<MarginLayoutParams> {
|
||||
marginStart = margin
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package im.vector.app.features.location.live
|
||||
|
||||
sealed class LocationLiveMessageBannerViewState(
|
||||
sealed class LiveLocationMessageBannerViewState(
|
||||
open val bottomStartCornerRadiusInDp: Float,
|
||||
open val bottomEndCornerRadiusInDp: Float,
|
||||
) {
|
||||
|
@ -26,11 +26,11 @@ sealed class LocationLiveMessageBannerViewState(
|
|||
override val bottomEndCornerRadiusInDp: Float,
|
||||
val remainingTimeInMillis: Long,
|
||||
val isStopButtonCenteredVertically: Boolean
|
||||
) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp)
|
||||
) : LiveLocationMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp)
|
||||
|
||||
data class Watcher(
|
||||
override val bottomStartCornerRadiusInDp: Float,
|
||||
override val bottomEndCornerRadiusInDp: Float,
|
||||
val formattedLocalTimeOfEndOfLive: String,
|
||||
) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp)
|
||||
) : LiveLocationMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp)
|
||||
}
|
|
@ -31,51 +31,51 @@ 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.ViewLocationLiveRunningBannerBinding
|
||||
import im.vector.app.databinding.ViewLiveLocationRunningBannerBinding
|
||||
import im.vector.app.features.themes.ThemeUtils
|
||||
import org.threeten.bp.Duration
|
||||
|
||||
private const val REMAINING_TIME_COUNTER_INTERVAL_IN_MS = 1000L
|
||||
|
||||
class LocationLiveRunningBannerView @JvmOverloads constructor(
|
||||
class LiveLocationRunningBannerView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val binding = ViewLocationLiveRunningBannerBinding.inflate(
|
||||
private val binding = ViewLiveLocationRunningBannerBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
this
|
||||
)
|
||||
|
||||
val stopButton: Button
|
||||
get() = binding.locationLiveRunningBannerStop
|
||||
get() = binding.liveLocationRunningBannerStop
|
||||
|
||||
private val background: ImageView
|
||||
get() = binding.locationLiveRunningBannerBackground
|
||||
get() = binding.liveLocationRunningBannerBackground
|
||||
|
||||
private val title: TextView
|
||||
get() = binding.locationLiveRunningBannerTitle
|
||||
get() = binding.liveLocationRunningBannerTitle
|
||||
|
||||
private val subTitle: TextView
|
||||
get() = binding.locationLiveRunningBannerSubTitle
|
||||
get() = binding.liveLocationRunningBannerSubTitle
|
||||
|
||||
private var countDownTimer: CountDownTimer? = null
|
||||
|
||||
fun render(viewState: LocationLiveMessageBannerViewState) {
|
||||
fun render(viewState: LiveLocationMessageBannerViewState) {
|
||||
when (viewState) {
|
||||
is LocationLiveMessageBannerViewState.Emitter -> renderEmitter(viewState)
|
||||
is LocationLiveMessageBannerViewState.Watcher -> renderWatcher(viewState)
|
||||
is LiveLocationMessageBannerViewState.Emitter -> renderEmitter(viewState)
|
||||
is LiveLocationMessageBannerViewState.Watcher -> renderWatcher(viewState)
|
||||
}
|
||||
|
||||
GlideApp.with(context)
|
||||
.load(ColorDrawable(ThemeUtils.getColor(context, android.R.attr.colorBackground)))
|
||||
.placeholder(binding.locationLiveRunningBannerBackground.drawable)
|
||||
.placeholder(binding.liveLocationRunningBannerBackground.drawable)
|
||||
.transform(GranularRoundedCorners(0f, 0f, viewState.bottomEndCornerRadiusInDp, viewState.bottomStartCornerRadiusInDp))
|
||||
.into(background)
|
||||
}
|
||||
|
||||
private fun renderEmitter(viewState: LocationLiveMessageBannerViewState.Emitter) {
|
||||
private fun renderEmitter(viewState: LiveLocationMessageBannerViewState.Emitter) {
|
||||
stopButton.isVisible = true
|
||||
title.text = context.getString(R.string.location_share_live_enabled)
|
||||
|
||||
|
@ -109,21 +109,21 @@ class LocationLiveRunningBannerView @JvmOverloads constructor(
|
|||
|
||||
if (viewState.isStopButtonCenteredVertically) {
|
||||
constraintSet.connect(
|
||||
R.id.locationLiveRunningBannerStop,
|
||||
R.id.liveLocationRunningBannerStop,
|
||||
ConstraintSet.BOTTOM,
|
||||
R.id.locationLiveRunningBannerBackground,
|
||||
R.id.liveLocationRunningBannerBackground,
|
||||
ConstraintSet.BOTTOM,
|
||||
0
|
||||
)
|
||||
} else {
|
||||
constraintSet.clear(R.id.locationLiveRunningBannerStop, ConstraintSet.BOTTOM)
|
||||
constraintSet.clear(R.id.liveLocationRunningBannerStop, ConstraintSet.BOTTOM)
|
||||
}
|
||||
|
||||
constraintSet.applyTo(parentLayout)
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderWatcher(viewState: LocationLiveMessageBannerViewState.Watcher) {
|
||||
private fun renderWatcher(viewState: LiveLocationMessageBannerViewState.Watcher) {
|
||||
stopButton.isVisible = false
|
||||
title.text = context.getString(R.string.location_share_live_view)
|
||||
subTitle.text = context.getString(R.string.location_share_live_until, viewState.formattedLocalTimeOfEndOfLive)
|
|
@ -21,19 +21,19 @@ import android.util.AttributeSet
|
|||
import android.view.LayoutInflater
|
||||
import android.widget.Button
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import im.vector.app.databinding.ViewLocationLiveStatusBinding
|
||||
import im.vector.app.databinding.ViewLiveLocationStatusBinding
|
||||
|
||||
class LocationLiveStatusView @JvmOverloads constructor(
|
||||
class LiveLocationStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val binding = ViewLocationLiveStatusBinding.inflate(
|
||||
private val binding = ViewLiveLocationStatusBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
this
|
||||
)
|
||||
|
||||
val stopButton: Button
|
||||
get() = binding.locationLiveStatusStop
|
||||
get() = binding.liveLocationStatusStop
|
||||
}
|
|
@ -18,8 +18,8 @@ package im.vector.app.features.location.live.map
|
|||
|
||||
import im.vector.app.core.platform.VectorViewModelAction
|
||||
|
||||
sealed class LocationLiveMapAction : VectorViewModelAction {
|
||||
data class AddMapSymbol(val key: String, val value: Long) : LocationLiveMapAction()
|
||||
data class RemoveMapSymbol(val key: String) : LocationLiveMapAction()
|
||||
object StopSharing : LocationLiveMapAction()
|
||||
sealed class LiveLocationMapAction : VectorViewModelAction {
|
||||
data class AddMapSymbol(val key: String, val value: Long) : LiveLocationMapAction()
|
||||
data class RemoveMapSymbol(val key: String) : LiveLocationMapAction()
|
||||
object StopSharing : LiveLocationMapAction()
|
||||
}
|
|
@ -23,7 +23,7 @@ import android.widget.PopupWindow
|
|||
import im.vector.app.R
|
||||
import im.vector.app.databinding.ViewLiveLocationMarkerPopupBinding
|
||||
|
||||
class LocationLiveMapMarkerOptionsDialog(
|
||||
class LiveLocationMapMarkerOptionsDialog(
|
||||
context: Context,
|
||||
) : PopupWindow() {
|
||||
|
|
@ -28,17 +28,17 @@ import im.vector.app.features.MainActivity
|
|||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class LocationLiveMapViewArgs(
|
||||
data class LiveLocationMapViewArgs(
|
||||
val roomId: String
|
||||
) : Parcelable
|
||||
|
||||
@AndroidEntryPoint
|
||||
class LocationLiveMapViewActivity : VectorBaseActivity<ActivityLocationSharingBinding>() {
|
||||
class LiveLocationMapViewActivity : VectorBaseActivity<ActivityLocationSharingBinding>() {
|
||||
|
||||
override fun getBinding() = ActivityLocationSharingBinding.inflate(layoutInflater)
|
||||
|
||||
override fun initUiAndData() {
|
||||
val mapViewArgs: LocationLiveMapViewArgs? = intent?.extras?.getParcelable(EXTRA_LOCATION_LIVE_MAP_VIEW_ARGS)
|
||||
val mapViewArgs: LiveLocationMapViewArgs? = intent?.extras?.getParcelable(EXTRA_LIVE_LOCATION_MAP_VIEW_ARGS)
|
||||
if (mapViewArgs == null) {
|
||||
finish()
|
||||
return
|
||||
|
@ -50,7 +50,7 @@ class LocationLiveMapViewActivity : VectorBaseActivity<ActivityLocationSharingBi
|
|||
if (isFirstCreation()) {
|
||||
addFragment(
|
||||
views.fragmentContainer,
|
||||
LocationLiveMapViewFragment::class.java,
|
||||
LiveLocationMapViewFragment::class.java,
|
||||
mapViewArgs
|
||||
)
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ class LocationLiveMapViewActivity : VectorBaseActivity<ActivityLocationSharingBi
|
|||
|
||||
companion object {
|
||||
|
||||
private const val EXTRA_LOCATION_LIVE_MAP_VIEW_ARGS = "EXTRA_LOCATION_LIVE_MAP_VIEW_ARGS"
|
||||
private const val EXTRA_LIVE_LOCATION_MAP_VIEW_ARGS = "EXTRA_LIVE_LOCATION_MAP_VIEW_ARGS"
|
||||
|
||||
fun getIntent(context: Context, locationLiveMapViewArgs: LocationLiveMapViewArgs, firstStartMainActivity: Boolean = false): Intent {
|
||||
val intent = Intent(context, LocationLiveMapViewActivity::class.java).apply {
|
||||
putExtra(EXTRA_LOCATION_LIVE_MAP_VIEW_ARGS, locationLiveMapViewArgs)
|
||||
fun getIntent(context: Context, liveLocationMapViewArgs: LiveLocationMapViewArgs, firstStartMainActivity: Boolean = false): Intent {
|
||||
val intent = Intent(context, LiveLocationMapViewActivity::class.java).apply {
|
||||
putExtra(EXTRA_LIVE_LOCATION_MAP_VIEW_ARGS, liveLocationMapViewArgs)
|
||||
}
|
||||
return if (firstStartMainActivity) {
|
||||
MainActivity.getIntentWithNextIntent(context, intent)
|
|
@ -18,6 +18,6 @@ package im.vector.app.features.location.live.map
|
|||
|
||||
import im.vector.app.core.platform.VectorViewEvents
|
||||
|
||||
sealed interface LocationLiveMapViewEvents : VectorViewEvents {
|
||||
data class Error(val error: Throwable) : LocationLiveMapViewEvents
|
||||
sealed interface LiveLocationMapViewEvents : VectorViewEvents {
|
||||
data class Error(val error: Throwable) : LiveLocationMapViewEvents
|
||||
}
|
|
@ -46,7 +46,7 @@ import im.vector.app.core.extensions.configureWith
|
|||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
import im.vector.app.core.utils.openLocation
|
||||
import im.vector.app.databinding.FragmentLocationLiveMapViewBinding
|
||||
import im.vector.app.databinding.FragmentLiveLocationMapViewBinding
|
||||
import im.vector.app.features.location.LocationData
|
||||
import im.vector.app.features.location.UrlMapProvider
|
||||
import im.vector.app.features.location.zoomToBounds
|
||||
|
@ -60,13 +60,13 @@ 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<FragmentLocationLiveMapViewBinding>() {
|
||||
class LiveLocationMapViewFragment @Inject constructor() : VectorBaseFragment<FragmentLiveLocationMapViewBinding>() {
|
||||
|
||||
@Inject lateinit var urlMapProvider: UrlMapProvider
|
||||
@Inject lateinit var bottomSheetController: LiveLocationBottomSheetController
|
||||
@Inject lateinit var dimensionConverter: DimensionConverter
|
||||
|
||||
private val viewModel: LocationLiveMapViewModel by fragmentViewModel()
|
||||
private val viewModel: LiveLocationMapViewModel by fragmentViewModel()
|
||||
|
||||
private var mapboxMap: WeakReference<MapboxMap>? = null
|
||||
private var symbolManager: SymbolManager? = null
|
||||
|
@ -74,8 +74,8 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
private val pendingLiveLocations = mutableListOf<UserLiveLocationViewState>()
|
||||
private var isMapFirstUpdate = true
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLocationLiveMapViewBinding {
|
||||
return FragmentLocationLiveMapViewBinding.inflate(layoutInflater, container, false)
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLiveLocationMapViewBinding {
|
||||
return FragmentLiveLocationMapViewBinding.inflate(layoutInflater, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
@ -90,7 +90,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
}
|
||||
|
||||
override fun onStopLocationClicked() {
|
||||
viewModel.handle(LocationLiveMapAction.StopSharing)
|
||||
viewModel.handle(LiveLocationMapAction.StopSharing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
private fun observeViewEvents() {
|
||||
viewModel.observeViewEvents { viewEvent ->
|
||||
when (viewEvent) {
|
||||
is LocationLiveMapViewEvents.Error -> displayErrorDialog(viewEvent.error)
|
||||
is LiveLocationMapViewEvents.Error -> displayErrorDialog(viewEvent.error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
lifecycleScope.launch {
|
||||
mapboxMap.setStyle(urlMapProvider.getMapUrl()) { style ->
|
||||
mapStyle = style
|
||||
this@LocationLiveMapViewFragment.mapboxMap = WeakReference(mapboxMap)
|
||||
this@LiveLocationMapViewFragment.mapboxMap = WeakReference(mapboxMap)
|
||||
symbolManager = SymbolManager(mapFragment.view as MapView, mapboxMap, style).apply {
|
||||
iconAllowOverlap = true
|
||||
addClickListener {
|
||||
|
@ -136,9 +136,9 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
?.get()
|
||||
?.zoomToLocation(LocationData(it.latLng.latitude, it.latLng.longitude, null), preserveCurrentZoomLevel = false)
|
||||
|
||||
LocationLiveMapMarkerOptionsDialog(requireContext())
|
||||
LiveLocationMapMarkerOptionsDialog(requireContext())
|
||||
.apply {
|
||||
callback = object : LocationLiveMapMarkerOptionsDialog.Callback {
|
||||
callback = object : LiveLocationMapMarkerOptionsDialog.Callback {
|
||||
override fun onShareLocationClicked() {
|
||||
shareLocation(symbol)
|
||||
dismiss()
|
||||
|
@ -238,7 +238,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
addUserPinToMapStyle(userLocation.matrixItem.id, userLocation.pinDrawable)
|
||||
val symbolOptions = buildSymbolOptions(userLocation)
|
||||
val symbol = symbolManager.create(symbolOptions)
|
||||
viewModel.handle(LocationLiveMapAction.AddMapSymbol(userLocation.matrixItem.id, symbol.id))
|
||||
viewModel.handle(LiveLocationMapAction.AddMapSymbol(userLocation.matrixItem.id, symbol.id))
|
||||
}
|
||||
|
||||
private fun updateSymbol(symbolId: Long, userLocation: UserLiveLocationViewState, symbolManager: SymbolManager) {
|
||||
|
@ -254,7 +254,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
val userIdsToRemove = state.mapSymbolIds.keys.subtract(userLiveLocations.map { it.matrixItem.id }.toSet())
|
||||
userIdsToRemove.forEach { userId ->
|
||||
removeUserPinFromMapStyle(userId)
|
||||
viewModel.handle(LocationLiveMapAction.RemoveMapSymbol(userId))
|
||||
viewModel.handle(LiveLocationMapAction.RemoveMapSymbol(userId))
|
||||
|
||||
state.mapSymbolIds[userId]?.let { symbolId ->
|
||||
Timber.d("trying to delete symbol with id: $symbolId")
|
|
@ -30,19 +30,19 @@ import kotlinx.coroutines.flow.onEach
|
|||
import kotlinx.coroutines.launch
|
||||
import org.matrix.android.sdk.api.session.room.location.UpdateLiveLocationShareResult
|
||||
|
||||
class LocationLiveMapViewModel @AssistedInject constructor(
|
||||
@Assisted private val initialState: LocationLiveMapViewState,
|
||||
class LiveLocationMapViewModel @AssistedInject constructor(
|
||||
@Assisted private val initialState: LiveLocationMapViewState,
|
||||
getListOfUserLiveLocationUseCase: GetListOfUserLiveLocationUseCase,
|
||||
private val locationSharingServiceConnection: LocationSharingServiceConnection,
|
||||
private val stopLiveLocationShareUseCase: StopLiveLocationShareUseCase,
|
||||
) : VectorViewModel<LocationLiveMapViewState, LocationLiveMapAction, LocationLiveMapViewEvents>(initialState), LocationSharingServiceConnection.Callback {
|
||||
) : VectorViewModel<LiveLocationMapViewState, LiveLocationMapAction, LiveLocationMapViewEvents>(initialState), LocationSharingServiceConnection.Callback {
|
||||
|
||||
@AssistedFactory
|
||||
interface Factory : MavericksAssistedViewModelFactory<LocationLiveMapViewModel, LocationLiveMapViewState> {
|
||||
override fun create(initialState: LocationLiveMapViewState): LocationLiveMapViewModel
|
||||
interface Factory : MavericksAssistedViewModelFactory<LiveLocationMapViewModel, LiveLocationMapViewState> {
|
||||
override fun create(initialState: LiveLocationMapViewState): LiveLocationMapViewModel
|
||||
}
|
||||
|
||||
companion object : MavericksViewModelFactory<LocationLiveMapViewModel, LocationLiveMapViewState> by hiltMavericksViewModelFactory()
|
||||
companion object : MavericksViewModelFactory<LiveLocationMapViewModel, LiveLocationMapViewState> by hiltMavericksViewModelFactory()
|
||||
|
||||
init {
|
||||
getListOfUserLiveLocationUseCase.execute(initialState.roomId)
|
||||
|
@ -56,22 +56,22 @@ class LocationLiveMapViewModel @AssistedInject constructor(
|
|||
super.onCleared()
|
||||
}
|
||||
|
||||
override fun handle(action: LocationLiveMapAction) {
|
||||
override fun handle(action: LiveLocationMapAction) {
|
||||
when (action) {
|
||||
is LocationLiveMapAction.AddMapSymbol -> handleAddMapSymbol(action)
|
||||
is LocationLiveMapAction.RemoveMapSymbol -> handleRemoveMapSymbol(action)
|
||||
LocationLiveMapAction.StopSharing -> handleStopSharing()
|
||||
is LiveLocationMapAction.AddMapSymbol -> handleAddMapSymbol(action)
|
||||
is LiveLocationMapAction.RemoveMapSymbol -> handleRemoveMapSymbol(action)
|
||||
LiveLocationMapAction.StopSharing -> handleStopSharing()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleAddMapSymbol(action: LocationLiveMapAction.AddMapSymbol) = withState { state ->
|
||||
private fun handleAddMapSymbol(action: LiveLocationMapAction.AddMapSymbol) = withState { state ->
|
||||
val newMapSymbolIds = state.mapSymbolIds.toMutableMap().apply { set(action.key, action.value) }
|
||||
setState {
|
||||
copy(mapSymbolIds = newMapSymbolIds)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRemoveMapSymbol(action: LocationLiveMapAction.RemoveMapSymbol) = withState { state ->
|
||||
private fun handleRemoveMapSymbol(action: LiveLocationMapAction.RemoveMapSymbol) = withState { state ->
|
||||
val newMapSymbolIds = state.mapSymbolIds.toMutableMap().apply { remove(action.key) }
|
||||
setState {
|
||||
copy(mapSymbolIds = newMapSymbolIds)
|
||||
|
@ -82,7 +82,7 @@ class LocationLiveMapViewModel @AssistedInject constructor(
|
|||
viewModelScope.launch {
|
||||
val result = stopLiveLocationShareUseCase.execute(initialState.roomId)
|
||||
if (result is UpdateLiveLocationShareResult.Failure) {
|
||||
_viewEvents.post(LocationLiveMapViewEvents.Error(result.error))
|
||||
_viewEvents.post(LiveLocationMapViewEvents.Error(result.error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,6 @@ class LocationLiveMapViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
override fun onLocationServiceError(error: Throwable) {
|
||||
_viewEvents.post(LocationLiveMapViewEvents.Error(error))
|
||||
_viewEvents.post(LiveLocationMapViewEvents.Error(error))
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ import com.airbnb.mvrx.MavericksState
|
|||
import im.vector.app.features.location.LocationData
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
||||
data class LocationLiveMapViewState(
|
||||
data class LiveLocationMapViewState(
|
||||
val roomId: String,
|
||||
val userLocations: List<UserLiveLocationViewState> = emptyList(),
|
||||
/**
|
||||
|
@ -29,8 +29,8 @@ data class LocationLiveMapViewState(
|
|||
*/
|
||||
val mapSymbolIds: Map<String, Long> = emptyMap()
|
||||
) : MavericksState {
|
||||
constructor(locationLiveMapViewArgs: LocationLiveMapViewArgs) : this(
|
||||
roomId = locationLiveMapViewArgs.roomId
|
||||
constructor(liveLocationMapViewArgs: LiveLocationMapViewArgs) : this(
|
||||
roomId = liveLocationMapViewArgs.roomId
|
||||
)
|
||||
}
|
||||
|
|
@ -66,8 +66,8 @@ import im.vector.app.features.location.LocationData
|
|||
import im.vector.app.features.location.LocationSharingActivity
|
||||
import im.vector.app.features.location.LocationSharingArgs
|
||||
import im.vector.app.features.location.LocationSharingMode
|
||||
import im.vector.app.features.location.live.map.LocationLiveMapViewActivity
|
||||
import im.vector.app.features.location.live.map.LocationLiveMapViewArgs
|
||||
import im.vector.app.features.location.live.map.LiveLocationMapViewActivity
|
||||
import im.vector.app.features.location.live.map.LiveLocationMapViewArgs
|
||||
import im.vector.app.features.login.LoginActivity
|
||||
import im.vector.app.features.login.LoginConfig
|
||||
import im.vector.app.features.matrixto.MatrixToBottomSheet
|
||||
|
@ -560,10 +560,10 @@ class DefaultNavigator @Inject constructor(
|
|||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
override fun openLocationLiveMap(context: Context, roomId: String) {
|
||||
val intent = LocationLiveMapViewActivity.getIntent(
|
||||
override fun openLiveLocationMap(context: Context, roomId: String) {
|
||||
val intent = LiveLocationMapViewActivity.getIntent(
|
||||
context = context,
|
||||
locationLiveMapViewArgs = LocationLiveMapViewArgs(roomId = roomId)
|
||||
liveLocationMapViewArgs = LiveLocationMapViewArgs(roomId = roomId)
|
||||
)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ interface Navigator {
|
|||
locationOwnerId: String?
|
||||
)
|
||||
|
||||
fun openLocationLiveMap(context: Context, roomId: String)
|
||||
fun openLiveLocationMap(context: Context, roomId: String)
|
||||
|
||||
fun openThread(context: Context, threadTimelineArgs: ThreadTimelineArgs, eventIdToNavigate: String? = null)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
android:backgroundTint="?vctr_live_location"
|
||||
android:importantForAccessibility="no"
|
||||
android:padding="4dp"
|
||||
android:src="@drawable/ic_attachment_location_live_white" />
|
||||
android:src="@drawable/ic_attachment_live_location_white" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Vector.Headline.Medium"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<im.vector.app.features.location.live.LocationLiveEndedBannerView
|
||||
<im.vector.app.features.location.live.LiveLocationEndedBannerView
|
||||
android:id="@+id/liveLocationMapFragmentEndedBanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
|
@ -45,8 +45,8 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />
|
||||
|
||||
<im.vector.app.features.location.live.LocationLiveStatusView
|
||||
android:id="@+id/locationLiveStatusIndicator"
|
||||
<im.vector.app.features.location.live.LiveLocationStatusView
|
||||
android:id="@+id/liveLocationStatusIndicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:minHeight="54dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationLiveStatusIndicator" />
|
||||
app:layout_constraintTop_toBottomOf="@id/liveLocationStatusIndicator" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/timelineRecyclerView"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- Size will be overrode -->
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveInactiveMap"
|
||||
android:id="@+id/liveLocationInactiveMap"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="200dp"
|
||||
android:contentDescription="@string/a11y_static_map_image"
|
||||
|
@ -15,29 +15,29 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<im.vector.app.features.location.live.LocationLiveEndedBannerView
|
||||
android:id="@+id/locationLiveEndedBanner"
|
||||
<im.vector.app.features.location.live.LiveLocationEndedBannerView
|
||||
android:id="@+id/liveLocationEndedBanner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveInactiveMap"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveInactiveMap"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveInactiveMap"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationInactiveMap"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationInactiveMap"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationInactiveMap"
|
||||
app:locLiveEndedBkgWithAlpha="true"
|
||||
app:locLiveEndedIconMarginStart="8dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveInactiveIcon"
|
||||
android:id="@+id/liveLocationInactiveIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="65dp"
|
||||
android:src="@drawable/ic_attachment_location_white"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationLiveInactiveVerticalCenter"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveInactiveMap"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveInactiveMap"
|
||||
app:layout_constraintBottom_toTopOf="@id/liveLocationInactiveVerticalCenter"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationInactiveMap"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationInactiveMap"
|
||||
app:tint="?vctr_content_quaternary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/locationLiveInactiveVerticalCenter"
|
||||
android:id="@+id/liveLocationInactiveVerticalCenter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- Size will be overrode -->
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveStartMap"
|
||||
android:id="@+id/liveLocationStartMap"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="200dp"
|
||||
android:contentDescription="@string/a11y_static_map_image"
|
||||
|
@ -16,18 +16,18 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveStartBanner"
|
||||
android:id="@+id/liveLocationStartBanner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:alpha="0.75"
|
||||
android:src="?android:colorBackground"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveStartMap"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveStartMap"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveStartMap"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationStartMap"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationStartMap"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationStartMap"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveStartIcon"
|
||||
android:id="@+id/liveLocationStartIcon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
|
@ -35,15 +35,15 @@
|
|||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?vctr_content_quaternary"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveStartBanner"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveStartBanner"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveStartBanner"
|
||||
app:srcCompat="@drawable/ic_attachment_location_live_white"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationStartBanner"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationStartBanner"
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationStartBanner"
|
||||
app:srcCompat="@drawable/ic_attachment_live_location_white"
|
||||
app:tint="?android:colorBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveStartTitle"
|
||||
android:id="@+id/liveLocationStartTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -52,19 +52,19 @@
|
|||
android:ellipsize="end"
|
||||
android:text="@string/location_share_live_started"
|
||||
android:textColor="?vctr_content_tertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveStartBanner"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveStartBanner"
|
||||
app:layout_constraintStart_toEndOf="@id/locationLiveStartIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveStartBanner" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationStartBanner"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationStartBanner"
|
||||
app:layout_constraintStart_toEndOf="@id/liveLocationStartIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationStartBanner" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/locationLiveStartLoader"
|
||||
android:id="@+id/liveLocationStartLoader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminateTint="?vctr_content_quaternary"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationLiveStartBanner"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveStartMap"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveStartMap"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveStartMap" />
|
||||
app:layout_constraintBottom_toTopOf="@id/liveLocationStartBanner"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationStartMap"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationStartMap"
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationStartMap" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/staticMapPinImageView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<im.vector.app.features.location.live.LocationLiveRunningBannerView
|
||||
android:id="@+id/locationLiveRunningBanner"
|
||||
<im.vector.app.features.location.live.LiveLocationRunningBannerView
|
||||
android:id="@+id/liveLocationRunningBanner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveEndedBannerBackground"
|
||||
android:id="@+id/liveLocationEndedBannerBackground"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="?android:colorBackground"
|
||||
|
@ -18,7 +18,7 @@
|
|||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveEndedBannerIcon"
|
||||
android:id="@+id/liveLocationEndedBannerIcon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
|
@ -26,15 +26,15 @@
|
|||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?vctr_content_quaternary"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveEndedBannerBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveEndedBannerBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveEndedBannerBackground"
|
||||
app:srcCompat="@drawable/ic_attachment_location_live_white"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationEndedBannerBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationEndedBannerBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationEndedBannerBackground"
|
||||
app:srcCompat="@drawable/ic_attachment_live_location_white"
|
||||
app:tint="?android:colorBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveEndedTitle"
|
||||
android:id="@+id/liveLocationEndedTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -43,8 +43,8 @@
|
|||
android:lines="1"
|
||||
android:text="@string/location_share_live_ended"
|
||||
android:textColor="?vctr_content_tertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveEndedBannerBackground"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveEndedBannerBackground"
|
||||
app:layout_constraintStart_toEndOf="@id/locationLiveEndedBannerIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveEndedBannerBackground" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationEndedBannerBackground"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationEndedBannerBackground"
|
||||
app:layout_constraintStart_toEndOf="@id/liveLocationEndedBannerIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationEndedBannerBackground" />
|
||||
</merge>
|
|
@ -7,7 +7,7 @@
|
|||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveRunningBannerBackground"
|
||||
android:id="@+id/liveLocationRunningBannerBackground"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:alpha="0.75"
|
||||
|
@ -18,7 +18,7 @@
|
|||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveRunningBannerIcon"
|
||||
android:id="@+id/liveLocationRunningBannerIcon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
|
@ -26,13 +26,13 @@
|
|||
android:backgroundTint="?vctr_live_location"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveRunningBannerBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationRunningBannerBackground"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_attachment_location_live_white"
|
||||
app:srcCompat="@drawable/ic_attachment_live_location_white"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveRunningBannerTitle"
|
||||
android:id="@+id/liveLocationRunningBannerTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,16 +40,16 @@
|
|||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="?colorOnSurface"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationLiveRunningBannerSubTitle"
|
||||
app:layout_constraintEnd_toStartOf="@id/locationLiveRunningBannerStop"
|
||||
app:layout_constraintBottom_toTopOf="@id/liveLocationRunningBannerSubTitle"
|
||||
app:layout_constraintEnd_toStartOf="@id/liveLocationRunningBannerStop"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/locationLiveRunningBannerIcon"
|
||||
app:layout_constraintStart_toEndOf="@id/liveLocationRunningBannerIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="@string/location_share_live_enabled" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveRunningBannerSubTitle"
|
||||
android:id="@+id/liveLocationRunningBannerSubTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -57,19 +57,19 @@
|
|||
android:lines="1"
|
||||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/locationLiveRunningBannerTitle"
|
||||
app:layout_constraintEnd_toEndOf="@id/liveLocationRunningBannerTitle"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveRunningBannerTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationLiveRunningBannerTitle"
|
||||
app:layout_constraintStart_toStartOf="@id/liveLocationRunningBannerTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/liveLocationRunningBannerTitle"
|
||||
tools:text="9min left" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/locationLiveRunningBannerStop"
|
||||
style="@style/Widget.Vector.Button.Text.LocationLive"
|
||||
android:id="@+id/liveLocationRunningBannerStop"
|
||||
style="@style/Widget.Vector.Button.Text.LiveLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/location_share_live_stop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveRunningBannerBackground"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationRunningBannerBackground"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveRunningBannerBackground" />
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationRunningBannerBackground" />
|
||||
</merge>
|
|
@ -7,14 +7,14 @@
|
|||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/locationLiveStatusContainer"
|
||||
android:id="@+id/liveLocationStatusContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="?colorPrimary"
|
||||
android:duplicateParentState="true"
|
||||
android:paddingStart="9dp"
|
||||
android:paddingEnd="12dp"
|
||||
app:constraint_referenced_ids="locationLiveStatusIcon,locationLiveStatusTitle"
|
||||
app:constraint_referenced_ids="liveLocationStatusIcon,liveLocationStatusTitle"
|
||||
app:flow_horizontalBias="0"
|
||||
app:flow_horizontalGap="8dp"
|
||||
app:flow_horizontalStyle="packed"
|
||||
|
@ -23,14 +23,14 @@
|
|||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveStatusIcon"
|
||||
android:id="@+id/liveLocationStatusIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="13dp"
|
||||
app:srcCompat="@drawable/ic_attachment_location_live_white"
|
||||
app:srcCompat="@drawable/ic_attachment_live_location_white"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveStatusTitle"
|
||||
android:id="@+id/liveLocationStatusTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -38,12 +38,12 @@
|
|||
android:textColor="?colorOnPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/locationLiveStatusStop"
|
||||
style="@style/Widget.Vector.Button.Text.OnPrimary.LocationLive"
|
||||
android:id="@+id/liveLocationStatusStop"
|
||||
style="@style/Widget.Vector.Button.Text.OnPrimary.LiveLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:text="@string/location_share_live_stop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveStatusContainer"
|
||||
app:layout_constraintBottom_toBottomOf="@id/liveLocationStatusContainer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveStatusContainer" />
|
||||
app:layout_constraintTop_toTopOf="@id/liveLocationStatusContainer" />
|
||||
</merge>
|
|
@ -65,7 +65,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionUserCurrent"
|
||||
app:locShareIcon="@drawable/ic_attachment_location_live_white"
|
||||
app:locShareIcon="@drawable/ic_attachment_live_location_white"
|
||||
app:locShareIconBackground="@drawable/circle"
|
||||
app:locShareIconBackgroundTint="?vctr_live_location"
|
||||
app:locShareIconDescription="@string/a11y_location_share_option_user_live_icon"
|
||||
|
|
|
@ -34,20 +34,20 @@ import org.matrix.android.sdk.api.util.MatrixItem
|
|||
|
||||
private const val A_ROOM_ID = "room_id"
|
||||
|
||||
class LocationLiveMapViewModelTest {
|
||||
class LiveLocationMapViewModelTest {
|
||||
|
||||
@get:Rule
|
||||
val mvRxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher())
|
||||
|
||||
private val args = LocationLiveMapViewArgs(roomId = A_ROOM_ID)
|
||||
private val args = LiveLocationMapViewArgs(roomId = A_ROOM_ID)
|
||||
|
||||
private val getListOfUserLiveLocationUseCase = mockk<GetListOfUserLiveLocationUseCase>()
|
||||
private val locationServiceConnection = FakeLocationSharingServiceConnection()
|
||||
private val stopLiveLocationShareUseCase = mockk<StopLiveLocationShareUseCase>()
|
||||
|
||||
private fun createViewModel(): LocationLiveMapViewModel {
|
||||
return LocationLiveMapViewModel(
|
||||
LocationLiveMapViewState(args),
|
||||
private fun createViewModel(): LiveLocationMapViewModel {
|
||||
return LiveLocationMapViewModel(
|
||||
LiveLocationMapViewState(args),
|
||||
getListOfUserLiveLocationUseCase,
|
||||
locationServiceConnection.instance,
|
||||
stopLiveLocationShareUseCase
|
||||
|
@ -78,7 +78,7 @@ class LocationLiveMapViewModelTest {
|
|||
viewModel
|
||||
.test()
|
||||
.assertState(
|
||||
LocationLiveMapViewState(args).copy(
|
||||
LiveLocationMapViewState(args).copy(
|
||||
userLocations = userLocations
|
||||
)
|
||||
)
|
Loading…
Reference in a new issue