Challenges

For the first challenge, add the ability to reverse the sunset after it is completed. So you can press for a sunset, and then press a second time to get a sunrise. You will need to build another AnimatorSet to do this – AnimatorSets cannot be run in reverse.

For a second challenge, add a continuing animation to the sun. Make it pulsate with heat, or give it a spinning halo of rays. (You can use the setRepeatCount(int) method on ObjectAnimator to make your animation repeat itself.)

Another good challenge would be to have a reflection for the sun in the water.

Your final challenge is to add the ability to press to reverse the sunset scene while it is still happening. So if you press the scene while the sun is halfway down, ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.