Allan Wang
06/30/2020, 9:23 AMimageResource
is “likely to be removed” due to synchronous loading, and results in an AIOOB exception
• The deferred loading pattern seems preferred, but does not seem to redraw once the icon loads.
What is the correct approach here for loading resource content?
Edit: I now realize there is a difference between imageResource
and vectorResource
, but the latter is also a transient APIAnastasia [G]
06/30/2020, 4:51 PMloadImageResource
?Allan Wang
06/30/2020, 8:39 PMAnastasia [G]
06/30/2020, 8:51 PMLuca
06/30/2020, 9:07 PM@Preview
@Composable
fun ProfilePreview() {
Image(loadVectorResource(id = R.drawable.ic_baseline_tag_faces_24, pendingResource = vectorResource(
id = R.drawable.pending_24)).resource.resource!!)
}
Luca
06/30/2020, 9:10 PMAllan Wang
06/30/2020, 9:21 PMLuca
06/30/2020, 9:27 PMLuca
06/30/2020, 9:29 PMAllan Wang
06/30/2020, 10:11 PMvectorResource
instead of imageResource
(not sure why there needs to be a difference API wise), so I will likely keep using that now for testing. It seems like a lot of additional work for deferred loading on what is a very common UI componentAnastasia [G]
07/01/2020, 1:49 PMNader Jawad
07/06/2020, 7:53 PMval vectorAsset = loadVectorResource(R.drawable.ic_crane)
vectorAsset.resource.resource?.let {
Image(
asset = it,
modifier = Modifier.preferredSize(200.dp, 200.dp),
contentScale = ContentScale.Inside
)
}
Nader Jawad
07/06/2020, 7:54 PMAllan Wang
07/06/2020, 9:17 PMTimo Drick
07/15/2020, 8:47 AM