Fix switching Gerrit instance

Previously, DatabaseFactory.changeGerrit was not called so changing the
 Gerrit instance in the preferences would not change the database. This
 adds an Application-wide shared preference listener, so where-ever the
 sharedPreferences are modified, the lister code is guarenteed to be
 called.

Added Application class (and modified manifest accordingly).
 This class will help to fix loosing broadcasts.
Implemented locking mechanism in DatabaseFactory to not disturb
 CRUD operations, switch the database after they are finished.

Change-Id: I6c6b2fc40fb82a07969a261ca36eef0ab072eec3