Skip to content

Commit

Permalink
Merge remote-tracking branch 'goog/github/master' into fix-am
Browse files Browse the repository at this point in the history
Change-Id: Ib500a7a3bb1c1f24a2a6c86c3edb2da8f00b2c91
  • Loading branch information
yaraki committed Oct 14, 2016
2 parents f0dddd7 + e5eddec commit cd46df8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Camera1 extends CameraViewImpl {

private int mCameraId;

private Camera mCamera;
Camera mCamera;

private Camera.Parameters mCameraParameters;

Expand Down Expand Up @@ -101,7 +101,7 @@ void stop() {
}

@SuppressLint("NewApi") // Suppresses Camera#setPreviewTexture
private void setUpPreview() {
void setUpPreview() {
try {
if (mPreview.getOutputClass() == SurfaceHolder.class) {
final boolean needsToStopPreview = mShowingPreview && Build.VERSION.SDK_INT < 14;
Expand Down Expand Up @@ -220,7 +220,7 @@ public void onAutoFocus(boolean success, Camera camera) {
}
}

private void takePictureInternal() {
void takePictureInternal() {
mCamera.takePicture(null, null, null, new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
Expand Down Expand Up @@ -301,7 +301,7 @@ private AspectRatio chooseAspectRatio() {
return r;
}

private void adjustCameraParameters() {
void adjustCameraParameters() {
SortedSet<Size> sizes = mPreviewSizes.sizes(mAspectRatio);
if (sizes == null) { // Not supported
mAspectRatio = chooseAspectRatio();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ boolean isReady() {
* Configures the transform matrix for TextureView based on {@link #mDisplayOrientation} and
* the surface size.
*/
private void configureTransform() {
void configureTransform() {
Matrix matrix = new Matrix();
if (mDisplayOrientation % 180 == 90) {
final int width = getWidth();
Expand Down
21 changes: 12 additions & 9 deletions library/src/main/api21/com/google/android/cameraview/Camera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void onClosed(@NonNull CameraCaptureSession session) {

};

private PictureCaptureCallback mCaptureCallback = new PictureCaptureCallback() {
PictureCaptureCallback mCaptureCallback = new PictureCaptureCallback() {

@Override
public void onPrecaptureRequired() {
Expand Down Expand Up @@ -164,11 +164,11 @@ public void onImageAvailable(ImageReader reader) {

private CameraCharacteristics mCameraCharacteristics;

private CameraDevice mCamera;
CameraDevice mCamera;

private CameraCaptureSession mCaptureSession;
CameraCaptureSession mCaptureSession;

private CaptureRequest.Builder mPreviewRequestBuilder;
CaptureRequest.Builder mPreviewRequestBuilder;

private ImageReader mImageReader;

Expand Down Expand Up @@ -427,7 +427,7 @@ private void startOpeningCamera() {
* <p>This rewrites {@link #mPreviewRequestBuilder}.</p>
* <p>The result will be continuously processed in {@link #mSessionCallback}.</p>
*/
private void startCaptureSession() {
void startCaptureSession() {
if (!isCameraOpened() || !mPreview.isReady()) {
return;
}
Expand Down Expand Up @@ -474,7 +474,7 @@ private Size chooseOptimalSize() {
/**
* Updates the internal state of auto-focus to {@link #mAutoFocus}.
*/
private void updateAutoFocus() {
void updateAutoFocus() {
if (mAutoFocus) {
int[] modes = mCameraCharacteristics.get(
CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES);
Expand All @@ -497,7 +497,7 @@ private void updateAutoFocus() {
/**
* Updates the internal state of flash to {@link #mFlash}.
*/
private void updateFlash() {
void updateFlash() {
switch (mFlash) {
case Constants.FLASH_OFF:
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
Expand Down Expand Up @@ -549,7 +549,7 @@ private void lockFocus() {
/**
* Captures a still picture.
*/
private void captureStillPicture() {
void captureStillPicture() {
try {
CaptureRequest.Builder captureRequestBuilder = mCamera.createCaptureRequest(
CameraDevice.TEMPLATE_STILL_CAPTURE);
Expand Down Expand Up @@ -610,7 +610,7 @@ public void onCaptureCompleted(@NonNull CameraCaptureSession session,
* Unlocks the auto-focus and restart camera preview. This is supposed to be called after
* capturing a still picture.
*/
private void unlockFocus() {
void unlockFocus() {
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
CaptureRequest.CONTROL_AF_TRIGGER_CANCEL);
try {
Expand Down Expand Up @@ -642,6 +642,9 @@ private static abstract class PictureCaptureCallback

private int mState;

PictureCaptureCallback() {
}

void setState(int state) {
mState = state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class SurfaceViewPreview extends PreviewImpl {

private final SurfaceView mSurfaceView;
final SurfaceView mSurfaceView;

SurfaceViewPreview(Context context, ViewGroup parent) {
final View view = View.inflate(context, R.layout.surface_view, parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class CameraView extends FrameLayout {
public @interface Flash {
}

private final CameraViewImpl mImpl;
final CameraViewImpl mImpl;

private final CallbackBridge mCallbacks;

Expand Down Expand Up @@ -384,6 +384,9 @@ private class CallbackBridge implements CameraViewImpl.Callback {

private boolean mRequestLayoutOnOpen;

CallbackBridge() {
}

public void add(Callback callback) {
mCallbacks.add(callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class DisplayOrientationDetector {
private final OrientationEventListener mOrientationEventListener;

/** Mapping from Surface.Rotation_n to degrees. */
private static final SparseIntArray DISPLAY_ORIENTATIONS = new SparseIntArray();
static final SparseIntArray DISPLAY_ORIENTATIONS = new SparseIntArray();

static {
DISPLAY_ORIENTATIONS.put(Surface.ROTATION_0, 0);
Expand All @@ -40,7 +40,7 @@ abstract class DisplayOrientationDetector {
DISPLAY_ORIENTATIONS.put(Surface.ROTATION_270, 270);
}

private Display mDisplay;
Display mDisplay;

private int mLastKnownDisplayOrientation = 0;

Expand Down Expand Up @@ -81,7 +81,7 @@ public int getLastKnownDisplayOrientation() {
return mLastKnownDisplayOrientation;
}

private void dispatchOnDisplayOrientationChanged(int displayOrientation) {
void dispatchOnDisplayOrientationChanged(int displayOrientation) {
mLastKnownDisplayOrientation = displayOrientation;
onDisplayOrientationChanged(displayOrientation);
}
Expand Down

0 comments on commit cd46df8

Please sign in to comment.