mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Fix crash when mixing static and live location
This commit is contained in:
parent
f2b66c5fb5
commit
0a21bd4b78
@ -19,6 +19,7 @@ package im.vector.app.features.home.room.detail.timeline.item
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
@ -101,15 +102,10 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
|
||||
.into(holder.staticMapImageView)
|
||||
}
|
||||
|
||||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
open class Holder : AbsMessageItem.Holder(STUB_ID) {
|
||||
abstract class Holder(@IdRes stubId: Int) : AbsMessageItem.Holder(stubId) {
|
||||
val staticMapImageView by bind<ImageView>(R.id.staticMapImageView)
|
||||
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
|
||||
val staticMapErrorTextView by bind<TextView>(R.id.staticMapErrorTextView)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val STUB_ID = R.id.messageContentLocationStub
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,13 @@ abstract class MessageLiveLocationItem : AbsMessageLocationItem<MessageLiveLocat
|
||||
private fun getRemainingTimeOfLiveInMillis() =
|
||||
(endOfLiveDateTime?.toTimestamp() ?: 0) - LocalDateTime.now().toTimestamp()
|
||||
|
||||
class Holder : AbsMessageLocationItem.Holder() {
|
||||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageLocationItem.Holder(STUB_ID) {
|
||||
val locationLiveMessageBanner by bind<LocationLiveMessageBannerView>(R.id.locationLiveMessageBanner)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val STUB_ID = R.id.messageContentLiveLocationStub
|
||||
}
|
||||
}
|
||||
|
@ -21,5 +21,12 @@ import im.vector.app.R
|
||||
|
||||
@EpoxyModelClass(layout = R.layout.item_timeline_event_base)
|
||||
abstract class MessageLocationItem : AbsMessageLocationItem<MessageLocationItem.Holder>() {
|
||||
class Holder : AbsMessageLocationItem.Holder()
|
||||
|
||||
override fun getViewStubId() = STUB_ID
|
||||
|
||||
class Holder : AbsMessageLocationItem.Holder(STUB_ID)
|
||||
|
||||
companion object {
|
||||
private const val STUB_ID = R.id.messageContentLocationStub
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,12 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/item_timeline_event_location_stub" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentLiveLocationStub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/item_timeline_event_location_stub" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentLiveLocationStartStub"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user