setBlurEffect

fun setBlurEffect(view: View, @ColorInt color: Int, radius: Int, blurMode: Int, cornerRadius: Float): Boolean(source)

Sets a blur effect on the given view on a device running Samsung's One UI.

This function allows applying a blur effect with specific parameters for color, radius, blur mode, and corner radius.

The blur effect will not be applied if a custom theme is applied or if the "reduce transparency and blur" accessibility setting is enabled.

Return

true if the blur effect was successfully applied, false otherwise (e.g., if themes are applied, reduce transparency is enabled, or the blur builder creation failed).

Parameters

view

The view to apply the blur effect to.

color

The background color for the blur effect.

radius

The radius of the blur.

blurMode

The blur mode to use. Must be one of BLUR_MODE_WINDOW, BLUR_MODE_WINDOW_CAPTURED, or BLUR_MODE_CANVAS.

cornerRadius

The corner radius for the blurred background.