Here are the examples of the java api android.app.Activity.setRequestedOrientation() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
140 Examples
19
Source : TestUtils.java
with Apache License 2.0
from Zhuinden
with Apache License 2.0
from Zhuinden
private static void rotateToPortrait(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : AppTools.java
with Apache License 2.0
from zhou-you
with Apache License 2.0
from zhou-you
/**
* </br><b>replacedle : </b> 设置Activity的显示方向为垂直方向
* </br><b>description :</b>强制设置Actiity的显示方向为垂直方向。
*
* @param activity Activity对象
*/
public static void setScreenVertical(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : AppTools.java
with Apache License 2.0
from zhou-you
with Apache License 2.0
from zhou-you
/**
* </br><b>replacedle : </b> 设置Activity的显示方向为横向
* </br><b>description :</b>强制设置Actiity的显示方向为横向。
*
* @param activity Activity对象
*/
public static void setScreenHorizontal(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : DisplayUtils.java
with Apache License 2.0
from YummyLau
with Apache License 2.0
from YummyLau
public static void checkoutOrientation(Activity activity) {
activity.setRequestedOrientation(isPortrait(activity) ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : BaseVideoController.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 子类中请使用此方法来退出全屏
*
* @return 是否成功退出全屏
*/
protected boolean stopFullScreen() {
if (!PlayerUtils.isActivityLiving(mActivity)) {
return false;
}
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mControlWrapper.stopFullScreen();
return true;
}
19
Source : BaseVideoController.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 子类中请使用此方法来进入全屏
*
* @return 是否成功进入全屏
*/
protected boolean startFullScreen() {
if (!PlayerUtils.isActivityLiving(mActivity)) {
return false;
}
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mControlWrapper.startFullScreen();
return true;
}
19
Source : BaseVideoController.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 竖屏
*/
protected void onOrientationPortrait(Activity activity) {
// 屏幕锁定的情况
if (mIsLocked)
return;
// 没有开启设备方向监听的情况
if (!mEnableOrientation)
return;
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mControlWrapper.stopFullScreen();
}
19
Source : ControlWrapper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 横竖屏切换,根据适配宽高决定是否旋转屏幕
*/
public void toggleFullScreenByVideoSize(Activity activity) {
if (activity == null || activity.isFinishing())
return;
int[] size = getVideoSize();
int width = size[0];
int height = size[1];
if (isFullScreen()) {
stopFullScreen();
if (width > height) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
} else {
startFullScreen();
if (width > height) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
}
19
Source : ControlWrapper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 横竖屏切换,会旋转屏幕
*/
public void toggleFullScreen(Activity activity) {
if (activity == null || activity.isFinishing())
return;
if (isFullScreen()) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
stopFullScreen();
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
startFullScreen();
}
}
19
Source : DeviceUtils.java
with Apache License 2.0
from y1xian
with Apache License 2.0
from y1xian
/**
* 设置屏幕为竖屏
*
* @param activity activity
*/
@SuppressLint("SourceLockedOrientationActivity")
public static void setPortrait(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : DeviceUtils.java
with Apache License 2.0
from y1xian
with Apache License 2.0
from y1xian
/**
* 设置屏幕为横屏
* <p>还有一种就是在Activity中加属性android:screenOrientation="landscape"</p>
* <p>不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次</p>
* <p>设置Activity的android:configChanges="orientation"时,切屏还是会重新调用各个生命周期,切横、竖屏时只会执行一次</p>
* <p>设置Activity的android:configChanges="orientation|keyboardHidden|screenSize"(4.0以上必须带最后一个参数)时
* 切屏不会重新调用各个生命周期,只会执行onConfigurationChanged方法</p>
*
* @param activity activity
*/
@SuppressLint("SourceLockedOrientationActivity")
public static void setLandscape(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : GiraffePlayer.java
with GNU General Public License v3.0
from xdtianyu
with GNU General Public License v3.0
from xdtianyu
public void setFullScreenOnly(boolean fullScreenOnly) {
this.fullScreenOnly = fullScreenOnly;
tryFullScreen(fullScreenOnly);
if (fullScreenOnly) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
}
}
19
Source : GiraffePlayer.java
with GNU General Public License v3.0
from xdtianyu
with GNU General Public License v3.0
from xdtianyu
public boolean onBackPressed() {
if (!fullScreenOnly && getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
return true;
}
return false;
}
19
Source : GiraffePlayer.java
with GNU General Public License v3.0
from xdtianyu
with GNU General Public License v3.0
from xdtianyu
public void toggleFullScreen() {
if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
updateFullScreenButton();
}
19
Source : GiraffePlayer.java
with GNU General Public License v3.0
from xdtianyu
with GNU General Public License v3.0
from xdtianyu
public GiraffePlayer playInFullScreen(boolean fullScreen) {
if (fullScreen) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
updateFullScreenButton();
}
return this;
}
19
Source : MediaPlayer.java
with Apache License 2.0
from WeDevelopTeam
with Apache License 2.0
from WeDevelopTeam
public MediaPlayer playInFullScreen(boolean fullScreen) {
if (fullScreen) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
updateFullScreenButton();
}
return this;
}
19
Source : BaseIjkVideoView.java
with Apache License 2.0
from wangfeng19930909
with Apache License 2.0
from wangfeng19930909
/**
* 横屏
*/
protected void onOrientationLandscape(Activity activity) {
if (currentOrientation == LANDSCAPE)
return;
if (currentOrientation == PORTRAIT && isFullScreen()) {
currentOrientation = LANDSCAPE;
return;
}
currentOrientation = LANDSCAPE;
if (!isFullScreen()) {
startFullScreen();
}
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : BaseIjkVideoView.java
with Apache License 2.0
from wangfeng19930909
with Apache License 2.0
from wangfeng19930909
/**
* 竖屏
*/
protected void onOrientationPortrait(Activity activity) {
if (isLockFullScreen || !mPlayerConfig.mAutoRotate || currentOrientation == PORTRAIT)
return;
if ((currentOrientation == LANDSCAPE || currentOrientation == REVERSE_LANDSCAPE) && !isFullScreen()) {
currentOrientation = PORTRAIT;
return;
}
currentOrientation = PORTRAIT;
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
stopFullScreen();
}
19
Source : CaptureManager.java
with GNU General Public License v3.0
from umerov1999
with GNU General Public License v3.0
from umerov1999
/**
* Lock display to current orientation.
*/
protected void lockOrientation() {
// Only get the orientation if it's not locked to one yet.
if (orientationLock == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
// Adapted from http://stackoverflow.com/a/14565436
Display display = activity.getWindowManager().getDefaultDisplay();
int rotation = display.getRotation();
int baseOrientation = activity.getResources().getConfiguration().orientation;
int orientation = 0;
if (baseOrientation == Configuration.ORIENTATION_LANDSCAPE) {
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) {
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
} else if (baseOrientation == Configuration.ORIENTATION_PORTRAIT) {
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) {
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
}
}
orientationLock = orientation;
}
// noinspection ResourceType
activity.setRequestedOrientation(orientationLock);
}
19
Source : ScreenUtils.java
with Apache License 2.0
from tianshaojie
with Apache License 2.0
from tianshaojie
/**
* Set the screen to landscape.
*
* @param activity The activity.
*/
public static void setLandscape(@NonNull final Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : ScreenUtils.java
with Apache License 2.0
from tianshaojie
with Apache License 2.0
from tianshaojie
/**
* Set the screen to portrait.
*
* @param activity The activity.
*/
public static void setPortrait(@NonNull final Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : ConfigUtils.java
with GNU Affero General Public License v3.0
from threema-ch
with GNU Affero General Public License v3.0
from threema-ch
/**
* Request desired orientation ignoring IllegalStateException on API 26 with targetApi == 28.
* Workaround for Android bug https://issuetracker.google.com/issues/68454482
* @param activity activity to request orientation for
* @param requestedOrientation requested orientation
*/
public static void setRequestedOrientation(@NonNull Activity activity, int requestedOrientation) {
try {
activity.setRequestedOrientation(requestedOrientation);
} catch (IllegalStateException ignore) {
}
}
19
Source : UIHelper.java
with Apache License 2.0
from tcking
with Apache License 2.0
from tcking
public UIHelper requestedOrientation(int orientation) {
if (activity == null) {
return this;
}
activity.setRequestedOrientation(orientation);
return this;
}
19
Source : MethodCallHandlerImpl.java
with Apache License 2.0
from sososdk
with Apache License 2.0
from sososdk
private void forceOrientation(String orientation) {
if (orientation.equals("DeviceOrientation.portraitUp")) {
activity.setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT);
} else if (orientation.equals("DeviceOrientation.portraitDown")) {
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
} else if (orientation.equals("DeviceOrientation.landscapeLeft")) {
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
} else if (orientation.equals("DeviceOrientation.landscapeRight")) {
activity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE);
} else {
activity.setRequestedOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
}
}
19
Source : ScreenUtil.java
with Apache License 2.0
from SiberiaDante
with Apache License 2.0
from SiberiaDante
/**
* 设置屏幕为横屏
* <p>还有一种就是在Activity中加属性android:screenOrientation="landscape"</p>
* <p>不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次</p>
* <p>设置Activity的android:configChanges="orientation"时,切屏还是会重新调用各个生命周期,切横、竖屏时只会执行一次</p>
* <p>设置Activity的android:configChanges="orientation|keyboardHidden|screenSize"(4.0以上必须带最后一个参数)时
* 切屏不会重新调用各个生命周期,只会执行onConfigurationChanged方法</p>
*
* @param activity activity
*/
public static void setLandscape(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : ScreenUtil.java
with Apache License 2.0
from SiberiaDante
with Apache License 2.0
from SiberiaDante
/**
* 设置屏幕为竖屏
*
* @param activity activity
*/
public static void setPortrait(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : ScreenOrientationProviderImpl.java
with BSD 3-Clause "New" or "Revised" License
from ridi
with BSD 3-Clause "New" or "Revised" License
from ridi
/**
* Sets the requested orientation for the activity.
*/
private void setRequestedOrientationNow(Activity activity, boolean lock, int orientation) {
if (mDelegate != null) {
if ((lock && !mDelegate.canLockOrientation()) || (!lock && !mDelegate.canUnlockOrientation(activity, orientation))) {
return;
}
}
activity.setRequestedOrientation(orientation);
}
19
Source : ActivityUtils.java
with GNU Affero General Public License v3.0
from reverse-unina
with GNU Affero General Public License v3.0
from reverse-unina
/**
* Sets the Orientation (Landscape/Portrait) for the current activity.
*
* @param orientation An orientation constant such as {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE} or {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_PORTRAIT}
*/
public void setActivityOrientation(int orientation) {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.setRequestedOrientation(orientation);
}
}
19
Source : ScreenUtils.java
with MIT License
from liuyanggithub
with MIT License
from liuyanggithub
public static void setLandscape(@NonNull Activity activity) {
if (activity != null) {
activity.setRequestedOrientation(0);
return;
}
throw new NullPointerException("Argument 'activity' of type Activity (#0 out of 1, zero-based) is marked by @android.support.annotation.NonNull but got null for it");
}
19
Source : ScreenUtils.java
with MIT License
from liuyanggithub
with MIT License
from liuyanggithub
public static void setPortrait(@NonNull Activity activity) {
if (activity != null) {
activity.setRequestedOrientation(1);
return;
}
throw new NullPointerException("Argument 'activity' of type Activity (#0 out of 1, zero-based) is marked by @android.support.annotation.NonNull but got null for it");
}
19
Source : BingWallpaperUtils.java
with GNU General Public License v3.0
from liaoheng
with GNU General Public License v3.0
from liaoheng
@SuppressLint("SourceLockedOrientationActivity")
public static void setPhoneScreen(Activity context) {
if (context == null) {
return;
}
if (Constants.Config.isPhone) {
try {
context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} catch (Throwable ignored) {
}
}
}
19
Source : RotationHelper.java
with Apache License 2.0
from Launcher3-dev
with Apache License 2.0
from Launcher3-dev
private void notifyChange() {
if (!mInitialized || mDestroyed) {
return;
}
final int activityFlags;
if (mStateHandlerRequest != REQUEST_NONE) {
activityFlags = mStateHandlerRequest == REQUEST_LOCK ? SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED;
} else if (mCurrentStateRequest == REQUEST_LOCK) {
activityFlags = SCREEN_ORIENTATION_LOCKED;
} else if (mIgnoreAutoRotateSettings || mCurrentStateRequest == REQUEST_ROTATE || mAutoRotateEnabled) {
activityFlags = SCREEN_ORIENTATION_UNSPECIFIED;
} else {
// If auto rotation is off, allow rotation on the activity, in case the user is using
// forced rotation.
activityFlags = SCREEN_ORIENTATION_NOSENSOR;
}
if (activityFlags != mLastActivityFlags) {
mLastActivityFlags = activityFlags;
mActivity.setRequestedOrientation(activityFlags);
}
}
19
Source : MKPlayer.java
with MIT License
from khizar1556
with MIT License
from khizar1556
public MKPlayer playInFullScreen(boolean fullScreen) {
if (fullScreen) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
updateFullScreenButton();
}
return this;
}
19
Source : IjkVideoView.java
with MIT License
from jianliaoim
with MIT License
from jianliaoim
@Override
public void setFullscreen(boolean fullscreen, int screenOrientation) {
// Activity需要设置为: android:configChanges="keyboardHidden|orientation|screenSize"
Activity activity = (Activity) getContext();
if (fullscreen) {
if (mVideoViewLayoutWidth == 0 && mVideoViewLayoutHeight == 0) {
ViewGroup.LayoutParams params = getLayoutParams();
// 保存全屏之前的参数
mVideoViewLayoutWidth = params.width;
mVideoViewLayoutHeight = params.height;
}
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.setRequestedOrientation(screenOrientation);
} else {
ViewGroup.LayoutParams params = getLayoutParams();
// 使用全屏之前的参数
params.width = mVideoViewLayoutWidth;
params.height = mVideoViewLayoutHeight;
setLayoutParams(params);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.setRequestedOrientation(screenOrientation);
}
mMediaController.toggleButtons(fullscreen);
}
19
Source : Util.java
with Apache License 2.0
from JackChan1999
with Apache License 2.0
from JackChan1999
public static void screenPortrait(Activity activity) {
activity.setRequestedOrientation(1);
}
19
Source : Util.java
with Apache License 2.0
from JackChan1999
with Apache License 2.0
from JackChan1999
public static void screenLandscape(Activity activity) {
activity.setRequestedOrientation(0);
}
19
Source : UIsUtils.java
with Apache License 2.0
from JackChan1999
with Apache License 2.0
from JackChan1999
public static void setScreenPortrait(Activity activity) {
activity.setRequestedOrientation(1);
}
19
Source : UIsUtils.java
with Apache License 2.0
from JackChan1999
with Apache License 2.0
from JackChan1999
public static void setScreenLandscape(Activity activity) {
activity.setRequestedOrientation(0);
}
19
Source : Util.java
with GNU General Public License v3.0
from jachness
with GNU General Public License v3.0
from jachness
@DebugLog
public static void unlockScreenOrientation(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
}
19
Source : Util.java
with GNU General Public License v3.0
from jachness
with GNU General Public License v3.0
from jachness
@DebugLog
public static void lockScreenOrientation(Activity activity) {
int currentOrientation = activity.getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
19
Source : CommenPlayer.java
with Apache License 2.0
from Dsiner
with Apache License 2.0
from Dsiner
@Override
public boolean onBackPress() {
if (!isPortrait) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
return true;
}
return false;
}
19
Source : CommenPlayer.java
with Apache License 2.0
from Dsiner
with Apache License 2.0
from Dsiner
@Override
public void toggleOrientation() {
activity.setRequestedOrientation(isPortrait ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : Utils.java
with Apache License 2.0
from davideas
with Apache License 2.0
from davideas
/**
* Unlocks the device window in user defined screen mode.
*/
public static void unlockOrientation(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
}
19
Source : Utils.java
with Apache License 2.0
from davideas
with Apache License 2.0
from davideas
/**
* 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);
}
19
Source : Utils.java
with Apache License 2.0
from davideas
with Apache License 2.0
from davideas
/**
* Locks the device window in landscape mode
*/
public static void lockOrientationLandscape(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
19
Source : Utils.java
with Apache License 2.0
from davideas
with Apache License 2.0
from davideas
/**
* Locks the device window in portrait mode
*/
public static void lockOrientationPortrait(Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
19
Source : JsWebChromeClient.java
with Apache License 2.0
from codyer
with Apache License 2.0
from codyer
@Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
super.onShowCustomView(view, requestedOrientation, callback);
onShowCustomView(view, callback);
// 设置全屏的相关属性,获取当前的屏幕状态,然后设置全屏
Activity activity = ActivityUtil.getCurrentActivity();
if (activity == null)
return;
activity.setRequestedOrientation(requestedOrientation);
}
19
Source : ApkBundleLauncher.java
with Apache License 2.0
from ChanJLee
with Apache License 2.0
from ChanJLee
/**
* Apply plugin activity info with plugin's AndroidManifest.xml
* @param activity
* @param ai
*/
private static void applyActivityInfo(Activity activity, ActivityInfo ai) {
// Apply window attributes
Window window = activity.getWindow();
window.setSoftInputMode(ai.softInputMode);
activity.setRequestedOrientation(ai.screenOrientation);
}
19
Source : TestActivityWrapper.java
with GNU General Public License v3.0
from bidmachine
with GNU General Public License v3.0
from bidmachine
@Override
public void setRequestedOrientation(int requestedOrientation) {
base.setRequestedOrientation(requestedOrientation);
}
19
Source : UiUtils.java
with Apache License 2.0
from alperali
with Apache License 2.0
from alperali
public static void unlockOrientation(final Activity activity) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
}
See More Examples