Port from Android AlertDialog and add some nice features.