Skip to content

Commit 7aa17c2

Browse files
committed
Fix ImageWithCaptionAdapter.kt after introducing suspended functions
1 parent e9dcdaa commit 7aa17c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

media-placeholders/src/main/java/org/wordpress/aztec/placeholders/ImageWithCaptionAdapter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ImageWithCaptionAdapter(
2121
override fun getHeight(attrs: AztecAttributes): Proportion {
2222
return Proportion.Ratio(0.5f)
2323
}
24-
override fun createView(context: Context, placeholderUuid: String, attrs: AztecAttributes): View {
24+
override suspend fun createView(context: Context, placeholderUuid: String, attrs: AztecAttributes): View {
2525
val imageWithCaptionObject = media[placeholderUuid] ?: ImageWithCaptionObject(placeholderUuid, attrs.getValue(SRC_ATTRIBUTE), View.generateViewId()).apply {
2626
media[placeholderUuid] = this
2727
}
@@ -61,7 +61,7 @@ class ImageWithCaptionAdapter(
6161
return linearLayout
6262
}
6363

64-
override fun onViewCreated(view: View, placeholderUuid: String) {
64+
override suspend fun onViewCreated(view: View, placeholderUuid: String) {
6565
val image = media[placeholderUuid]!!
6666
val imageView = view.findViewById<ImageView>(image.layoutId)
6767
Glide.with(view).load(image.src).into(imageView)
@@ -79,7 +79,7 @@ class ImageWithCaptionAdapter(
7979
private const val CAPTION_ATTRIBUTE = "caption"
8080
private const val SRC_ATTRIBUTE = "src"
8181

82-
fun insertImageWithCaption(placeholderManager: PlaceholderManager, src: String, caption: String) {
82+
suspend fun insertImageWithCaption(placeholderManager: PlaceholderManager, src: String, caption: String) {
8383
placeholderManager.insertItem(ADAPTER_TYPE, SRC_ATTRIBUTE to src, CAPTION_ATTRIBUTE to caption)
8484
}
8585
}

0 commit comments

Comments
 (0)