Separate alert dialog classes

The dialog boxes are not made in the main classes. Instead, there are
now templates which can be used. The onResult method is overridden to
handle the result from the dialog boxes.