Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-15812] Android: Fix for camera overlay for devices having only fr... #6536

Merged
merged 1 commit into from
Jan 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

// checks if device has only front facing camera and sets it
checkWhichCameraAsDefault();

// create camera preview
preview = new SurfaceView(this);
SurfaceHolder previewHolder = preview.getHolder();
Expand Down Expand Up @@ -562,6 +565,19 @@ public void onPictureTaken(byte[] data, Camera camera)
}
};

private void checkWhichCameraAsDefault(){
// This is to check if device has only front facing camera
// TIMOB-15812: Fix for Devices like Nexus 7 (2012) that only
// has front facing camera and no rear camera.
TiCameraActivity.getFrontCameraId();
TiCameraActivity.getBackCameraId();
if (backCameraId == Integer.MIN_VALUE && frontCameraId != Integer.MIN_VALUE) {
TiCameraActivity.whichCamera = MediaModule.CAMERA_FRONT;
} else {
TiCameraActivity.whichCamera = MediaModule.CAMERA_REAR;
}
}

private static int getFrontCameraId()
{
if (frontCameraId == Integer.MIN_VALUE) {
Expand Down