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

The following examples show how to use android.content.res.Configuration#HARDKEYBOARDHIDDEN_YES . 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: InputMethodManagerService.java    From TvRemoteControl with Apache License 2.0 6 votes vote down vote up
private void refreshImeWindowVisibilityLocked() {
    final Configuration conf = mRes.getConfiguration();
    final boolean haveHardKeyboard = conf.keyboard
            != Configuration.KEYBOARD_NOKEYS;
    final boolean hardKeyShown = haveHardKeyboard
            && conf.hardKeyboardHidden
                    != Configuration.HARDKEYBOARDHIDDEN_YES;

    final boolean isScreenLocked = isKeyguardLocked();
    final boolean inputActive = !isScreenLocked && (mInputShown || hardKeyShown);
    // We assume the softkeyboard is shown when the input is active as long as the
    // hard keyboard is not shown.
    final boolean inputVisible = inputActive && !hardKeyShown;
    mImeWindowVis = (inputActive ? InputMethodService.IME_ACTIVE : 0)
            | (inputVisible ? InputMethodService.IME_VISIBLE : 0);
    updateImeWindowStatusLocked();
}
 
Example 2
Source File: EventFilter.java    From talkback with Apache License 2.0 6 votes vote down vote up
private boolean shouldEchoKeyboard(int changeType) {
  // Always echo text removal events.
  if (changeType == Compositor.EVENT_TYPE_INPUT_TEXT_REMOVE) {
    return true;
  }

  final Resources res = context.getResources();

  switch (keyboardEcho) {
    case PREF_ECHO_ALWAYS:
      return true;
    case PREF_ECHO_SOFTKEYS:
      final Configuration config = res.getConfiguration();
      return (config.keyboard == Configuration.KEYBOARD_NOKEYS)
          || (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES);
    case PREF_ECHO_NEVER:
      return false;
    default:
      LogUtils.e(TAG, "Invalid keyboard echo preference value: %d", keyboardEcho);
      return false;
  }
}
 
Example 3
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
	super.onConfigurationChanged(newConfig);
	this.configuration = newConfig;
	try {
		if (this.prefs.getBoolean("forceKeyboard", false)
				|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
				|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
			InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

			if (imm != null)
				imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
						InputMethodManager.HIDE_NOT_ALWAYS);

		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 4
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPause() {
	super.onPause();

	try {
		if ((puz != null) && (baseFile != null)) {
			if ((timer != null) && (puz.getPercentComplete() != 100)) {
				this.timer.stop();
				puz.setTime(timer.getElapsed());
				this.timer = null;
			}

			IO.save(puz, baseFile);
		}
	} catch (IOException ioe) {
		ioe.printStackTrace();
	}

	if (this.prefs.getBoolean("forceKeyboard", false)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
		InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(this.imageView.getWindowToken(), 0);
	}
}
 
Example 5
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
private void render() {
	if (this.prefs.getBoolean("forceKeyboard", false)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
		if (this.useNativeKeyboard) {
			InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

			imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
					InputMethodManager.HIDE_IMPLICIT_ONLY);
		} else {
			this.keyboardView.setVisibility(View.VISIBLE);
		}
	} else {
		this.keyboardView.setVisibility(View.GONE);
	}

	this.imageView.setBitmap(renderer.drawWord());
}
 
