當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。