Remove usage of @JvmField in Epoxy Items.

Fix error `error: annotation type not applicable to this kind of declaration`
This commit is contained in:
Benoit Marty 2022-10-03 16:48:01 +02:00 committed by Benoit Marty
parent 8e375a7fb2
commit 24fe677e50
7 changed files with 20 additions and 24 deletions

View File

@ -279,7 +279,7 @@ class MessageItemFactory @Inject constructor(
.duration(messageContent.audioInfo?.duration ?: 0)
.playbackControlButtonClickListener(playbackControlButtonClickListener)
.audioMessagePlaybackTracker(audioMessagePlaybackTracker)
.isLocalFile(localFilesHelper.isLocalFile(fileUrl))
.izLocalFile(localFilesHelper.isLocalFile(fileUrl))
.fileSize(messageContent.audioInfo?.size ?: 0L)
.onSeek { params.callback?.onAudioSeekBarMovedTo(informationData.eventId, duration, it) }
.mxcUrl(fileUrl)
@ -339,7 +339,7 @@ class MessageItemFactory @Inject constructor(
.playbackControlButtonClickListener(playbackControlButtonClickListener)
.waveformTouchListener(waveformTouchListener)
.audioMessagePlaybackTracker(audioMessagePlaybackTracker)
.isLocalFile(localFilesHelper.isLocalFile(fileUrl))
.izLocalFile(localFilesHelper.isLocalFile(fileUrl))
.mxcUrl(fileUrl)
.contentUploadStateTrackerBinder(contentUploadStateTrackerBinder)
.contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder)
@ -399,8 +399,8 @@ class MessageItemFactory @Inject constructor(
return MessageFileItem_()
.attributes(attributes)
.leftGuideline(avatarSizeProvider.leftGuideline)
.isLocalFile(localFilesHelper.isLocalFile(messageContent.getFileUrl()))
.isDownloaded(session.fileService().isFileInCache(messageContent))
.izLocalFile(localFilesHelper.isLocalFile(messageContent.getFileUrl()))
.izDownloaded(session.fileService().isFileInCache(messageContent))
.mxcUrl(mxcUrl)
.contentUploadStateTrackerBinder(contentUploadStateTrackerBinder)
.contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder)

View File

@ -53,8 +53,7 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
var fileSize: Long = 0
@EpoxyAttribute
@JvmField
var isLocalFile = false
var izLocalFile = false
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
var onSeek: ((percentage: Float) -> Unit)? = null
@ -91,7 +90,7 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
holder.view.context.getString(R.string.error_audio_message_unable_to_play, filename)
holder.progressLayout.isVisible = false
} else {
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, isLocalFile, holder.progressLayout)
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, izLocalFile, holder.progressLayout)
}
}

View File

@ -48,12 +48,10 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
var iconRes: Int = 0
@EpoxyAttribute
@JvmField
var isLocalFile = false
var izLocalFile = false
@EpoxyAttribute
@JvmField
var isDownloaded = false
var izDownloaded = false
@EpoxyAttribute
lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder
@ -66,7 +64,7 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
renderSendState(holder.fileLayout, holder.filenameView)
if (!attributes.informationData.sendState.hasFailed()) {
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, isLocalFile, holder.progressLayout)
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, izLocalFile, holder.progressLayout)
} else {
holder.fileImageView.setImageResource(R.drawable.ic_cross)
holder.progressLayout.isVisible = false
@ -77,7 +75,7 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
if (attributes.informationData.sendState.isSending()) {
holder.fileImageView.setImageResource(iconRes)
} else {
if (isDownloaded) {
if (izDownloaded) {
holder.fileImageView.setImageResource(iconRes)
holder.fileDownloadProgress.progress = 0
} else {

View File

@ -55,8 +55,7 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
var waveform: List<Int> = emptyList()
@EpoxyAttribute
@JvmField
var isLocalFile = false
var izLocalFile = false
@EpoxyAttribute
lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder
@ -77,7 +76,7 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
super.bind(holder)
renderSendState(holder.voiceLayout, null)
if (!attributes.informationData.sendState.hasFailed()) {
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, isLocalFile, holder.progressLayout)
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, izLocalFile, holder.progressLayout)
} else {
holder.voicePlaybackControlButton.setImageResource(R.drawable.ic_cross)
holder.voicePlaybackControlButton.contentDescription = holder.view.context.getString(R.string.error_voice_message_unable_to_play)

View File

@ -76,8 +76,8 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>(R.layo
@EpoxyAttribute
var showPresence: Boolean = false
@EpoxyAttribute @JvmField
var isPublic: Boolean = false
@EpoxyAttribute
var izPublic: Boolean = false
@EpoxyAttribute
var unreadNotificationCount: Int = 0
@ -121,7 +121,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>(R.layo
holder.draftView.isVisible = hasDraft
avatarRenderer.render(matrixItem, holder.avatarImageView)
holder.roomAvatarDecorationImageView.render(encryptionTrustLevel)
holder.roomAvatarPublicDecorationImageView.isVisible = isPublic
holder.roomAvatarPublicDecorationImageView.isVisible = izPublic
holder.roomAvatarFailSendingImageView.isVisible = hasFailedSending
renderSelection(holder, showSelected)
holder.roomAvatarPresenceImageView.render(showPresence, userPresence)

View File

@ -61,8 +61,8 @@ abstract class RoomSummaryItemCentered : VectorEpoxyModel<RoomSummaryItemCentere
@EpoxyAttribute
var showPresence: Boolean = false
@EpoxyAttribute @JvmField
var isPublic: Boolean = false
@EpoxyAttribute
var izPublic: Boolean = false
@EpoxyAttribute
var unreadNotificationCount: Int = 0
@ -96,7 +96,7 @@ abstract class RoomSummaryItemCentered : VectorEpoxyModel<RoomSummaryItemCentere
holder.titleView.text = matrixItem.getBestName()
avatarRenderer.render(matrixItem, holder.avatarImageView)
holder.roomAvatarDecorationImageView.render(encryptionTrustLevel)
holder.roomAvatarPublicDecorationImageView.isVisible = isPublic
holder.roomAvatarPublicDecorationImageView.isVisible = izPublic
holder.roomAvatarFailSendingImageView.isVisible = hasFailedSending
renderSelection(holder, showSelected)
holder.roomAvatarPresenceImageView.render(showPresence, userPresence)

View File

@ -167,7 +167,7 @@ class RoomSummaryItemFactory @Inject constructor(
// .encryptionTrustLevel(roomSummary.roomEncryptionTrustLevel)
.displayMode(displayMode)
.subtitle(subtitle)
.isPublic(roomSummary.isPublic)
.izPublic(roomSummary.isPublic)
.showPresence(roomSummary.isDirect)
.userPresence(roomSummary.directUserPresence)
.matrixItem(roomSummary.toMatrixItem())
@ -197,7 +197,7 @@ class RoomSummaryItemFactory @Inject constructor(
// We do not display shield in the room list anymore
// .encryptionTrustLevel(roomSummary.roomEncryptionTrustLevel)
.displayMode(displayMode)
.isPublic(roomSummary.isPublic)
.izPublic(roomSummary.isPublic)
.showPresence(roomSummary.isDirect)
.userPresence(roomSummary.directUserPresence)
.matrixItem(roomSummary.toMatrixItem())