当前位置: 首页>>代码示例>>Java>>正文


Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE属性代码示例

本文整理汇总了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;
    }
}
 
开发者ID:dev-labs-bg,项目名称:fullscreen-video-view,代码行数:25,代码来源:CustomChecks.java

示例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;
}
 
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:11,代码来源:ReaderActivity.java

示例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;
}
 
开发者ID:suikki,项目名称:simpleSDL,代码行数:43,代码来源:SDLActivity.java


注:本文中的android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。