android.content.res.Configuration#HARDKEYBOARDHIDDEN_YES源码实例Demo

下面列出了android.content.res.Configuration#HARDKEYBOARDHIDDEN_YES 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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();
}
 
源代码2 项目: talkback   文件: EventFilter.java
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;
  }
}
 
源代码3 项目: shortyz   文件: ClueListActivity.java
@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();
	}
}
 
源代码4 项目: shortyz   文件: ClueListActivity.java
@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);
	}
}
 
源代码5 项目: shortyz   文件: ClueListActivity.java
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());
}
 
源代码6 项目: shortyz   文件: PlayActivity.java
@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();
}
 
源代码7 项目: android_9.0.0_r45   文件: InputMethodService.java
/**
 * 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;
}
 
源代码8 项目: openboard   文件: Settings.java
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;
}
 
源代码9 项目: LokiBoard-Android-Keylogger   文件: Settings.java
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;
}
 
源代码10 项目: simple-keyboard   文件: Settings.java
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;
}
 
源代码11 项目: AOSP-Kayboard-7.1.2   文件: Settings.java
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;
}
 
源代码12 项目: shortyz   文件: PlayActivity.java
@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);
    }
}
 
源代码13 项目: Indic-Keyboard   文件: Settings.java
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;
}