ColorFilterDimmer
class ColorFilterDimmer
kotlin.Any | |
↳ | androidx.leanback.graphics.ColorFilterDimmer |
Helper class for applying a dim level to a View. The ColorFilterDimmer uses a ColorFilter in a Paint object to dim the view according to the currently active level.
Summary
Public methods | |
---|---|
Unit |
applyFilterToView(view: View!) Apply current the ColorFilter to a View. |
static ColorFilterDimmer! |
create(dimmer: ColorFilterCache!, activeLevel: Float, dimmedLevel: Float) Creates a ColorFilterDimmer for the given color and levels. |
static ColorFilterDimmer! |
createDefault(context: Context!) Creates a default ColorFilterDimmer. |
ColorFilter! |
Gets the ColorFilter set to the current dim level. |
Paint! |
getPaint() Gets the Paint object set to the current dim level. |
Unit |
setActiveLevel(level: Float) Sets the active level of the dimmer. |
Public methods
applyFilterToView
fun applyFilterToView(view: View!): Unit
Apply current the ColorFilter to a View. This method will set the hardware layer of the view when applying a filter, and remove it when not applying a filter.
Parameters | |
---|---|
view |
View!: The View to apply the ColorFilter to. |
create
static fun create(
dimmer: ColorFilterCache!,
activeLevel: Float,
dimmedLevel: Float
): ColorFilterDimmer!
Creates a ColorFilterDimmer for the given color and levels..
Parameters | |
---|---|
dimmer |
ColorFilterCache!: The ColorFilterCache for dim color. |
activeLevel |
Float: The level of dimming when the View is in its active state. Must be a float value between 0.0 and 1.0. |
dimmedLevel |
Float: The level of dimming when the View is in its dimmed state. Must be a float value between 0.0 and 1.0. |
createDefault
static fun createDefault(context: Context!): ColorFilterDimmer!
Creates a default ColorFilterDimmer. Uses the default color and level for the dimmer.
Parameters | |
---|---|
context |
Context!: A Context used to retrieve Resources. |
Return | |
---|---|
ColorFilterDimmer! |
A ColorFilterDimmer with the default dim color and levels. |
getColorFilter
fun getColorFilter(): ColorFilter!
Gets the ColorFilter set to the current dim level.
Return | |
---|---|
ColorFilter! |
The current ColorFilter. |
getPaint
fun getPaint(): Paint!
Gets the Paint object set to the current dim level.
Return | |
---|---|
Paint! |
The current Paint object. |