本文整理汇总了Java中android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE属性的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE属性的具体用法?Java ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE怎么用?Java ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.ActivityInfo
的用法示例。
在下文中一共展示了ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentOrientation
private int getCurrentOrientation() {
int rotation = getWindowManager().getDefaultDisplay().getRotation();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
switch (rotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_90:
return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
default:
return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
} else {
switch (rotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_270:
return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
default:
return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
}
}
}
示例2: 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;
}
}
示例3: lockOrientation
/**
* Locks the device window in actual screen mode
*/
public static void lockOrientation(Activity activity) {
Display display = ((WindowManager) activity.
getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int rotation = display.getRotation();
int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
switch (activity.getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_LANDSCAPE:
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90)
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
else
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
break;
case Configuration.ORIENTATION_PORTRAIT:
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270)
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
else
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
}
//noinspection ResourceType
activity.setRequestedOrientation(orientation);
}
示例4: updateFullScreenButton
private void updateFullScreenButton() {
if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
$.id(R.id.app_video_fullscreen).image(R.drawable.ic_fullscreen_exit_white_36dp);
} else {
$.id(R.id.app_video_fullscreen).image(R.drawable.ic_fullscreen_white_24dp);
}
}
示例5: mapConfigurationOriActivityInfoOri
private int mapConfigurationOriActivityInfoOri(int configOri) {
final Display d = getWindowManager().getDefaultDisplay();
int naturalOri = Configuration.ORIENTATION_LANDSCAPE;
switch (d.getRotation()) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
// We are currently in the same basic orientation as the natural orientation
naturalOri = configOri;
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
// We are currently in the other basic orientation to the natural orientation
naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ?
Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
break;
}
int[] oriMap = {
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE,
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
};
// Since the map starts at portrait, we need to offset if this device's natural orientation
// is landscape.
int indexOffset = 0;
if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) {
indexOffset = 1;
}
return oriMap[(d.getRotation() + indexOffset) % 4];
}
示例6: toggleFullScreen
public void toggleFullScreen(){
if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
updateFullScreenButton();
}
示例7: onResume
@Override
protected void onResume() {
super.onResume();
webView.onResume();
// 支付宝网页版在打开文章详情之后,无法点击按钮下一步
webView.resumeTimers();
// 设置为横屏
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
示例8: updateFullScreenButton
/**
* 更新全屏按钮
*/
private void updateFullScreenButton() {
if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {// 全屏幕
fullScreenButton.setImageResource(R.mipmap.btn_half_screen);
} else {
fullScreenButton.setImageResource(R.mipmap.btn_full_screen);
}
}
示例9: _toggleFullScreen
/**
* 全屏切换,点击全屏按钮
*/
private void _toggleFullScreen() {
if (WindowUtils.getScreenOrientation(mAttachActivity) == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
mAttachActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
mAttachActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
示例10: onBackPressedSupport
@Override
public void onBackPressedSupport() {
if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
return;
}
super.onBackPressedSupport();
}
示例11: setLockRotation
private void setLockRotation(boolean avpLock) {
Display display = getWindowManager().getDefaultDisplay();
int rotation = display.getRotation();
if (DBG) Log.d(TAG, "rotation status: " + rotation);
boolean systemLock;
try {
systemLock = 1 != Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION);
} catch (SettingNotFoundException e) {
systemLock = false;
}
if (DBG) Log.d(TAG, "avpLock: " + avpLock + " systemLock: " + systemLock);
if (avpLock || systemLock) {
int tmpOrientation = getResources().getConfiguration().orientation;
int wantedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
if (tmpOrientation == Configuration.ORIENTATION_LANDSCAPE) {
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90)
wantedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
else
wantedOrientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
setRequestedOrientation(wantedOrientation);
}
else if (tmpOrientation == Configuration.ORIENTATION_PORTRAIT || tmpOrientation == Configuration.ORIENTATION_UNDEFINED) {
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90)
wantedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
else
wantedOrientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
setRequestedOrientation(wantedOrientation);
}
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
示例12: updateFullScreenButton
private void updateFullScreenButton() {
if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
$.id(R.id.app_video_fullscreen).image(R.drawable.hplib_ic_screen_rotation);
} else {
$.id(R.id.app_video_fullscreen).image(R.drawable.hplib_ic_screen_rotation);
}
}
示例13: onResume
@Override
protected void onResume() {
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
super.onResume();
}
示例14: convert2Orientation
private int convert2Orientation(int rotation){
int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
if (((rotation >= 0) && (rotation <= 45)) || (rotation > 315)) {
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if ((rotation > 45) && (rotation <= 135)) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
} else if ((rotation > 135) && (rotation <= 225)) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
} else if ((rotation > 225) && (rotation <= 315)) {
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else {
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
return orientation;
}
示例15: onSwitchPageType
@Override
public void onSwitchPageType() { //切换屏幕
if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE||getRequestedOrientation()==ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mSuperVideoPlayer.setPageType(MediaController.PageType.SHRINK);
// mRightLandscape.setVisibility(View.GONE);
// mCutScreenBtn.setVisibility(View.GONE);
} else { //切换为横屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mSuperVideoPlayer.setPageType(MediaController.PageType.EXPAND);
// mRightLandscape.setVisibility(View.VISIBLE);
// mCutScreenBtn.setVisibility(View.VISIBLE);
}
}