下面列出了android.content.res.Configuration#HARDKEYBOARDHIDDEN_UNDEFINED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
}
@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);
}
}
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());
}
@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();
}
@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);
}
}