OSDN Git Service

次バージョンリリース準備。ログ出力タグの間違い修正。不要なOLYCamera依存を削除。
authorMRSa <mrsa@myad.jp>
Sun, 29 Jul 2018 06:21:52 +0000 (15:21 +0900)
committerMRSa <mrsa@myad.jp>
Sun, 29 Jul 2018 06:21:52 +0000 (15:21 +0900)
app/build.gradle
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/connection/RicohGr2CameraConnectSequence.java
app/src/main/java/net/osdn/gokigen/a01d/liveview/CameraLiveImageView.java

index 7f86293..d084d8e 100644 (file)
@@ -7,8 +7,8 @@ android {
         applicationId "net.osdn.gokigen.a01d"
         minSdkVersion 14
         targetSdkVersion 27
-        versionCode 10200
-        versionName "1.2.0"
+        versionCode 10201
+        versionName "1.2.1"
     }
     buildTypes {
         release {
index 97237a8..fc4a846 100644 (file)
@@ -14,7 +14,7 @@ import org.json.JSONObject;
 
 public class RicohGr2AutoFocusControl
 {
-    private static final String TAG = SonyAutoFocusControl.class.getSimpleName();
+    private static final String TAG = RicohGr2AutoFocusControl.class.getSimpleName();
     private final IIndicatorControl indicator;
     private final IAutoFocusFrameDisplay frameDisplayer;
     private String lockAutoFocusUrl = "http://192.168.0.1/v1/lens/focus/lock";
index a0f73cf..d5e7454 100644 (file)
@@ -41,6 +41,13 @@ class RicohGr2CameraConnectSequence implements Runnable
             {
                 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
 
+                // 接続時、レンズロックOFF
+                {
+                    final String postData = "cmd=acclock off";
+                    String response0 = SimpleHttpClient.httpPost(grCommandUrl, postData, TIMEOUT_MS);
+                    Log.v(TAG, grCommandUrl + " " + response0);
+                }
+
                 // 接続時、カメラの画面を消す
                 if (preferences.getBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false))
                 {
index de7d59b..0c8e5ac 100644 (file)
@@ -36,8 +36,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import jp.co.olympus.camerakit.OLYCamera;
-
 /**
  *   CameraLiveImageView :
  *    (OLYMPUS の ImageCaptureSample そのまま)
@@ -251,7 +249,7 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
             imageWidth = imageBitmap.getHeight();
             imageHeight = imageBitmap.getWidth();
          }
-        return (OLYCamera.convertPointOnLiveImageIntoViewfinder(pointOnImage, imageWidth, imageHeight, imageRotationDegrees));
+        return (convertPointOnLiveImageIntoViewfinder(pointOnImage, imageWidth, imageHeight, imageRotationDegrees));
     }
 
     /**
@@ -467,7 +465,7 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
         //Log.v(TAG, "drawFocusFrame() :" + focusFrameStatus);
 
         //  Calculate the rectangle of focus.
-        RectF focusRectOnImage = OLYCamera.convertRectOnViewfinderIntoLiveImage(focusFrameRect, imageWidth, imageHeight, imageRotationDegrees);
+        RectF focusRectOnImage = convertRectOnViewfinderIntoLiveImage(focusFrameRect, imageWidth, imageHeight, imageRotationDegrees);
         RectF focusRectOnView = convertRectFromImageArea(focusRectOnImage);
 
         // Draw a rectangle to the canvas.
@@ -864,6 +862,65 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
     }
 
     /**
+     *  ライブビュー座標系の点座標をビューファインダー座標系の点座標に変換
+     *
+     *
+     */
+    private PointF convertPointOnLiveImageIntoViewfinder(PointF point, float width, float height, int rotatedDegrees)
+    {
+        float viewFinderPointX = 0.5f;
+        float viewFinderPointY = 0.5f;
+        try
+        {
+            if (rotatedDegrees == 0 || rotatedDegrees == 180) {
+                viewFinderPointX = point.x / width;
+                viewFinderPointY = point.y / height;
+            } else {
+                viewFinderPointX = point.y / width;
+                viewFinderPointY = point.x / height;
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (new PointF(viewFinderPointX, viewFinderPointY));
+    }
+
+    /**
+     *  ビューファインダー座標系の矩形座標をライブビュー座標系のの矩形座標に変換
+     *
+     *
+     */
+    private RectF convertRectOnViewfinderIntoLiveImage(RectF rect, float width, float height, int rotatedDegrees)
+    {
+        float top = 0.0f;
+        float bottom = 1.0f;
+        float left = 0.0f;
+        float right = 1.0f;
+        try
+        {
+            if (rotatedDegrees == 0 || rotatedDegrees == 180) {
+                top = rect.top * height;
+                bottom = rect.bottom * height;
+                left = rect.left * width;
+                right = rect.right * width;
+            } else {
+                left = rect.top * height;
+                right = rect.bottom * height;
+                top = rect.left * width;
+                bottom = rect.right * width;
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (new RectF(left, top, right, bottom));
+    }
+
+
+    /**
      * Converts a rectangle on image area to a rectangle on view area.
      *
      * @param rect A rectangle on image area. (e.g. a live preview image)