setBlurEffect

fun setBlurEffect(view: View, blurMode: Int, @ColorInt color: Int, radius: Int, cornerRadius: Float, useTypeCanvasBlur: Int? = CANVAS_BLUR_USE_TYPE_STATIC): Boolean

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 blur mode, color, radius, 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.

blurMode

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

color

The background color for the blur effect.

radius

The radius of the blur.

cornerRadius

The corner radius for the blurred background.

useTypeCanvasBlur

Whether the canvas blur should be dynamic, one of CANVAS_BLUR_USE_TYPE_STATIC or CANVAS_BLUR_USE_TYPE_DYNAMIC.