本文整理汇总了Java中android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE属性的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE属性的具体用法?Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE怎么用?Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.ActivityInfo
的用法示例。
在下文中一共展示了ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
int orientation = getActivityOrientation(view);
boolean checkOrientation = false;
switch (orientationType) {
case PORTRAIT:
checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT;
break;
case LANDSCAPE:
checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
break;
}
if (checkOrientation) {
isOrientation[0] = true;
}
}
示例2: getPageOrientationAndRotateScreen
private int getPageOrientationAndRotateScreen(String page){
int orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
Matcher matcher = sClassAttrPattern.matcher(page);
if (matcher.find()) {
String classNames = matcher.group(2);
if (classNames.contains("Landscape"))
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
}
setRequestedOrientation(orientation);
return orientation;
}
示例3: setOrientationBis
/**
* This can be overridden
*/
public void setOrientationBis(int w, int h, boolean resizable, String hint)
{
int orientation = -1;
if (hint != "") {
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
} else if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (hint.contains("Portrait")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
}
}
/* no valid hint */
if (orientation == -1) {
if (resizable) {
/* no fixed orientation */
} else {
if (w > h) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
}
}
}
Log.v("SDL", "setOrientation() orientation=" + orientation + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint);
if (orientation != -1) {
mSingleton.setRequestedOrientation(orientation);
}
return;
}