Daydream implementation
Daydream is implemented through the Android. Service. Dreams. dreamservice subclass. The following are some key methods:
- Onattachedtowindow (): initial settings
- Ondreamingstarted (): Start animation and Timer
- Ondreamingstopped (): stops an animation.
- Ondetachedfromwindow (): Clears Everything you build in onattachedtowindow ().
Some important methods that may be called:
- Setcontentview (): Set the daydream scenario
- Setinteractive (Boolean): by default, daydream exits when you touch it. If you want to interact with users, call setinteractive (true)
- Setfullscreen (Boolean): hides the status bar
- Setscreenbright (Boolean): by default, daydream is in full brightness mode. Setting it to false will reduce the screen brightness.
Details: Daydream: interactive screen savers
Documents and examples:
- Documentation: dreamservice API
- ExampleCode: Bouncerdaydream, a jumping little green man in Android
- Sample Code: webview, which displays an HTML page
- Example code: colors: demonstrate OpenGL ES 2.0 and textureview
Original article address
Http://www.iteye.com/news/26872