I am converting an existing view to jetpack compose. I found out that dimensionResource() is different from resources.getDimension(). Why is that? I know that the code for dimensionResource() is dividing the resources.getDimension() by screen density. The issue I have is that we can't really convert everything on our app to jetpack compose. We are slowly converting it but that would take a while. Because the result are different, we will have to provide a new dimension sp for jetpack compose which is weird as I thought that compose work well with view xml and vice versa. Perhaps what I wanted to know is that why did jetpack compose team decided to make the dimensionResource() different from that one we would normally use for view xml? This adds more confusion. Example
Column {
Text("Using context.resources")
Text("Testing", fontSize = resources.getDimension(R.dimen.test).sp)
Spacer(modifier = Modifier.height(12.dp))
Text("Using dimensionResource")
Text("Testing", fontSize = dimensionResource(R.dimen.test).value.sp)
}
Result is