Example 6
Source File: PlayActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPause() {
    try {
        if ((puz != null) && (baseFile != null)) {
            if ((puz.getPercentComplete() != 100) && (this.timer != null)) {
                this.timer.stop();
                puz.setTime(timer.getElapsed());
                this.timer = null;
            }

            IO.save(puz, baseFile);
        }
    } catch (IOException ioe) {
        LOG.log(Level.SEVERE, null, ioe);
    }

    this.timer = null;

    if ((this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(clue.getWindowToken(), 0);
    }

    super.onPause();
}
 
Example 7
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Override this to control when the soft input area should be shown to the user.  The default
 * implementation returns {@code false} when there is no hard keyboard or the keyboard is hidden
 * unless the user shows an intention to use software keyboard.  If you change what this
 * returns, you will need to call {@link #updateInputViewShown()} yourself whenever the returned
 * value may have changed to have it re-evaluated and applied.
 *
 * <p>When you override this method, it is recommended to call
 * {@code super.onEvaluateInputViewShown()} and return {@code true} when {@code true} is
 * returned.</p>
 */
@CallSuper
public boolean onEvaluateInputViewShown() {
    if (mSettingsObserver == null) {
        Log.w(TAG, "onEvaluateInputViewShown: mSettingsObserver must not be null here.");
        return false;
    }
    if (mSettingsObserver.shouldShowImeWithHardKeyboard()) {
        return true;
    }
    Configuration config = getResources().getConfiguration();
    return config.keyboard == Configuration.KEYBOARD_NOKEYS
            || config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES;
}
 
Example 8
Source File: Settings.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
public static boolean readHasHardwareKeyboard(final Configuration conf) {
    // The standard way of finding out whether we have a hardware keyboard. This code is taken
    // from InputMethodService#onEvaluateInputShown, which canonically determines this.
    // In a nutshell, we have a keyboard if the configuration says the type of hardware keyboard
    // is NOKEYS and if it's not hidden (e.g. folded inside the device).
    return conf.keyboard != Configuration.KEYBOARD_NOKEYS
            && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}
 
Example 9
Source File: Settings.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
public static boolean readHasHardwareKeyboard(final Configuration conf) {
    // The standard way of finding out whether we have a hardware keyboard. This code is taken
    // from InputMethodService#onEvaluateInputShown, which canonically determines this.
    // In a nutshell, we have a keyboard if the configuration says the type of hardware keyboard
    // is NOKEYS and if it's not hidden (e.g. folded inside the device).
    return conf.keyboard != Configuration.KEYBOARD_NOKEYS
            && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}
 
Example 10
Source File: Settings.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
public static boolean readHasHardwareKeyboard(final Configuration conf) {
    // The standard way of finding out whether we have a hardware keyboard. This code is taken
    // from InputMethodService#onEvaluateInputShown, which canonically determines this.
    // In a nutshell, we have a keyboard if the configuration says the type of hardware keyboard
    // is NOKEYS and if it's not hidden (e.g. folded inside the device).
    return conf.keyboard != Configuration.KEYBOARD_NOKEYS
            && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}
 
Example 11
Source File: Settings.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
public static boolean readHasHardwareKeyboard(final Configuration conf) {
    // The standard way of finding out whether we have a hardware keyboard. This code is taken
    // from InputMethodService#onEvaluateInputShown, which canonically determines this.
    // In a nutshell, we have a keyboard if the configuration says the type of hardware keyboard
    // is NOKEYS and if it's not hidden (e.g. folded inside the device).
    return conf.keyboard != Configuration.KEYBOARD_NOKEYS
            && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}
 
Example 12
Source File: PlayActivity.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    this.configuration = newConfig;

    if (this.prefs.getBoolean("forceKeyboard", false)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
        if (this.useNativeKeyboard) {
            keyboardView.setVisibility(View.GONE);

            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
                    InputMethodManager.HIDE_NOT_ALWAYS);
        } else {
            this.keyboardView.setVisibility(View.VISIBLE);
        }
    } else {
        this.keyboardView.setVisibility(View.GONE);
    }

    this.runTimer = prefs.getBoolean("runTimer", false);

    if (runTimer) {
        this.handler.post(this.updateTimeTask);
    }

    metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    this.screenWidthInInches = (metrics.widthPixels > metrics.heightPixels ? metrics.widthPixels : metrics.heightPixels) / Math.round(160 * metrics.density);
    LOG.info("Configuration Changed "+this.screenWidthInInches+" ");
    if(this.screenWidthInInches >= 7){
        this.handler.post(this.fitToScreenTask);
    }
}
 
Example 13
Source File: Settings.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
public static boolean readHasHardwareKeyboard(final Configuration conf) {
    // The standard way of finding out whether we have a hardware keyboard. This code is taken
    // from InputMethodService#onEvaluateInputShown, which canonically determines this.
    // In a nutshell, we have a keyboard if the configuration says the type of hardware keyboard
    // is NOKEYS and if it's not hidden (e.g. folded inside the device).
    return conf.keyboard != Configuration.KEYBOARD_NOKEYS
            && conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}