Chris 18 hardware keyboard fixes

Fixed hardware keyboard bugs. 
This is mainly for use on emulators as no one has a hardware keyboard on android.
There are refactors here. Most of the logic delegated to the input connection.