mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Use let
This commit is contained in:
parent
f2f94c4a93
commit
7495533edc
@ -128,6 +128,7 @@ class AttachmentsPreviewFragment @Inject constructor(
|
|||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
attachmentPreviewerMiniatureList.cleanup()
|
attachmentPreviewerMiniatureList.cleanup()
|
||||||
attachmentPreviewerBigList.cleanup()
|
attachmentPreviewerBigList.cleanup()
|
||||||
|
attachmentMiniaturePreviewController.callback = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
@ -229,21 +230,26 @@ class AttachmentsPreviewFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupRecyclerViews() {
|
private fun setupRecyclerViews() {
|
||||||
attachmentPreviewerMiniatureList.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
|
||||||
attachmentPreviewerMiniatureList.setHasFixedSize(true)
|
|
||||||
attachmentPreviewerMiniatureList.adapter = attachmentMiniaturePreviewController.adapter
|
|
||||||
attachmentMiniaturePreviewController.callback = this
|
attachmentMiniaturePreviewController.callback = this
|
||||||
|
|
||||||
attachmentPreviewerBigList.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
attachmentPreviewerMiniatureList.let {
|
||||||
attachmentPreviewerBigList.attachSnapHelperWithListener(
|
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||||
PagerSnapHelper(),
|
it.setHasFixedSize(true)
|
||||||
SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL_STATE_IDLE,
|
it.adapter = attachmentMiniaturePreviewController.adapter
|
||||||
object : OnSnapPositionChangeListener {
|
}
|
||||||
override fun onSnapPositionChange(position: Int) {
|
|
||||||
viewModel.handle(AttachmentsPreviewAction.SetCurrentAttachment(position))
|
attachmentPreviewerBigList.let {
|
||||||
}
|
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||||
})
|
it.attachSnapHelperWithListener(
|
||||||
attachmentPreviewerBigList.setHasFixedSize(true)
|
PagerSnapHelper(),
|
||||||
attachmentPreviewerBigList.adapter = attachmentBigPreviewController.adapter
|
SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL_STATE_IDLE,
|
||||||
|
object : OnSnapPositionChangeListener {
|
||||||
|
override fun onSnapPositionChange(position: Int) {
|
||||||
|
viewModel.handle(AttachmentsPreviewAction.SetCurrentAttachment(position))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it.setHasFixedSize(true)
|
||||||
|
it.adapter = attachmentBigPreviewController.adapter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user