make accessing preferences and the database handler easier

use the application context to initialize the instance, removes the need
to pass around context through a bunch of constructors

Change-Id: I0d88858833b196abb07ae2fe48bdf82f73726e5e
replace logdebug with own logger class

Change-Id: I83405a3f2c05b1e443f8a6728fdeb262c4345131