setBlurEffectPreset

fun setBlurEffectPreset(view: View, blurMode: Int, colorCurvePreset: Int, @ColorInt color: Int? = null, cornerRadius: Float? = null): Boolean(source)

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

This function allows applying a predefined blur effect using a color curve preset. It also allows optional customization of the background color and corner radius.

The blur effect will not be applied if a custom theme is applied or if the "reduce transparency" 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.

colorCurvePreset

The preset for the color curve of the blur effect. Refer to constants like BLUR_UI_HIGH_ULTRA_THICK_DARK for available presets.

color

Optional: The background color for the blur effect. If null, a default color based on the will might be used.

cornerRadius

Optional: The corner radius for the blurred background. If null, a default corner radius might be used.