GradientProtection


class GradientProtection : ContrastProtection


A type of protection which draws the gradient color.

Summary

Public constructors

Creates an instance associated with a WindowInsetsCompat.Side.

GradientProtection(side: Int, color: @ColorInt Int)

Creates an instance associated with a WindowInsetsCompat.Side.

Public functions

@ColorInt Int

Gets the color associated with this protection.

Float

Gets the scale of the thickness of the protection.

Unit

Sets the color to the protection.

Unit
setScale(scale: Float)

Sets the scale of the thickness to the protection.

Inherited functions

From androidx.core.view.insetscontrast.ContrastProtection
Unit
animateAlpha(toAlpha: Float)

Animates the alpha from the current value to the specified one.

Unit
animateInsetsAmount(toInsetsAmount: Float)

Animates the insets amount from the current value to the specified one.

@FloatRange(from = 0.0, to = 1.0) Float

Gets the opacity of the protection.

Float

Gets the depth of the protection.

Int

Gets the side of this protection.

Unit
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float)

Sets the opacity of the protection to a value from 0 to 1, where 0 means the protection is completely transparent and 1 means the protection is completely opaque.

Unit
setInsetAmount(insetAmount: @FloatRange(from = 0.0, to = 1.0) Float)

Sets the depth of the protection to a value from 0 to 1, where 0 means the protection is completely outside the window and 1 means the protection is completely inside the window.

Public constructors

GradientProtection

GradientProtection(side: Int)

Creates an instance associated with a WindowInsetsCompat.Side.

Parameters
side: Int

the given WindowInsetsCompat.Side.

GradientProtection

GradientProtection(side: Int, color: @ColorInt Int)

Creates an instance associated with a WindowInsetsCompat.Side.

Parameters
side: Int

the given WindowInsetsCompat.Side.

color: @ColorInt Int

The color to draw.

Public functions

getColor

fun getColor(): @ColorInt Int

Gets the color associated with this protection.

Returns
@ColorInt Int

The color associated with this protection.

getScale

fun getScale(): Float

Gets the scale of the thickness of the protection.

Returns
Float

The scale of the thickness.

setColor

fun setColor(color: @ColorInt Int): Unit

Sets the color to the protection. The pixels farther away from the edge get more transparent.

Parameters
color: @ColorInt Int

The color to draw.

setScale

fun setScale(scale: Float): Unit

Sets the scale of the thickness to the protection.

Parameters
scale: Float

The scale of the thickness.