mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
More cleanup
This commit is contained in:
parent
345e8a0679
commit
816301bf8d
1 changed files with 7 additions and 11 deletions
|
@ -119,33 +119,29 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||
val inMemoryData = intent.getParcelableArrayListExtra<AttachmentData>(EXTRA_IN_MEMORY_DATA)
|
||||
if (inMemoryData != null) {
|
||||
val sourceProvider = dataSourceFactory.createProvider(inMemoryData, room)
|
||||
val index = inMemoryData.indexOfFirst { it.eventId == args.eventId }
|
||||
initialIndex = index
|
||||
initialIndex = inMemoryData.indexOfFirst { it.eventId == args.eventId }
|
||||
sourceProvider.interactionListener = this
|
||||
setSourceProvider(sourceProvider)
|
||||
this.currentSourceProvider = sourceProvider
|
||||
if (savedInstanceState == null) {
|
||||
pager2.setCurrentItem(index, false)
|
||||
pager2.setCurrentItem(initialIndex, false)
|
||||
// The page change listener is not notified of the change...
|
||||
pager2.post {
|
||||
onSelectedPositionChanged(index)
|
||||
onSelectedPositionChanged(initialIndex)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val events = room?.getAttachmentMessages()
|
||||
?: emptyList()
|
||||
val index = events.indexOfFirst { it.eventId == args.eventId }
|
||||
initialIndex = index
|
||||
|
||||
val events = room?.getAttachmentMessages().orEmpty()
|
||||
initialIndex = events.indexOfFirst { it.eventId == args.eventId }
|
||||
val sourceProvider = dataSourceFactory.createProvider(events)
|
||||
sourceProvider.interactionListener = this
|
||||
setSourceProvider(sourceProvider)
|
||||
this.currentSourceProvider = sourceProvider
|
||||
if (savedInstanceState == null) {
|
||||
pager2.setCurrentItem(index, false)
|
||||
pager2.setCurrentItem(initialIndex, false)
|
||||
// The page change listener is not notified of the change...
|
||||
pager2.post {
|
||||
onSelectedPositionChanged(index)
|
||||
onSelectedPositionChanged(initialIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue