Replaced switch statements with if statements so you can create a library

In order to compile the project as a library we need to get rid of the switch-case statements. We can only use final fields in case expressions but resource ids are no longer final when the project is compiled as a library.