當前位置: 首頁>>代碼示例>>Java>>正文


Java CameraConfiguration.ORIENTATION_PORTRAIT屬性代碼示例

本文整理匯總了Java中com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration.ORIENTATION_PORTRAIT屬性的典型用法代碼示例。如果您正苦於以下問題:Java CameraConfiguration.ORIENTATION_PORTRAIT屬性的具體用法?Java CameraConfiguration.ORIENTATION_PORTRAIT怎麽用?Java CameraConfiguration.ORIENTATION_PORTRAIT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration的用法示例。


在下文中一共展示了CameraConfiguration.ORIENTATION_PORTRAIT屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onSensorChanged

@Override
public void onSensorChanged(SensorEvent sensorEvent) {
    synchronized (this) {
        if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
            if (sensorEvent.values[0] < 4 && sensorEvent.values[0] > -4) {
                if (sensorEvent.values[1] > 0) {
                    // UP
                    sensorPosition = CameraConfiguration.SENSOR_POSITION_UP;
                    degrees = deviceDefaultOrientation == CameraConfiguration.ORIENTATION_PORTRAIT ? 0 : 90;
                } else if (sensorEvent.values[1] < 0) {
                    // UP SIDE DOWN
                    sensorPosition = CameraConfiguration.SENSOR_POSITION_UP_SIDE_DOWN;
                    degrees = deviceDefaultOrientation == CameraConfiguration.ORIENTATION_PORTRAIT ? 180 : 270;
                }
            } else if (sensorEvent.values[1] < 4 && sensorEvent.values[1] > -4) {
                if (sensorEvent.values[0] > 0) {
                    // LEFT
                    sensorPosition = CameraConfiguration.SENSOR_POSITION_LEFT;
                    degrees = deviceDefaultOrientation == CameraConfiguration.ORIENTATION_PORTRAIT ? 90 : 180;
                } else if (sensorEvent.values[0] < 0) {
                    // RIGHT
                    sensorPosition = CameraConfiguration.SENSOR_POSITION_RIGHT;
                    degrees = deviceDefaultOrientation == CameraConfiguration.ORIENTATION_PORTRAIT ? 270 : 0;
                }
            }
            onScreenRotation(degrees);
        }
    }
}
 
開發者ID:MartinRGB,項目名稱:android_camera_experiment,代碼行數:29,代碼來源:SandriosCameraActivity.java

示例2: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    cameraController = createCameraController(this, this);
    cameraController.onCreate(savedInstanceState);

    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    int defaultOrientation = Utils.getDeviceDefaultOrientation(this);

    if (defaultOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        deviceDefaultOrientation = CameraConfiguration.ORIENTATION_LANDSCAPE;
    } else if (defaultOrientation == Configuration.ORIENTATION_PORTRAIT) {
        deviceDefaultOrientation = CameraConfiguration.ORIENTATION_PORTRAIT;
    }

    View decorView = getWindow().getDecorView();
    if (Build.VERSION.SDK_INT > 15) {
        int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }

    setContentView(R.layout.generic_camera_layout);

    previewContainer = (AspectFrameLayout) findViewById(R.id.previewContainer);
    userContainer = (ViewGroup) findViewById(R.id.userContainer);

    onProcessBundle(savedInstanceState);
    setUserContent();
}
 
開發者ID:sandrios,項目名稱:sandriosCamera,代碼行數:30,代碼來源:SandriosCameraActivity.java

示例3: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    cameraController = createCameraController(this, this);
    cameraController.onCreate(savedInstanceState);


    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    int defaultOrientation = Utils.getDeviceDefaultOrientation(this);

    if (defaultOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        deviceDefaultOrientation = CameraConfiguration.ORIENTATION_LANDSCAPE;
    } else if (defaultOrientation == Configuration.ORIENTATION_PORTRAIT) {
        deviceDefaultOrientation = CameraConfiguration.ORIENTATION_PORTRAIT;
    }

    View decorView = getWindow().getDecorView();
    if (Build.VERSION.SDK_INT > 15) {
        int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }

    setContentView(R.layout.generic_camera_layout);

    previewContainer = (AspectFrameLayout) findViewById(R.id.previewContainer);
    userContainer = (ViewGroup) findViewById(R.id.userContainer);
    mLockView = (DetectionView) findViewById(R.id.lockOverlay);

    onProcessBundle(savedInstanceState);
    setUserContent();

    mContext = getApplicationContext();

    setSpringSystem();

    cameraController.setRectChangeListener(new Camera1Controller.RectChangeListener() {
        @Override
        public void RectChange(Rect rect) {
            if(rect !=null){

                mLockView.updatePosition(rect);
                mSpringsAlpha.setCurrentValue(1);

            }
        }

        @Override
        public void RectDetected(Boolean mboolean) {
            rectHasDetect = mboolean;
            mSpringsAlpha.setEndValue(0);

        }
    });

}
 
開發者ID:MartinRGB,項目名稱:android_camera_experiment,代碼行數:56,代碼來源:SandriosCameraActivity.java


注:本文中的com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration.ORIENTATION_PORTRAIT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。