added in version 22.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

ColorOverlayDimmer

public final class ColorOverlayDimmer
extends Object

java.lang.Object
   ↳ android.support.v17.leanback.graphics.ColorOverlayDimmer


Helper class for assigning a dim color to Paint. It holds the alpha value for the current active level.

Summary

Public methods

int applyToColor(int color)

Change the RGB of the color according to current dim level.

static ColorOverlayDimmer createColorOverlayDimmer(int dimColor, float activeLevel, float dimmedLevel)

Creates a ColorOverlayDimmer for the given color and levels.

static ColorOverlayDimmer createDefault(Context context)

Creates a default ColorOverlayDimmer.

void drawColorOverlay(Canvas c, View v, boolean includePadding)

Draw a dim color overlay on top of a child View inside the canvas of the parent View.

int getAlpha()

Returns the alpha value for the dimmer.

float getAlphaFloat()

Returns the float value between 0 and 1 corresponding to alpha between 0 and 255.

Paint getPaint()

Returns the Paint object set to the current alpha value.

boolean needsDraw()

Returns whether the dimmer needs to draw.

void setActiveLevel(float level)

Sets the active level of the dimmer.

Inherited methods

From class java.lang.Object

Public methods

applyToColor

added in version 22.1.0
int applyToColor (int color)

Change the RGB of the color according to current dim level. Maintains the alpha value of the color.

Parameters
color int: The color to apply the dim level to.

Returns
int A color with the RGB values adjusted by the alpha of the current dim level.

createColorOverlayDimmer

added in version 22.1.0