Source code of the author's demo (it's in Google Play)