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


Java ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT属性代码示例

本文整理汇总了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;
    }
}
 
开发者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: 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();
}
 
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:11,代码来源:ReaderActivity.java

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


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