Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump epoxy from 4.6.2 to 5.0.0 #7264

Merged
merged 11 commits into from
Oct 5, 2022
30 changes: 30 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions dependencies_groups.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion library/external/jsonviewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion vector-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion vector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading