refactor

Totally refactor from upstream/0.49.
Build with Android 4.3 SDK.
Fix animation errors.