Wait for the mode-dependent keyboard to be ready.

Instead of waiting a fixed amount of time for the keyboard to appear,
make a decision based on whether or not a hardware keyboard is
available.  I.e., if a hardware keyboard is not available wait for the
software keyboard to appear.

Similarly, in both cases wait for the keyboard to have its responder
assigned otherwise the key inputs would be in vain.
Rename waitForKeyboard to waitForSoftwareKeyboard.

Old names preserved but deprecated.