From 7c8083846306886aa7a408640e4faa108ca6ec28 Mon Sep 17 00:00:00 2001
From: endian11 <Dana_Lee1016@126.com>
Date: 星期四, 19 九月 2019 18:21:22 +0800
Subject: [PATCH] 拍照功能加入log;主界面退出系统点击后打开拍照界面;

---
 app/src/main/java/safeluck/drive/evaluation/fragment/TakePhotoFragment.java |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/TakePhotoFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/TakePhotoFragment.java
index a86edb8..72be15e 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/TakePhotoFragment.java
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/TakePhotoFragment.java
@@ -58,6 +58,7 @@
 import me.yokeyword.fragmentation.SupportFragment;
 import safeluck.drive.evaluation.R;
 import safeluck.drive.evaluation.customview.AutoFitTextureView;
+import safeluck.drive.evaluation.util.MyLog;
 
 /**
  * MyApplication2
@@ -183,6 +184,7 @@
         @Override
         public void onOpened(@NonNull CameraDevice cameraDevice) {
             // This method is called when the camera is opened.  We start camera preview here.
+            MyLog.i(TAG,"Camera Device onOpened");
             mCameraOpenCloseLock.release();
             mCameraDevice = cameraDevice;
             createCameraPreviewSession();
@@ -190,6 +192,7 @@
 
         @Override
         public void onDisconnected(@NonNull CameraDevice cameraDevice) {
+            MyLog.i(TAG,"Camera Device onDisconnected");
             mCameraOpenCloseLock.release();
             cameraDevice.close();
             mCameraDevice = null;
@@ -197,6 +200,7 @@
 
         @Override
         public void onError(@NonNull CameraDevice cameraDevice, int error) {
+            MyLog.i(TAG,"Camera Device onError");
             mCameraOpenCloseLock.release();
             cameraDevice.close();
             mCameraDevice = null;
@@ -517,6 +521,7 @@
                 // Find out if we need to swap dimension to get the preview size relative to sensor
                 // coordinate.
                 int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();
+                MyLog.i(TAG,"displayRotation="+displayRotation);
                 //noinspection ConstantConditions
                 mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
                 boolean swappedDimensions = false;
@@ -543,7 +548,7 @@
                 int rotatedPreviewHeight = height;
                 int maxPreviewWidth = displaySize.x;
                 int maxPreviewHeight = displaySize.y;
-
+                MyLog.i(TAG,"swappedDimensions="+swappedDimensions);
                 if (swappedDimensions) {
                     rotatedPreviewWidth = height;
                     rotatedPreviewHeight = width;
@@ -565,9 +570,10 @@
                 mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
                         rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
                         maxPreviewHeight, largest);
-
+                MyLog.i(TAG,"chooseOptimalSize="+mPreviewSize.getWidth()+":"+mPreviewSize.getHeight());
                 // We fit the aspect ratio of TextureView to the size of preview we picked.
                 int orientation = getResources().getConfiguration().orientation;
+                MyLog.i(TAG,"getResources().getConfiguration().orientation="+orientation);
                 if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
                     mTextureView.setAspectRatio(
                             mPreviewSize.getWidth(), mPreviewSize.getHeight());
@@ -581,6 +587,7 @@
                 mFlashSupported = available == null ? false : available;
 
                 mCameraId = cameraId;
+                MyLog.i(TAG,"CameraID="+mCameraId+ " FlashSupported="+mFlashSupported);
                 return;
             }
         } catch (CameraAccessException e) {
@@ -745,6 +752,7 @@
         RectF bufferRect = new RectF(0, 0, mPreviewSize.getHeight(), mPreviewSize.getWidth());
         float centerX = viewRect.centerX();
         float centerY = viewRect.centerY();
+        MyLog.i(TAG,"configureTransform centerX="+centerX+" CenterY="+centerY+" getDefaultDisplay().getRotation()="+rotation);
         if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
             bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
             matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);

--
Gitblit v1.8.0