本文整理汇总了Java中android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT属性的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT属性的具体用法?Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT怎么用?Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.ActivityInfo
的用法示例。
在下文中一共展示了ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getPageScale
private int getPageScale(int viewWidth, int viewHeight, int bookOrientation){
// 378 x 674 are the dimensions of the Device16x9 layouts in pixels
int bookPageWidth = (bookOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) ? 378 : 674;
int bookPageHeight = (bookOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) ? 674 : 378;
Double widthScale = new Double(viewWidth)/new Double(bookPageWidth);
Double heightScale = new Double(viewHeight)/new Double(bookPageHeight);
Double scale = Math.min(widthScale, heightScale);
scale = scale * 100d;
return scale.intValue();
}
示例4: 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;
}