java.lang.Object | |
↳ | android.support.v17.leanback.app.BackgroundManager |
Supports background image continuity between multiple Activities.
An Activity should instantiate a BackgroundManager and attach(Window)
to the Activity's window. When the Activity is started, the background is
initialized to the current background values stored in a continuity service.
The background continuity service is updated as the background is updated.
At some point, for example when it is stopped, the Activity may release its background state.
When an Activity is resumed, if the BackgroundManager has not been released, the continuity service is updated from the BackgroundManager state. If the BackgroundManager was released, the BackgroundManager inherits the current state from the continuity service.
When the last Activity is destroyed, the background state is reset.
Backgrounds consist of several layers, from back to front:
setColor(int)
)setBitmap(Bitmap)
or
setDrawable(Drawable)
), which may be in transitionBackgroundManager holds references to potentially large bitmap Drawables.
Call release()
to release these references when the Activity is not
visible.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Make the background visible on the given Window.
| |||||||||||
Returns the current background color.
| |||||||||||
Returns the default drawable used as a dim layer.
| |||||||||||
Returns the drawable used as a dim layer.
| |||||||||||
Returns the current background
Drawable .
| |||||||||||
Get the BackgroundManager associated with the Activity.
| |||||||||||
Returns true if the background manager is currently attached; false otherwise.
| |||||||||||
Release references to Drawables.
| |||||||||||
Set the given bitmap into the background.
| |||||||||||
Set the background to the given color.
| |||||||||||
Sets the drawable used as a dim layer.
| |||||||||||
Set the given drawable into the background.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Make the background visible on the given Window. The background manager must be attached when the background is set.
Returns the current background color.
Get the BackgroundManager associated with the Activity.
The BackgroundManager will be created on-demand for each individual Activity. Subsequent calls will return the same BackgroundManager created for this Activity.
Returns true if the background manager is currently attached; false otherwise.
Release references to Drawables. Typically called to reduce memory overhead when not visible.
When an Activity is resumed, if the BackgroundManager has not been released, the continuity service is updated from the BackgroundManager state. If the BackgroundManager was released, the BackgroundManager inherits the current state from the continuity service.
Set the given bitmap into the background. When using setBitmap to set the background, the provided bitmap will be scaled and cropped to correctly fit within the dimensions of the view. The timing for when this becomes visible in the app is undefined and may take place after a small delay.
Set the background to the given color. The timing for when this becomes visible in the app is undefined and may take place after a small delay.
Set the given drawable into the background. The provided Drawable will be used unmodified as the background, without any scaling or cropping applied to it. The timing for when this becomes visible in the app is undefined and may take place after a small delay.