1

My Glance image is set like this:

Image(
    provider = ImageProvider(
        bitmap
    ),
    contentDescription = "Image",
    modifier = GlanceModifier
        .size(70.dp)
        .imageCornerRadius()
        .clickable(
             actionRunCallback<StartAppCallback>(
                 parameters = actionParametersOf(
                     StartAppCallback.WIDGET_TYPE to type.value,
                     StartAppCallback.ID to model.id
                 )
             )
       ),
)

and image corner radius is set like:

fun GlanceModifier.imageCornerRadius(): GlanceModifier {
    return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
        this.cornerRadius(android.R.dimen.system_app_widget_inner_radius)
    } else {
        this.cornerRadius(8.dp)
    }
}

If it is a bug, and there are no workarounds, I will edit my question with the issue tracker link. Thanks for any advice.

Subfly
  • 492
  • 2
  • 13
  • 1
    As described in the doc. `cornerRadius` adds rounded corners for the current view. **Note: Only works on Android S+.** – Gabriele Mariotti Nov 23 '22 at 09:49
  • IOW, your `if`/`else` in your `imageCornerRadius()` is pointless, as the `cornerRadius()` call will be ignored on older devices. If you want rounded corners on older devices, you will need to modify the bitmap itself. – CommonsWare Nov 23 '22 at 12:16
  • Please close this question since it has been answered – Nino van Hooff Dec 06 '22 at 13:19

0 Answers0