本文整理了Java中android.app.Activity.getRequestedOrientation()
方法的一些代码示例,展示了Activity.getRequestedOrientation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getRequestedOrientation()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:getRequestedOrientation
暂无
代码示例来源:origin: robolectric/robolectric
@Implementation
protected int getRequestedOrientation() {
if (getParent() != null) {
return getParent().getRequestedOrientation();
} else {
return this.requestedOrientation;
}
}
代码示例来源:origin: Justson/AgentWeb
@Override
public void onHideCustomView() {
if (mMoiveView == null) {
return;
}
if (mActivity != null && mActivity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
if (!mFlags.isEmpty()) {
for (Pair<Integer, Integer> mPair : mFlags) {
mActivity.getWindow().setFlags(mPair.second, mPair.first);
}
mFlags.clear();
}
mMoiveView.setVisibility(View.GONE);
if (mMoiveParentView != null && mMoiveView != null) {
mMoiveParentView.removeView(mMoiveView);
}
if (mMoiveParentView != null) {
mMoiveParentView.setVisibility(View.GONE);
}
if (this.mCallback != null) {
mCallback.onCustomViewHidden();
}
this.mMoiveView = null;
if (mWebView != null) {
mWebView.setVisibility(View.VISIBLE);
}
}
代码示例来源:origin: square/assertj-android
public S hasRequestedOrientation(@ActivityScreenOrientation int orientation) {
isNotNull();
int actualOrientation = actual.getRequestedOrientation();
assertThat(actualOrientation) //
.overridingErrorMessage("Expected orientation <%s> but was <%s>.",
screenOrientationToString(orientation), screenOrientationToString(actualOrientation)) //
.isEqualTo(orientation);
return myself;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldSetOrientation() {
activity = Robolectric.setupActivity(DialogLifeCycleActivity.class);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
assertThat(activity.getRequestedOrientation()).isEqualTo(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getAndSetRequestedOrientation_shouldRemember() throws Exception {
Activity activity = new Activity();
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
assertEquals(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, activity.getRequestedOrientation());
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getAndSetRequestedOrientation_shouldDelegateToParentIfPresent() throws Exception {
Activity parentActivity = new Activity();
Activity activity = new Activity();
shadowOf(activity).setParent(parentActivity);
parentActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
assertEquals(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, activity.getRequestedOrientation());
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
assertEquals(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE, parentActivity.getRequestedOrientation());
}
代码示例来源:origin: android-hacker/VirtualXposed
activity.setTheme(info.theme);
if (activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
&& info.screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
activity.setRequestedOrientation(info.screenOrientation);
代码示例来源:origin: rtoshiro/FullscreenVideoView
/**
* Binds an Activity to VideoView. This is necessary to keep tracking on orientation changes
*
* @param activity The activity that VideoView is related to
*/
public void setActivity(Activity activity) {
this.activity = activity;
this.initialConfigOrientation = activity.getRequestedOrientation();
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @return
* @see android.app.Activity#getRequestedOrientation()
*/
public int getRequestedOrientation() {
return mActivity.getRequestedOrientation();
}
代码示例来源:origin: iqiyi/Neptune
@Override
public int getRequestedOrientation() {
return mOriginActivity.getRequestedOrientation();
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-android-driver
public ScreenOrientation getOrientation() {
int value = activity.getRequestedOrientation();
if (value == 0) {
return ScreenOrientation.LANDSCAPE;
}
return ScreenOrientation.PORTRAIT;
}
代码示例来源:origin: upyun/android-player-sdk
public void exitFullScreen(Activity activity) {
if (isFullState) {
if (activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setLayoutParams(mRawParams);
isFullState = false;
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public S hasRequestedOrientation(@ActivityScreenOrientation int orientation) {
isNotNull();
int actualOrientation = actual.getRequestedOrientation();
assertThat(actualOrientation) //
.overridingErrorMessage("Expected orientation <%s> but was <%s>.",
screenOrientationToString(orientation), screenOrientationToString(actualOrientation)) //
.isEqualTo(orientation);
return myself;
}
代码示例来源:origin: maxyou/CalendarPicker
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d("", "FragmentCalendarChooserDialog: FragmentCalendarChooserDialog.onCreateView");
View v = inflater.inflate(R.layout.com_maxproj_calendarpicker_fragment_calendar_picker, null);
findViews(v);
initClickListener();
orientationSaved = getActivity().getRequestedOrientation();
Log.d("", "orientation ---- saved:" + orientationSaved);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
return v;
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected int getRequestedOrientation() {
if (getParent() != null) {
return getParent().getRequestedOrientation();
} else {
return this.requestedOrientation;
}
}
代码示例来源:origin: org.robolectric/framework
@Implementation
public int getRequestedOrientation() {
if (getParent() != null) {
return getParent().getRequestedOrientation();
} else {
return this.requestedOrientation;
}
}
代码示例来源:origin: maxyou/CalendarPicker
@Override
public void onDestroyView() {
super.onDestroyView();
getActivity().setRequestedOrientation(orientationSaved);
Log.d("", "orientation ---- after restore onDestroyView:" + getActivity().getRequestedOrientation());
}
代码示例来源:origin: org.robolectric/shadows-core-v23
@Implementation
public int getRequestedOrientation() {
if (getParent() != null) {
return getParent().getRequestedOrientation();
} else {
return this.requestedOrientation;
}
}
代码示例来源:origin: org.robolectric/shadows-core
@Implementation
public int getRequestedOrientation() {
if (getParent() != null) {
return getParent().getRequestedOrientation();
} else {
return this.requestedOrientation;
}
}
代码示例来源:origin: maiwenchang/ArtPlayer
public static int getRequestedOrientation(Context context) {
if (getAppCompActivity(context) != null) {
return getAppCompActivity(context).getRequestedOrientation();
} else {
return scanForActivity(context).getRequestedOrientation();
}
}
内容来源于网络,如有侵权,请联系作者删除!