Ejemplo n.º 1
0
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    Logger.T(TAG, "onConfigurationChanged");
    super.onConfigurationChanged(newConfig);
    if (!sScreenAutoRotate) {
      Logger.D(
          TAG,
          "Screen rotation is disabled. Force old orientation: "
              + getScreenProperties().getOrientation());
      setRequestedOrientation(getScreenProperties().getOrientation());
    } else {
      ScreenProperties props = getScreenProperties();
      props.reread(this);

      int rotation = 0;
      switch (props.getOrientation()) {
        case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
          rotation = 90;
          break;
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
          rotation = 180;
          break;
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
          rotation = 270;
          break;
        case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
        default:
          rotation = 0;
          break;
      }

      RhodesService.onScreenOrientationChanged(props.getWidth(), props.getHeight(), rotation);
    }
  }