詹子聪 5 år sedan
förälder
incheckning
848e7151c3

+ 2 - 2
app/build.gradle

@@ -7,8 +7,8 @@ android {
         applicationId "com.miekir.ocr"
         minSdkVersion versions.minSdk
         targetSdkVersion versions.targetSdk
-        versionCode 10
-        versionName "1.0.10"
+        versionCode 11
+        versionName "1.0.11"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
 

+ 17 - 16
app/src/main/java/com/miekir/ocr/ui/OperationPresenter.java

@@ -355,7 +355,7 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
                 boolean isPortraitPhoto = BigDecimal.valueOf(heightD).compareTo(BigDecimal.valueOf(widthD)) > 0;
                 if (isPortraitPhoto) {
                     // 高的倍距大,以高为基准
-                    if (widthD > 1) {
+                    if (heightD > 1) {
                         // 图片宽要缩小到屏幕宽
                         float pivot = 1.0f * rawBitmapHeight / mHeight;
                         realLeft = (int) (mLeft * pivot);
@@ -372,21 +372,22 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
                     }
                 } else {
                     // 宽的倍距大,以宽为基准
-                    if (heightD > 1) {
-                        // 图片高要缩小到屏幕高
-                        float pivot = 1.0f * rawBitmapWidth / mWidth;
-                        realLeft = (int) (mLeft * pivot);
-                        realTop = (int) (mTop * pivot);
-                        croppedBitmapWidth = (int) ((mRight - mLeft) * pivot);
-                        croppedBitmapHeight = (int) ((mBottom - mTop) * pivot);
-                    } else {
-                        // 屏幕宽要缩小到图片宽
-                        float pivot = 1.0f * mWidth / rawBitmapWidth;
-                        realLeft = (int) (mLeft/pivot);
-                        realTop = (int) (mTop/pivot);
-                        croppedBitmapWidth = (int) (1.0f * (mRight - mLeft)/pivot);
-                        croppedBitmapHeight = (int) (1.0f * (mBottom - mTop)/pivot);
-                    }
+//                    if (widthD > 1) {
+//                        // 图片高要缩小到屏幕高
+//                        float pivot = 1.0f * rawBitmapWidth / mWidth;
+//                        realLeft = (int) (mLeft * pivot);
+//                        realTop = (int) (mTop * pivot);
+//                        croppedBitmapWidth = (int) ((mRight - mLeft) * pivot);
+//                        croppedBitmapHeight = (int) ((mBottom - mTop) * pivot);
+//                    } else {
+//
+//                    }
+                    // 屏幕宽要缩小到图片宽
+                    float pivot = 1.0f * mWidth / rawBitmapWidth;
+                    realLeft = (int) (mLeft/pivot);
+                    realTop = (int) (mTop/pivot);
+                    croppedBitmapWidth = (int) (1.0f * (mRight - mLeft)/pivot);
+                    croppedBitmapHeight = (int) (1.0f * (mBottom - mTop)/pivot);
                 }
 
 

+ 4 - 2
camera/src/main/java/com/cjt2325/cameralibrary/CameraInterface.java

@@ -380,8 +380,10 @@ public class CameraInterface implements Camera.PreviewCallback {
 
                 if (CameraParamUtil.getInstance().isSupportedFocusMode(
                         mParams.getSupportedFocusModes(),
-                        Camera.Parameters.FOCUS_MODE_AUTO)) {
-                    mParams.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
+                        Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
+                    //mParams.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
+                    // 自动对焦
+                    mParams.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
                 }
                 if (CameraParamUtil.getInstance().isSupportedPictureFormats(mParams.getSupportedPictureFormats(),
                         ImageFormat.JPEG)) {