This PR fixes 2 issues. A crash that sometimes happens when you rotate your device while inserting. In that case the layout might not yet be there so I've added a delay to wait for the layout up to 500ms.
The second issue happens when deleting multiple media. The previous solution was using a list which was problematic when deleting multiple media fast. In that case There were concurrency issues and not all onMediaDeleted callbacks were called.
To test change the MainActivity so that the ImageWithCaption adapter is set up. This means add this:
private lateinit var placeholderManager: PlaceholderManager
override fun onCreate(savedInstanceState: Bundle?) {
...
placeholderManager = PlaceholderManager(visualEditor, findViewById(R.id.container_frame_layout))
placeholderManager.registerAdapter(ImageWithCaptionAdapter())
...
Aztec.with(...)
.addOnMediaDeletedListener(placeholderManager)
.addPlugin(placeholderManager)
}
override fun onDestroy() {
super.onDestroy()
placeholderManager.onDestroy()
...
}
Fix
This PR fixes 2 issues. A crash that sometimes happens when you rotate your device while inserting. In that case the layout might not yet be there so I've added a delay to wait for the layout up to 500ms.
The second issue happens when deleting multiple media. The previous solution was using a list which was problematic when deleting multiple media fast. In that case There were concurrency issues and not all
onMediaDeleted
callbacks were called.To test change the
MainActivity
so that theImageWithCaption
adapter is set up. This means add this:and change the
EXAMPLE
to something like this:Test
Review
@khaykov
Make sure strings will be translated:
strings.xml
as a part of the integration PR.