ColorProtection


public class ColorProtection extends ContrastProtection


A type of protection which draws the plain color.

Summary

Public constructors

ColorProtection(int side)

Creates an instance associated with a WindowInsetsCompat.Side.

ColorProtection(int side, @ColorInt int color)

Creates an instance associated with a WindowInsetsCompat.Side.

Public methods

@ColorInt int

Gets the color associated with this protection.

void
setColor(@ColorInt int color)

Sets the color to the protection.

Inherited methods

From androidx.core.view.insetscontrast.ContrastProtection
void
animateAlpha(float toAlpha)

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

void
animateInsetsAmount(float toInsetsAmount)

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.

void
setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)

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.

void
setInsetAmount(@FloatRange(from = 0.0, to = 1.0) float insetAmount)

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

ColorProtection

public ColorProtection(int side)

Creates an instance associated with a WindowInsetsCompat.Side.

Parameters
int side

the given WindowInsetsCompat.Side.

ColorProtection

public ColorProtection(int side, @ColorInt int color)

Creates an instance associated with a WindowInsetsCompat.Side.

Parameters
int side

the given WindowInsetsCompat.Side.

@ColorInt int color

The color to draw.

Public methods

getColor

public @ColorInt int getColor()

Gets the color associated with this protection.

Returns
@ColorInt int

The color associated with this protection.

setColor

public void setColor(@ColorInt int color)

Sets the color to the protection.

Parameters
@ColorInt int color

The color to draw.