Merge pull request #7264 from vector-im/dependabot/gradle/epoxy-5.0.0

Bump epoxy from 4.6.2 to 5.0.0
This commit is contained in:
Benoit Marty 2022-10-05 17:30:29 +02:00 committed by GitHub
commit 6d2caf6210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 82 additions and 51 deletions

View File

@ -44,6 +44,8 @@ plugins {
id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
// Detekt
id "io.gitlab.arturbosch.detekt" version "1.21.0"
// Ksp
id "com.google.devtools.ksp" version "1.7.20-1.0.6"
// Dependency Analysis
id 'com.autonomousapps.dependency-analysis' version "1.13.1"
@ -327,3 +329,31 @@ ext.initScreenshotTests = { project ->
}
}
}
// Workaround to have KSP generated Kotlin code available in the IDE (for code completion)
// Ref: https://github.com/airbnb/epoxy/releases/tag/5.0.0beta02
subprojects { project ->
afterEvaluate {
if (project.hasProperty("android")) {
android {
if (it instanceof com.android.build.gradle.LibraryExtension) {
libraryVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
} else if (it instanceof com.android.build.gradle.AppExtension) {
applicationVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
}
}
}
}
}

View File

@ -20,7 +20,7 @@ def moshi = "1.14.0"
def lifecycle = "2.5.1"
def flowBinding = "1.2.0"
def flipper = "0.164.0"
def epoxy = "4.6.2"
def epoxy = "5.0.0"
def mavericks = "3.0.1"
def glide = "4.14.1"
def bigImageViewer = "1.8.1"

View File

