This PR adds an option to the placeholder sizing where you can define placeholder size based on the item (and the AztecAttributes). This is good for things like images and videos which might not always be in landscape/portrait and showing them differently might result in a non-perfect experience
Test
Set up MainActivity with the placeholder manager and the ImageWithCaptionAdapter. The steps are:
Create PlaceholderManager in the onCreate method in MainActivity passing in the visualEditor
Call placeholderManager.registerAdapter(ImageWithCaptionAdapter()) to register the ImageWithCaptionAdapter
Modify the getWidth and getHeight methods in order to change them based on the item shown. For example:
Set EXAMPLE to <placeholder type=\"image_with_caption\" src=\"https://file-examples.com/storage/febc474733629f43d9f078c/2017/10/file_example_JPG_100kB.jpg\" caption=\"1\"><br><placeholder type=\"image_with_caption\" src=\"https://file-examples.com/storage/febc474733629f43d9f078c/2017/10/file_example_JPG_100kB.jpg\" caption=\"2\">
Modify getHeight method in ImageWithCaptionAdapter so that it returns different value based on the caption attribute`
Run the app
Notice the images are drawn differently
Review
@danilo04
Make sure strings will be translated:
[x] If there are new strings that have to be translated, I have added them to the client's strings.xml as a part of the integration PR.
Fix
This PR adds an option to the placeholder sizing where you can define placeholder size based on the item (and the AztecAttributes). This is good for things like images and videos which might not always be in landscape/portrait and showing them differently might result in a non-perfect experience
Test
MainActivity
with the placeholder manager and theImageWithCaptionAdapter
. The steps are:PlaceholderManager
in theonCreate
method inMainActivity
passing in thevisualEditor
placeholderManager.registerAdapter(ImageWithCaptionAdapter())
to register theImageWithCaptionAdapter
aztec.addPlugin(placeholderManager)
aztec.addOnMediaDeletedListener(placeholderManager)
getWidth
andgetHeight
methods in order to change them based on the item shown. For example:EXAMPLE
to<placeholder type=\"image_with_caption\" src=\"https://file-examples.com/storage/febc474733629f43d9f078c/2017/10/file_example_JPG_100kB.jpg\" caption=\"1\"><br><placeholder type=\"image_with_caption\" src=\"https://file-examples.com/storage/febc474733629f43d9f078c/2017/10/file_example_JPG_100kB.jpg\" caption=\"2\">
getHeight
method inImageWithCaptionAdapter
so that it returns different value based on thecaption
attribute`Review
@danilo04
Make sure strings will be translated:
strings.xml
as a part of the integration PR.