Renaming banner view for running live
This commit is contained in:
parent
46684702a1
commit
1276b12188
|
@ -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<MessageLiveLocat
|
|||
val isEmitter = currentUserId != null && currentUserId == locationUserId
|
||||
val messageLayout = attributes.informationData.messageLayout
|
||||
val viewState = buildViewState(holder, messageLayout, isEmitter)
|
||||
holder.locationLiveMessageBanner.isVisible = true
|
||||
holder.locationLiveMessageBanner.render(viewState)
|
||||
holder.locationLiveMessageBanner.stopButton.setOnClickListener {
|
||||
holder.locationLiveRunningBanner.isVisible = true
|
||||
holder.locationLiveRunningBanner.render(viewState)
|
||||
holder.locationLiveRunningBanner.stopButton.setOnClickListener {
|
||||
attributes.callback?.onTimelineItemAction(RoomDetailAction.StopLiveLocationSharing)
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
|||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageLocationItem.Holder(STUB_ID) {
|
||||
val locationLiveMessageBanner by bind<LocationLiveMessageBannerView>(R.id.locationLiveMessageBanner)
|
||||
val locationLiveRunningBanner by bind<LocationLiveRunningBannerView>(R.id.locationLiveMessageBanner)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -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
|
||||
)
|
|
@ -45,7 +45,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/staticMapPinImageView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<im.vector.app.features.location.live.LocationLiveMessageBannerView
|
||||
<im.vector.app.features.location.live.LocationLiveRunningBannerView
|
||||
android:id="@+id/locationLiveMessageBanner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveMessageBannerBackground"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:alpha="0.75"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="?android:colorBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locationLiveMessageBannerIcon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?vctr_live_location"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveMessageBannerBackground"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_attachment_location_live_white"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveMessageBannerTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:textColor="?colorOnSurface"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationLiveMessageBannerSubTitle"
|
||||
app:layout_constraintStart_toEndOf="@id/locationLiveMessageBannerIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="@string/location_share_live_enabled" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/locationLiveMessageBannerSubTitle"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/locationLiveMessageBannerTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationLiveMessageBannerTitle"
|
||||
tools:text="9min left" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/locationLiveMessageBannerStop"
|
||||
style="@style/Widget.Vector.Button.Text.LocationLive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/location_share_live_stop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/locationLiveMessageBannerBackground"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/locationLiveMessageBannerBackground" />
|
||||
</merge>
|
Loading…
Reference in New Issue