本文整理匯總了Java中android.content.res.Configuration.KEYBOARD_NOKEYS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.KEYBOARD_NOKEYS屬性的具體用法?Java Configuration.KEYBOARD_NOKEYS怎麽用?Java Configuration.KEYBOARD_NOKEYS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.content.res.Configuration
的用法示例。
在下文中一共展示了Configuration.KEYBOARD_NOKEYS屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureOrientation
/**
*
*/
private void configureOrientation() {
String rotateDefault;
if (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS)
rotateDefault = PreferenceConstants.ROTATION_PORTRAIT;
else
rotateDefault = PreferenceConstants.ROTATION_LANDSCAPE;
String rotate = prefs.getString(PreferenceConstants.ROTATION, rotateDefault);
if (PreferenceConstants.ROTATION_DEFAULT.equals(rotate))
rotate = rotateDefault;
// request a forced orientation if requested by user
if (PreferenceConstants.ROTATION_LANDSCAPE.equals(rotate)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
forcedOrientation = true;
} else if (PreferenceConstants.ROTATION_PORTRAIT.equals(rotate)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
forcedOrientation = true;
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
forcedOrientation = false;
}
}
示例2: checkDisplaySize
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();
}
}
示例3: readHasHardwareKeyboard
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;
}
示例4: startNewSession
/**
* Starts a new session for logging.
* @param tabModelSelector A TabModelSelector instance for recording tab counts on page loads.
* If null, UmaSessionStats does not record page loads and tab counts.
*/
public void startNewSession(TabModelSelector tabModelSelector) {
ensureNativeInitialized();
mTabModelSelector = tabModelSelector;
if (mTabModelSelector != null) {
mComponentCallbacks = new ComponentCallbacks() {
@Override
public void onLowMemory() {
// Not required
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
mKeyboardConnected = newConfig.keyboard != Configuration.KEYBOARD_NOKEYS;
}
};
mContext.registerComponentCallbacks(mComponentCallbacks);
mKeyboardConnected = mContext.getResources().getConfiguration()
.keyboard != Configuration.KEYBOARD_NOKEYS;
mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModelSelector) {
@Override
public void onPageLoadFinished(Tab tab) {
recordPageLoadStats(tab);
}
};
}
nativeUmaResumeSession(sNativeUmaSessionStats);
updatePreferences();
updateMetricsServiceState();
}
示例5: setShortcutsVisibleInner
private void setShortcutsVisibleInner(boolean shortcutsVisible) {
mShortcutsVisible = shortcutsVisible
&& mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS
&& mResources.getBoolean(
R.bool.abs__config_showMenuShortcutsWhenKeyboardPresent);
}
示例6: isHardwareKeyboardAvailable
/**
* Procedure checks whether the hard keyboard is available
*/
public static boolean isHardwareKeyboardAvailable(Context context)
{
return context.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
}