android: Fix list updating for image and QR code

This commit is contained in:
Harry Cheng 2022-06-11 13:11:33 +08:00
parent c6caf87a0a
commit 4673418d95
2 changed files with 21 additions and 15 deletions

View File

@ -136,15 +136,16 @@ fun KeyItem(key: PushKey, requestHolder: RequestHolder) {
) { ) {
AndroidView( AndroidView(
factory = { factory = {
ImageView(it).apply { ImageView(it)
this.setImageBitmap( },
QRCodeGenerator( update = { view ->
key.key, view.setImageBitmap(
400.dp.value.toInt(), QRCodeGenerator(
400.dp.value.toInt() key.key,
).qrCode 400.dp.value.toInt(),
) 400.dp.value.toInt()
} ).qrCode
)
}, },
modifier = Modifier.align(alignment = Alignment.Center) modifier = Modifier.align(alignment = Alignment.Center)
) )

View File

@ -137,12 +137,17 @@ fun ImageMessageItem(message: MessageEntity, requestHolder: RequestHolder) {
) )
} }
Card(modifier = Modifier.fillMaxWidth()) { Card(modifier = Modifier.fillMaxWidth()) {
AndroidView(factory = { AndroidView(
ImageView(it).apply { factory = {
scaleType = ImageView.ScaleType.FIT_CENTER ImageView(it).apply {
load(message.text, requestHolder.coilImageLoader) scaleType = ImageView.ScaleType.FIT_CENTER
} }
}, modifier = Modifier.fillMaxWidth()) },
update = { view ->
view.load(message.text, requestHolder.coilImageLoader)
},
modifier = Modifier.fillMaxWidth()
)
} }
} }
} }