SemBlurCompat

Provides compatibility methods for Samsung's blur effects.

This object allows applying blur effects to views, with options for different blur modes, colors, radii, and corner radii. It also handles checks for theme application and accessibility settings that might disable blur effects.

The blur functionality is based on Samsung's internal APIs and may not work on all devices or Android versions.

Types

Link copied to clipboard
data class CurveParameter(val blurRadius: Int, val saturation: Float, val curveLevel: Float, val curveMinX: Float, val curveMaxX: Float, val curveMinY: Float, val curveMaxY: Float)

Parameters for a custom blur color curve, added in One UI 8.5.

Link copied to clipboard
annotation class SeslBlurMode
Link copied to clipboard
annotation class SeslUseTypeCanvasBlur

Properties

Link copied to clipboard
const val BLUR_BASE_OFFSET: Int = 101
Link copied to clipboard
const val BLUR_MODE_CANVAS: Int = 2
Link copied to clipboard
const val BLUR_MODE_WINDOW: Int = 0
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

This method verifies if the Android SDK version is 35 or higher and if the device is running Samsung's One UI.

Link copied to clipboard
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.

Link copied to clipboard
fun setBlurEffectPreset(view: View, blurMode: Int, curveParameter: SemBlurCompat.CurveParameter, @ColorInt color: Int? = null, cornerRadius: Float? = null, useTypeCanvasBlur: Int? = CANVAS_BLUR_USE_TYPE_STATIC): Boolean

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

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

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

Link copied to clipboard

Clears any blur information previously set on the given view.