Screen rotate support for new ui

It's quite a big patch, I partially rewrote the screen and touch input module. Basically the internal API changed a lot. 

The new implementation is based on the idea from @dracodoc, as discussed in #573. The screen rotation feature is device independent now, i.e. it don't need to interact with kindle framework any more. That's means it will work for other devices like Kobo and there will be no more glitches when switching into/out of screen saver :)

However, it's actually not finished yet. There are still a couple of small bugs that need to be fixed. I would like to send out the PR first so if some one else plan to work on the input or output module will be notified of the changes.