Java Code Examples for android.content.res.Configuration#HARDKEYBOARDHIDDEN_NO

The following examples show how to use android.content.res.Configuration#HARDKEYBOARDHIDDEN_NO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidUtilities.java    From KrGallery with GNU General Public License v2.0 6 votes vote down vote up
public static void checkDisplaySize() {
    try {
        Configuration configuration = applicationContext.getResources()
                .getConfiguration();
        usingHardwareInput = configuration.keyboard != Configuration.KEYBOARD_NOKEYS
                && configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
        WindowManager manager = (WindowManager) applicationContext
                .getSystemService(Context.WINDOW_SERVICE);
        if (manager != null) {
            Display display = manager.getDefaultDisplay();
            if (display != null) {
                display.getMetrics(displayMetrics);
                display.getSize(displaySize);
                Log.d("tmessages", "display size = " + displaySize.x + " " + displaySize.y + " "
                        + displayMetrics.xdpi + "x" + displayMetrics.ydpi);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: CardEditActivity.java    From CreditCardView with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // Checks whether a hardware keyboard is available
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {

        RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) parent.getLayoutParams();
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
        parent.setLayoutParams(layoutParams);

    }
}
 
Example 3
Source File: KeyboardUtils.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if either soft or hard keyboard is active.
 *
 * @param service Accessibility Service that is currently trying to get keyboard state.
 * @return {@code true} if either soft or hard keyborad is active, else {@code false}.
 */
// TODO: Move the logic of updating keyboard state into WindowTracker.
public static boolean isKeyboardActive(AccessibilityService service) {
  if (service == null) {
    return false;
  }
  Configuration config = service.getResources().getConfiguration();
  WindowManager windowManager = new WindowManager(service);

  boolean isSoftKeyboardActive = windowManager.isInputWindowOnScreen();
  boolean isHardKeyboardActive =
      (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);

  return isSoftKeyboardActive || isHardKeyboardActive;
}
 
Example 4
Source File: AndroidMini2DxGame.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration config) {
	super.onConfigurationChanged(config);
	boolean keyboardAvailable = false;
	if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
		keyboardAvailable = true;
	input.keyboardAvailable = keyboardAvailable;
}
 
Example 5
Source File: Term.java    From Ansole with GNU General Public License v2.0 4 votes vote down vote up
private boolean checkHaveFullHwKeyboard(Configuration c) {
    return (c.keyboard == Configuration.KEYBOARD_QWERTY)
            && (c.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);
}