本文整理汇总了Java中android.content.res.Configuration.UI_MODE_TYPE_TELEVISION属性的典型用法代码示例。如果您正苦于以下问题:Java Configuration.UI_MODE_TYPE_TELEVISION属性的具体用法?Java Configuration.UI_MODE_TYPE_TELEVISION怎么用?Java Configuration.UI_MODE_TYPE_TELEVISION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.res.Configuration
的用法示例。
在下文中一共展示了Configuration.UI_MODE_TYPE_TELEVISION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeviceType
/**
* Returns true when running Android TV
*
* @param c Context to detect UI Mode.
* @return true when device is running in tv mode, false otherwise.
*/
public static String getDeviceType(Context c) {
UiModeManager uiModeManager = (UiModeManager) c.getSystemService(Context.UI_MODE_SERVICE);
int modeType = uiModeManager.getCurrentModeType();
switch (modeType){
case Configuration.UI_MODE_TYPE_TELEVISION:
return "TELEVISION";
case Configuration.UI_MODE_TYPE_WATCH:
return "WATCH";
case Configuration.UI_MODE_TYPE_NORMAL:
String type = isTablet(c) ? "TABLET" : "PHONE";
return type;
case Configuration.UI_MODE_TYPE_UNDEFINED:
return "UNKOWN";
default:
return "";
}
}
示例2: onSearchRequested
/**
* @see #onSearchRequested(SearchEvent)
*/
public boolean onSearchRequested() {
if ((getResources().getConfiguration().uiMode&Configuration.UI_MODE_TYPE_MASK)
!= Configuration.UI_MODE_TYPE_TELEVISION) {
startSearch(null, false, null, false);
return true;
} else {
return false;
}
}
示例3: isRunningOnOUYA
public boolean isRunningOnOUYA() {
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo("tv.ouya", 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
}
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
return (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) || Globals.OuyaEmulation;
}
示例4: isTelevision
public static boolean isTelevision(Context context) {
UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
}
示例5: isAndroidTV
public static boolean isAndroidTV(Context ct) {
UiModeManager uiModeManager = (UiModeManager) ct.getSystemService(Context.UI_MODE_SERVICE);
return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
}
示例6: isTv
public static boolean isTv(Context context) {
return ((UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE))
.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
}
示例7: runningOnAndroidTV
private boolean runningOnAndroidTV() {
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
}