Example #1
0
  // displays either the system or the extended keyboard or non of  them
  private void showKeyboard(boolean showSystemKeyboard, boolean showExtendedKeyboard) {
    // no matter what we are doing ... hide the zoom controls
    // TODO: this is not working correctly as hiding the keyboard issues a onScrollChange
    // notification showing the control again ...
    uiHandler.removeMessages(UIHandler.HIDE_ZOOMCONTROLS);
    if (zoomControls.getVisibility() == View.VISIBLE) zoomControls.hide();

    InputMethodManager mgr;
    if (showSystemKeyboard) {
      // hide extended keyboard
      keyboardView.setVisibility(View.GONE);

      // show system keyboard
      mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      if (!mgr.isActive(sessionView))
        Log.e(TAG, "Failed to show system keyboard: SessionView is not the active view!");
      mgr.showSoftInput(sessionView, 0);

      // show modifiers keyboard
      modifiersKeyboardView.setVisibility(View.VISIBLE);
    } else if (showExtendedKeyboard) {
      // hide system keyboard
      mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      mgr.hideSoftInputFromWindow(sessionView.getWindowToken(), 0);

      // show extended keyboard
      keyboardView.setKeyboard(specialkeysKeyboard);
      keyboardView.setVisibility(View.VISIBLE);
      modifiersKeyboardView.setVisibility(View.VISIBLE);
    } else {
      // hide both
      mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      mgr.hideSoftInputFromWindow(sessionView.getWindowToken(), 0);
      keyboardView.setVisibility(View.GONE);
      modifiersKeyboardView.setVisibility(View.GONE);

      // clear any active key modifiers)
      keyboardMapper.clearlAllModifiers();
    }

    sysKeyboardVisible = showSystemKeyboard;
    extKeyboardVisible = showExtendedKeyboard;
  }