本文整理匯總了Java中com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration.SENSOR_POSITION_RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java CameraConfiguration.SENSOR_POSITION_RIGHT屬性的具體用法?Java CameraConfiguration.SENSOR_POSITION_RIGHT怎麽用?Java CameraConfiguration.SENSOR_POSITION_RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration
的用法示例。
在下文中一共展示了CameraConfiguration.SENSOR_POSITION_RIGHT屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getVideoOrientation
@Override
protected int getVideoOrientation(@CameraConfiguration.SensorPosition int sensorPosition) {
int degrees = 0;
switch (sensorPosition) {
case CameraConfiguration.SENSOR_POSITION_UP:
degrees = 0;
break; // Natural orientation
case CameraConfiguration.SENSOR_POSITION_LEFT:
degrees = 90;
break; // Landscape left
case CameraConfiguration.SENSOR_POSITION_UP_SIDE_DOWN:
degrees = 180;
break;// Upside down
case CameraConfiguration.SENSOR_POSITION_RIGHT:
degrees = 270;
break;// Landscape right
case CameraConfiguration.SENSOR_POSITION_UNSPECIFIED:
degrees = 0;
break; // Natural orientation
}
int rotate;
if (currentCameraId.equals(faceFrontCameraId)) {
rotate = (360 + faceFrontCameraOrientation + degrees) % 360;
} else {
rotate = (360 + faceBackCameraOrientation - degrees) % 360;
}
return rotate;
}
示例2: 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);
}
}
}
示例3: getVideoOrientation
@Override
protected int getVideoOrientation(@CameraConfiguration.SensorPosition int sensorPosition) {
int degrees = 0;
switch (sensorPosition) {
case CameraConfiguration.SENSOR_POSITION_UP:
degrees = 0;
break; // Natural orientation
case CameraConfiguration.SENSOR_POSITION_LEFT:
degrees = 90;
break; // Landscape left
case CameraConfiguration.SENSOR_POSITION_UP_SIDE_DOWN:
degrees = 180;
break;// Upside down
case CameraConfiguration.SENSOR_POSITION_RIGHT:
degrees = 270;
break;// Landscape right
case CameraConfiguration.SENSOR_POSITION_UNSPECIFIED:
break;
}
int rotate;
if (Objects.equals(currentCameraId, faceFrontCameraId)) {
rotate = (360 + faceFrontCameraOrientation + degrees) % 360;
} else {
rotate = (360 + faceBackCameraOrientation - degrees) % 360;
}
return rotate;
}
示例4: getVideoOrientation
@Override
protected int getVideoOrientation(@CameraConfiguration.SensorPosition int sensorPosition) {
int degrees = 0;
switch (sensorPosition) {
case CameraConfiguration.SENSOR_POSITION_UP:
degrees = 0;
break; // Natural orientation
case CameraConfiguration.SENSOR_POSITION_LEFT:
degrees = 90;
break; // Landscape left
case CameraConfiguration.SENSOR_POSITION_UP_SIDE_DOWN:
degrees = 180;
break;// Upside down
case CameraConfiguration.SENSOR_POSITION_RIGHT:
degrees = 270;
break;// Landscape right
case CameraConfiguration.SENSOR_POSITION_UNSPECIFIED:
degrees = 0;
break; // Natural orientation
}
int rotate;
if (currentCameraId.equals(faceFrontCameraId)) {
rotate = (360 + faceFrontCameraOrientation + degrees) % 360;
} else {
rotate = (360 + faceBackCameraOrientation - degrees) % 360;
}
return rotate;
}