@ -84,6 +84,7 @@ ext.groups = [
'com.google',
'com.google.android',
'com.google.api.grpc',
'com.google.auto',
'com.google.auto.service',
'com.google.auto.value',
'com.google.code.findbugs',
@ -101,6 +102,7 @@ ext.groups = [
'com.googlecode.json-simple',
'com.googlecode.libphonenumber',
'com.ibm.icu',
'com.intellij',
'com.jakewharton.android.repackaged',
'com.jakewharton.timber',
'com.kgurgul.flipper',

View File

@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.devtools.ksp'
buildscript {
repositories {
@ -51,7 +52,7 @@ dependencies {
implementation libs.androidx.recyclerview
implementation libs.airbnb.epoxy
kapt libs.airbnb.epoxyProcessor
ksp libs.airbnb.epoxyProcessor
implementation libs.airbnb.mavericks
// Span utils

View File

@ -62,7 +62,7 @@ class JSonViewerFragment : Fragment(), MavericksView {
}
recyclerView = inflate.findViewById(R.id.jvRecyclerView)
recyclerView.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
recyclerView.setController(epoxyController)
epoxyController.setStyle(args?.styleProvider)
registerForContextMenu(recyclerView)

View File

@ -6,6 +6,7 @@ apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'kotlinx-knit'
apply plugin: 'com.likethesalad.stem'
@ -387,7 +388,7 @@ dependencies {
// OSS License, gplay flavor only
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
kapt libs.dagger.hiltCompiler
kapt libs.airbnb.epoxyProcessor
ksp libs.airbnb.epoxyProcessor
androidTestImplementation libs.androidx.testCore
androidTestImplementation libs.androidx.testRunner

View File

@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'dagger.hilt.android.plugin'
if (project.hasProperty("coverage")) {
@ -156,7 +157,7 @@ dependencies {
api libs.airbnb.epoxy
implementation libs.airbnb.epoxyGlide
kapt libs.airbnb.epoxyProcessor
ksp libs.airbnb.epoxyProcessor
implementation libs.airbnb.epoxyPaging
api libs.airbnb.mavericks

View File

@ -207,13 +207,13 @@ class AttachmentsPreviewFragment :
attachmentMiniaturePreviewController.callback = this
views.attachmentPreviewerMiniatureList.let {
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
it.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
it.setHasFixedSize(true)
it.adapter = attachmentMiniaturePreviewController.adapter
}
views.attachmentPreviewerBigList.let {
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
it.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
it.attachSnapHelperWithListener(
PagerSnapHelper(),
SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL_STATE_IDLE,

View File

@ -1436,8 +1436,8 @@ class TimelineFragment :
timelineEventController.timeline = timelineViewModel.timeline
views.timelineRecyclerView.trackItemsVisibilityChange()
layoutManager = object : LinearLayoutManager(context, RecyclerView.VERTICAL, true) {
override fun onLayoutCompleted(state: RecyclerView.State?) {
layoutManager = object : LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, true) {
override fun onLayoutCompleted(state: RecyclerView.State) {
super.onLayoutCompleted(state)
updateJumpToReadMarkerViewVisibility()
jumpToBottomViewVisibilityManager.maybeShowJumpToBottomViewVisibilityWithDelay()

View File

@ -245,7 +245,7 @@ class MessageItemFactory @Inject constructor(
.pollQuestion(createPollQuestion(informationData, pollViewState.question, callback))
.canVote(pollViewState.canVote)
.votesStatus(pollViewState.votesStatus)
.optionViewStates(pollViewState.optionViewStates)
.optionViewStates(pollViewState.optionViewStates.orEmpty())
.edited(informationData.hasBeenEdited)
.highlighted(highlight)
.leftGuideline(avatarSizeProvider.leftGuideline)
@ -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

@ -285,7 +285,7 @@ class RoomListFragment :
}
private fun setupRecyclerView() {
val layoutManager = LinearLayoutManager(context)
val layoutManager = LinearLayoutManager(requireContext())
stateRestorer = LayoutManagerStateRestorer(layoutManager).register()
views.roomListView.layoutManager = layoutManager
views.roomListView.itemAnimator = RoomListAnimator()

View File

@ -41,7 +41,7 @@ import org.matrix.android.sdk.api.session.presence.model.UserPresence
import org.matrix.android.sdk.api.util.MatrixItem
@EpoxyModelClass
abstract class RoomSummaryItemCentered : VectorEpoxyModel<RoomSummaryItemCentered.Holder>(R.layout.item_room_centered) {
abstract class RoomSummaryCenteredItem : VectorEpoxyModel<RoomSummaryCenteredItem.Holder>(R.layout.item_room_centered) {
@EpoxyAttribute
lateinit var avatarRenderer: AvatarRenderer
@ -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

@ -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

@ -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())
@ -191,13 +191,13 @@ class RoomSummaryItemFactory @Inject constructor(
unreadCount: Int,
onClick: ((RoomSummary) -> Unit)?,
onLongClick: ((RoomSummary) -> Boolean)?
) = RoomSummaryItemCentered_()
) = RoomSummaryCenteredItem_()
.id(roomSummary.roomId)
.avatarRenderer(avatarRenderer)
// 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())

View File

@ -67,7 +67,7 @@ class RoomSummaryPagedController(
override fun buildItemModel(currentPosition: Int, item: RoomSummary?): EpoxyModel<*> {
return if (item == null) {
val host = this
RoomSummaryItemPlaceHolder_().apply {
RoomSummaryPlaceHolderItem_().apply {
id(currentPosition)
useSingleLineForLastEvent(host.shouldUseSingleLine)
}

View File

@ -24,7 +24,7 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
@EpoxyModelClass
abstract class RoomSummaryItemPlaceHolder : VectorEpoxyModel<RoomSummaryItemPlaceHolder.Holder>(R.layout.item_room_placeholder) {
abstract class RoomSummaryPlaceHolderItem : VectorEpoxyModel<RoomSummaryPlaceHolderItem.Holder>(R.layout.item_room_placeholder) {
@EpoxyAttribute
var useSingleLineForLastEvent: Boolean = false

View File

@ -22,6 +22,6 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
@EpoxyModelClass
abstract class SpaceDirectoryFilterNoResults : VectorEpoxyModel<SpaceDirectoryFilterNoResults.Holder>(R.layout.item_space_directory_filter_no_results) {
abstract class SpaceDirectoryFilterNoResultsItem : VectorEpoxyModel<SpaceDirectoryFilterNoResultsItem.Holder>(R.layout.item_space_directory_filter_no_results) {
class Holder : VectorEpoxyHolder()
}

View File

@ -24,7 +24,7 @@ import im.vector.app.core.utils.createUIHandler
import im.vector.app.features.home.RoomListDisplayMode
import im.vector.app.features.home.room.list.RoomListListener
import im.vector.app.features.home.room.list.RoomSummaryItemFactory
import im.vector.app.features.home.room.list.RoomSummaryItemPlaceHolder_
import im.vector.app.features.home.room.list.RoomSummaryPlaceHolderItem_
import im.vector.app.features.settings.FontScalePreferences
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
import org.matrix.android.sdk.api.session.room.model.RoomSummary
@ -83,7 +83,7 @@ class HomeFilteredRoomsController @Inject constructor(
override fun buildItemModel(currentPosition: Int, item: RoomSummary?): EpoxyModel<*> {
return if (item == null) {
val host = this
RoomSummaryItemPlaceHolder_().apply {
RoomSummaryPlaceHolderItem_().apply {
id(currentPosition)
useSingleLineForLastEvent(host.shouldUseSingleLine)
}

View File

@ -137,7 +137,7 @@ class HomeRoomListFragment :
private fun setupRecyclerView() {
views.stateView.state = StateView.State.Content
val layoutManager = LinearLayoutManager(context)
val layoutManager = LinearLayoutManager(requireContext())
firstItemObserver = FirstItemUpdatedObserver(layoutManager) {
layoutManager.scrollToPosition(0)
}

View File

@ -22,7 +22,7 @@ import im.vector.app.core.utils.createUIHandler
import im.vector.app.features.home.RoomListDisplayMode
import im.vector.app.features.home.room.list.RoomListListener
import im.vector.app.features.home.room.list.RoomSummaryItemFactory
import im.vector.app.features.home.room.list.RoomSummaryItemPlaceHolder_
import im.vector.app.features.home.room.list.RoomSummaryPlaceHolderItem_
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
import org.matrix.android.sdk.api.session.room.model.RoomSummary
import javax.inject.Inject
@ -43,7 +43,7 @@ class InvitesController @Inject constructor(
var listener: RoomListListener? = null
override fun buildItemModel(currentPosition: Int, item: RoomSummary?): EpoxyModel<*> {
item ?: return RoomSummaryItemPlaceHolder_().apply { id(currentPosition) }
item ?: return RoomSummaryPlaceHolderItem_().apply { id(currentPosition) }
return roomSummaryItemFactory.create(item, roomChangeMembershipStates.orEmpty(), emptySet(), RoomListDisplayMode.ROOMS, listener)
}
}

View File

@ -20,7 +20,7 @@ import android.content.Context
import android.os.Build
import androidx.annotation.MainThread
import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting.PRIVATE
import androidx.annotation.VisibleForTesting.Companion.PRIVATE
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG
import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_WEAK

View File

@ -65,7 +65,7 @@ class VectorSettingsNotificationsTroubleshootFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val layoutManager = LinearLayoutManager(context)
val layoutManager = LinearLayoutManager(requireContext())
views.troubleshootTestRecyclerView.layoutManager = layoutManager
val dividerItemDecoration = DividerItemDecoration(view.context, layoutManager.orientation)

View File

@ -34,7 +34,7 @@ import im.vector.app.core.ui.list.genericEmptyWithActionItem
import im.vector.app.core.ui.list.genericPillItem
import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.list.spaceChildInfoItem
import im.vector.app.features.home.room.list.spaceDirectoryFilterNoResults
import im.vector.app.features.home.room.list.spaceDirectoryFilterNoResultsItem
import im.vector.app.features.spaces.manage.SpaceChildInfoMatchFilter
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
import me.gujun.android.span.span
@ -141,7 +141,7 @@ class SpaceDirectoryController @Inject constructor(
val filteredChildInfo = flattenChildInfo.filter { matchFilter.test(it) }
if (filteredChildInfo.isEmpty()) {
spaceDirectoryFilterNoResults {
spaceDirectoryFilterNoResultsItem {
id("no_results")
}
} else {

View File

@ -214,7 +214,7 @@ class SpaceAddRoomFragment :
roomEpoxyController.submitList(it)
}
listenItemCount(viewModel.roomCountFlow) { roomEpoxyController.totalSize = it }
views.roomList.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
views.roomList.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
views.roomList.setHasFixedSize(true)
}

View File

@ -65,7 +65,7 @@ class SpacePreviewController @Inject constructor(
subSpaceItem {
id(child.roomId)
roomId(child.roomId)
title(child.name)
title(child.name ?: "")
depth(depth)
avatarUrl(child.avatarUrl)
avatarRenderer(host.avatarRenderer)