Changed timer to handler and uses gravity sensor

Instead of timer, handler is now used, which allows for better accuracy
in detecting if the proximity sensor value has remained the same for a
period of time. App now disables proximity sensor when phone is upside
down.