Properly detect the orientation of the device.

When the keyboard is shown the gridview will improperly
think the device is in landscape.
Merge pull request #88 from jstralko/master

Properly detech the orientation of the device.