diff --git a/build.gradle b/build.gradle index dd0f9a8d7f..9e0b3d1282 100644 --- a/build.gradle +++ b/build.gradle @@ -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) + } + } + } + } + } + } +} diff --git a/dependencies.gradle b/dependencies.gradle index 81a02d7f9d..ab2a5b4a6f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -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" diff --git a/dependencies_groups.gradle b/dependencies_groups.gradle index cdab6172d1..991d54d9af 100644 --- a/dependencies_groups.gradle +++ b/dependencies_groups.gradle @@ -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', diff --git a/library/external/jsonviewer/build.gradle b/library/external/jsonviewer/build.gradle index 4e8dc99654..50bb635e8e 100644 --- a/library/external/jsonviewer/build.gradle +++ b/library/external/jsonviewer/build.gradle @@ -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 diff --git a/library/external/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt b/library/external/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt index fbf6f88bc3..719ce29045 100644 --- a/library/external/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt +++ b/library/external/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt @@ -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) diff --git a/vector-app/build.gradle b/vector-app/build.gradle index ad72e44e13..0e9d30b165 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -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 diff --git a/vector/build.gradle b/vector/build.gradle index 0ddee2428a..76f32a34db 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewFragment.kt b/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewFragment.kt index 20b155d11e..e7ab8c9804 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewFragment.kt @@ -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, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 8a259b0eea..867c635a06 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -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() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index fece5786fe..eb7b0d4ed8 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -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) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt index 256019a2cb..fda9a1465f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt @@ -53,8 +53,7 @@ abstract class MessageAudioItem : AbsMessageItem() { 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() { 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) } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt index b11d8fbb52..bf16c8959e 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt @@ -48,12 +48,10 @@ abstract class MessageFileItem : AbsMessageItem() { 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() { 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() { if (attributes.informationData.sendState.isSending()) { holder.fileImageView.setImageResource(iconRes) } else { - if (isDownloaded) { + if (izDownloaded) { holder.fileImageView.setImageResource(iconRes) holder.fileDownloadProgress.progress = 0 } else { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt index 93e95dd4a5..e057950790 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt @@ -55,8 +55,7 @@ abstract class MessageVoiceItem : AbsMessageItem() { var waveform: List = emptyList() @EpoxyAttribute - @JvmField - var isLocalFile = false + var izLocalFile = false @EpoxyAttribute lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder @@ -77,7 +76,7 @@ abstract class MessageVoiceItem : AbsMessageItem() { 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) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt index 9591048725..970b1c34e1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt @@ -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() diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemCentered.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryCenteredItem.kt similarity index 96% rename from vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemCentered.kt rename to vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryCenteredItem.kt index 440df0952c..764f50456c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemCentered.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryCenteredItem.kt @@ -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(R.layout.item_room_centered) { +abstract class RoomSummaryCenteredItem : VectorEpoxyModel(R.layout.item_room_centered) { @EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer @@ -61,8 +61,8 @@ abstract class RoomSummaryItemCentered : VectorEpoxyModel(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(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) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index 290b66e576..638e3c185d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -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()) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPagedController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPagedController.kt index 10d7ef425c..43b20296af 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPagedController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPagedController.kt @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemPlaceHolder.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPlaceHolderItem.kt similarity index 90% rename from vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemPlaceHolder.kt rename to vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPlaceHolderItem.kt index df191bc2ec..75156ad5d9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemPlaceHolder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryPlaceHolderItem.kt @@ -24,7 +24,7 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyModel @EpoxyModelClass -abstract class RoomSummaryItemPlaceHolder : VectorEpoxyModel(R.layout.item_room_placeholder) { +abstract class RoomSummaryPlaceHolderItem : VectorEpoxyModel(R.layout.item_room_placeholder) { @EpoxyAttribute var useSingleLineForLastEvent: Boolean = false diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResults.kt b/vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResultsItem.kt similarity index 84% rename from vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResults.kt rename to vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResultsItem.kt index 6899b59f38..1efbf53214 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResults.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/SpaceDirectoryFilterNoResultsItem.kt @@ -22,6 +22,6 @@ import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyModel @EpoxyModelClass -abstract class SpaceDirectoryFilterNoResults : VectorEpoxyModel(R.layout.item_space_directory_filter_no_results) { +abstract class SpaceDirectoryFilterNoResultsItem : VectorEpoxyModel(R.layout.item_space_directory_filter_no_results) { class Holder : VectorEpoxyHolder() } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeFilteredRoomsController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeFilteredRoomsController.kt index cd245af0fc..500039e3eb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeFilteredRoomsController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeFilteredRoomsController.kt @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt index 5677f3e4a8..d8c71e3e17 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/invites/InvitesController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/invites/InvitesController.kt index 1511b97c3c..b59dfbdd43 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/invites/InvitesController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/invites/InvitesController.kt @@ -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) } } diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt index 026ee159ed..bf2075d3a8 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt index 137f1c8722..9fc55d14aa 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt @@ -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) diff --git a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt index 5b362690fa..e2fde4d45b 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt @@ -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 { diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceAddRoomFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceAddRoomFragment.kt index d0115d561a..edc18a8816 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceAddRoomFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceAddRoomFragment.kt @@ -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) } diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt index 9632087191..d149a3521d 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewController.kt @@ -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)