From f4acd7979a05a99725925ce20e698ffa8a4d5764 Mon Sep 17 00:00:00 2001 From: leon chen Date: Tue, 4 Dec 2018 14:09:01 +0800 Subject: [PATCH 1/2] comment complete --- .../main/base/com/google/android/cameraview/AspectRatio.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/base/com/google/android/cameraview/AspectRatio.java b/library/src/main/base/com/google/android/cameraview/AspectRatio.java index d7f841d0..01f73be3 100644 --- a/library/src/main/base/com/google/android/cameraview/AspectRatio.java +++ b/library/src/main/base/com/google/android/cameraview/AspectRatio.java @@ -34,7 +34,7 @@ public class AspectRatio implements Comparable, Parcelable { /** * Returns an instance of {@link AspectRatio} specified by {@code x} and {@code y} values. - * The values {@code x} and {@code} will be reduced by their greatest common divider. + * The values {@code x} and {@code y} will be reduced by their greatest common divider. * * @param x The width * @param y The height From c15159c2f3bd982454dbf0a609b4d302c798ccd1 Mon Sep 17 00:00:00 2001 From: Leon Chen Date: Fri, 7 Dec 2018 21:01:13 +0800 Subject: [PATCH 2/2] fix green preview bug In a phone like XIaoMi 6X which cannot support Camera2 and API Level is above 24 , when your use home button to pause the preview and then back to the app , the preview will be green. I fix it by change the TextureVIew to SurfaceView in this case . --- .../main/java/com/google/android/cameraview/CameraView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/google/android/cameraview/CameraView.java b/library/src/main/java/com/google/android/cameraview/CameraView.java index 04826d84..8c2d5ec6 100644 --- a/library/src/main/java/com/google/android/cameraview/CameraView.java +++ b/library/src/main/java/com/google/android/cameraview/CameraView.java @@ -132,8 +132,10 @@ private PreviewImpl createPreviewImpl(Context context) { PreviewImpl preview; if (Build.VERSION.SDK_INT < 14) { preview = new SurfaceViewPreview(context, this); - } else { + } else if (Build.VERSION.SDK_INT < 24){ preview = new TextureViewPreview(context, this); + }else { + preview = new SurfaceViewPreview(context, this); } return preview; }