mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 02:45:53 +03:00
Fix for crash on rendering media items
07-19 19:28:53.039 E/AndroidRuntime(12141): java.lang.NoSuchMethodError: No virtual method updateMessageBubble(Landroid/content/Context;Lim/vector/app/features/home/room/detail/timeline/item/AbsMessageItem$Holder;)V in class Lim/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem; or its super classes (declaration of 'im.vector.app.features.home.room.detail.timeline.item.MessageImageVideoItem' appears in base.apk) 07-19 19:28:53.039 E/AndroidRuntime(12141): at im.vector.app.features.home.room.detail.timeline.item.MessageImageVideoItem$bind$onImageSizeListener$1.onImageSizeUpdated(MessageImageVideoItem.kt:6) 07-19 19:28:53.039 E/AndroidRuntime(12141): at im.vector.app.features.media.ImageContentRenderer.render(ImageContentRenderer.kt:20) 07-19 19:28:53.039 E/AndroidRuntime(12141): at im.vector.app.features.home.room.detail.timeline.item.MessageImageVideoItem.bind(MessageImageVideoItem.kt:12) 07-19 19:28:53.039 E/AndroidRuntime(12141): at im.vector.app.features.home.room.detail.timeline.item.MessageImageVideoItem.bind(MessageImageVideoItem.kt:6) 07-19 19:28:53.039 E/AndroidRuntime(12141): at com.airbnb.epoxy.BaseEpoxyAdapter.onBindViewHolder(BaseEpoxyAdapter.java:25) Change-Id: Ic803b3bfb328ed3a56202df789500b162886250d
This commit is contained in:
parent
a5db52fe62
commit
045f95326a
4 changed files with 45 additions and 29 deletions
|
@ -7,27 +7,6 @@ import im.vector.app.features.themes.BubbleThemeUtils
|
||||||
|
|
||||||
interface BubbleDependentView<H> {
|
interface BubbleDependentView<H> {
|
||||||
|
|
||||||
fun updateMessageBubble(context: Context, holder: H) {
|
|
||||||
val bubbleStyleSetting = BubbleThemeUtils.getBubbleStyle(context)
|
|
||||||
val bubbleStyle = when {
|
|
||||||
messageBubbleAllowed(context) -> {
|
|
||||||
bubbleStyleSetting
|
|
||||||
}
|
|
||||||
bubbleStyleSetting == BubbleThemeUtils.BUBBLE_STYLE_BOTH && pseudoBubbleAllowed() -> {
|
|
||||||
BubbleThemeUtils.BUBBLE_STYLE_BOTH_HIDDEN
|
|
||||||
}
|
|
||||||
bubbleStyleSetting == BubbleThemeUtils.BUBBLE_STYLE_START && pseudoBubbleAllowed() -> {
|
|
||||||
BubbleThemeUtils.BUBBLE_STYLE_START_HIDDEN
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
BubbleThemeUtils.BUBBLE_STYLE_NONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val reverseBubble = shouldReverseBubble() && BubbleThemeUtils.drawsDualSide(bubbleStyle)
|
|
||||||
|
|
||||||
setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun messageBubbleAllowed(context: Context): Boolean {
|
fun messageBubbleAllowed(context: Context): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -41,15 +20,38 @@ interface BubbleDependentView<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBubbleLayout(holder: H, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean)
|
fun setBubbleLayout(holder: H, bubbleStyle: String, bubbleStyleSetting: String, reverseBubble: Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
fun setFlatRtl(layout: ViewGroup, direction: Int, childDirection: Int, depth: Int = 1) {
|
// This function belongs to BubbleDependentView, but turned out to raise a NoSuchMethodError since recently
|
||||||
layout.layoutDirection = direction
|
// when called from an onImageSizeUpdated listener
|
||||||
for (child in layout.children) {
|
fun <H>updateMessageBubble(context: Context, view: BubbleDependentView<H>, holder: H) {
|
||||||
if (depth > 1 && child is ViewGroup) {
|
val bubbleStyleSetting = BubbleThemeUtils.getBubbleStyle(context)
|
||||||
setFlatRtl(child, direction, childDirection, depth-1)
|
val bubbleStyle = when {
|
||||||
} else {
|
view.messageBubbleAllowed(context) -> {
|
||||||
child.layoutDirection = childDirection
|
bubbleStyleSetting
|
||||||
}
|
}
|
||||||
|
bubbleStyleSetting == BubbleThemeUtils.BUBBLE_STYLE_BOTH && view.pseudoBubbleAllowed() -> {
|
||||||
|
BubbleThemeUtils.BUBBLE_STYLE_BOTH_HIDDEN
|
||||||
|
}
|
||||||
|
bubbleStyleSetting == BubbleThemeUtils.BUBBLE_STYLE_START && view.pseudoBubbleAllowed() -> {
|
||||||
|
BubbleThemeUtils.BUBBLE_STYLE_START_HIDDEN
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
BubbleThemeUtils.BUBBLE_STYLE_NONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val reverseBubble = view.shouldReverseBubble() && BubbleThemeUtils.drawsDualSide(bubbleStyle)
|
||||||
|
|
||||||
|
view.setBubbleLayout(holder, bubbleStyle, bubbleStyleSetting, reverseBubble)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setFlatRtl(layout: ViewGroup, direction: Int, childDirection: Int, depth: Int = 1) {
|
||||||
|
layout.layoutDirection = direction
|
||||||
|
for (child in layout.children) {
|
||||||
|
if (depth > 1 && child is ViewGroup) {
|
||||||
|
setFlatRtl(child, direction, childDirection, depth-1)
|
||||||
|
} else {
|
||||||
|
child.layoutDirection = childDirection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import im.vector.app.R
|
||||||
import im.vector.app.core.epoxy.ClickListener
|
import im.vector.app.core.epoxy.ClickListener
|
||||||
import im.vector.app.core.epoxy.onClick
|
import im.vector.app.core.epoxy.onClick
|
||||||
import im.vector.app.core.ui.views.SendStateImageView
|
import im.vector.app.core.ui.views.SendStateImageView
|
||||||
|
import im.vector.app.core.ui.views.setFlatRtl
|
||||||
import im.vector.app.features.home.AvatarRenderer
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
import im.vector.app.features.home.room.detail.timeline.MessageColorProvider
|
import im.vector.app.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
|
|
@ -32,6 +32,7 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyModel
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.app.core.platform.CheckableView
|
import im.vector.app.core.platform.CheckableView
|
||||||
import im.vector.app.core.ui.views.BubbleDependentView
|
import im.vector.app.core.ui.views.BubbleDependentView
|
||||||
|
import im.vector.app.core.ui.views.updateMessageBubble
|
||||||
import im.vector.app.core.utils.DimensionConverter
|
import im.vector.app.core.utils.DimensionConverter
|
||||||
import im.vector.app.features.themes.BubbleThemeUtils
|
import im.vector.app.features.themes.BubbleThemeUtils
|
||||||
|
|
||||||
|
@ -129,4 +130,8 @@ abstract class BaseEventItem<H : BaseEventItem.BaseHolder> : VectorEpoxyModel<H>
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun updateMessageBubble(context: Context, holder: H) {
|
||||||
|
return updateMessageBubble(context, this, holder)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package im.vector.app.features.home.room.detail.timeline.item
|
package im.vector.app.features.home.room.detail.timeline.item
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
@ -30,6 +31,8 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.onClick
|
import im.vector.app.core.epoxy.onClick
|
||||||
import im.vector.app.core.ui.views.BubbleDependentView
|
import im.vector.app.core.ui.views.BubbleDependentView
|
||||||
import im.vector.app.core.ui.views.ReadReceiptsView
|
import im.vector.app.core.ui.views.ReadReceiptsView
|
||||||
|
import im.vector.app.core.ui.views.setFlatRtl
|
||||||
|
import im.vector.app.core.ui.views.updateMessageBubble
|
||||||
import im.vector.app.features.home.AvatarRenderer
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
import im.vector.app.features.themes.BubbleThemeUtils
|
import im.vector.app.features.themes.BubbleThemeUtils
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
@ -105,4 +108,9 @@ abstract class ReadReceiptsItem : EpoxyModelWithHolder<ReadReceiptsItem.Holder>(
|
||||||
// Also set rtl to have members fill from the natural side
|
// Also set rtl to have members fill from the natural side
|
||||||
setFlatRtl(holder.readReceiptsView, if (dualBubbles) reverseDirection else defaultDirection, defaultDirection)
|
setFlatRtl(holder.readReceiptsView, if (dualBubbles) reverseDirection else defaultDirection, defaultDirection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateMessageBubble(context: Context, holder: Holder) {
|
||||||
|
return updateMessageBubble(context, this, holder)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue