Small cleanup

This commit is contained in:
Benoit Marty 2020-11-10 14:46:19 +01:00
parent dc17e5c3fa
commit bcd384c31c
4 changed files with 10 additions and 9 deletions

View File

@ -30,7 +30,10 @@ import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.session.file.FileService
import java.io.File
abstract class BaseAttachmentProvider(val imageContentRenderer: ImageContentRenderer, val fileService: FileService) : AttachmentSourceProvider {
abstract class BaseAttachmentProvider(
private val imageContentRenderer: ImageContentRenderer,
protected val fileService: FileService
) : AttachmentSourceProvider {
interface InteractionListener {
fun onDismissTapped()

View File

@ -31,7 +31,6 @@ import java.io.File
class DataAttachmentRoomProvider(
private val attachments: List<AttachmentData>,
private val room: Room?,
private val initialIndex: Int,
imageContentRenderer: ImageContentRenderer,
private val dateFormatter: VectorDateFormatter,
fileService: FileService) : BaseAttachmentProvider(imageContentRenderer, fileService) {

View File

@ -40,7 +40,6 @@ import javax.inject.Inject
class RoomEventsAttachmentProvider(
private val attachments: List<TimelineEvent>,
private val initialIndex: Int,
imageContentRenderer: ImageContentRenderer,
private val dateFormatter: VectorDateFormatter,
fileService: FileService
@ -167,11 +166,11 @@ class AttachmentProviderFactory @Inject constructor(
private val session: Session
) {
fun createProvider(attachments: List<TimelineEvent>, initialIndex: Int): RoomEventsAttachmentProvider {
return RoomEventsAttachmentProvider(attachments, initialIndex, imageContentRenderer, vectorDateFormatter, session.fileService())
fun createProvider(attachments: List<TimelineEvent>): RoomEventsAttachmentProvider {
return RoomEventsAttachmentProvider(attachments, imageContentRenderer, vectorDateFormatter, session.fileService())
}
fun createProvider(attachments: List<AttachmentData>, room: Room?, initialIndex: Int): DataAttachmentRoomProvider {
return DataAttachmentRoomProvider(attachments, room, initialIndex, imageContentRenderer, vectorDateFormatter, session.fileService())
fun createProvider(attachments: List<AttachmentData>, room: Room?): DataAttachmentRoomProvider {
return DataAttachmentRoomProvider(attachments, room, imageContentRenderer, vectorDateFormatter, session.fileService())
}
}

View File

@ -118,7 +118,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
val inMemoryData = intent.getParcelableArrayListExtra<AttachmentData>(EXTRA_IN_MEMORY_DATA)
if (inMemoryData != null) {
val sourceProvider = dataSourceFactory.createProvider(inMemoryData, room, initialIndex)
val sourceProvider = dataSourceFactory.createProvider(inMemoryData, room)
val index = inMemoryData.indexOfFirst { it.eventId == args.eventId }
initialIndex = index
sourceProvider.interactionListener = this
@ -137,7 +137,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
val index = events.indexOfFirst { it.eventId == args.eventId }
initialIndex = index
val sourceProvider = dataSourceFactory.createProvider(events, index)
val sourceProvider = dataSourceFactory.createProvider(events)
sourceProvider.interactionListener = this
setSourceProvider(sourceProvider)
this.currentSourceProvider = sourceProvider