OSDN Git Service

PENTAX一眼の制御の動作確認。(フォーカス制御&シャッター)
authorMRSa <mrsa@myad.jp>
Fri, 25 Jan 2019 16:01:11 +0000 (01:01 +0900)
committerMRSa <mrsa@myad.jp>
Fri, 25 Jan 2019 16:01:11 +0000 (01:01 +0900)
app/build.gradle
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2SingleShotControl.java
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/strings.xml
build.gradle
gradle/wrapper/gradle-wrapper.properties

index be5d5b8..4c621cf 100644 (file)
@@ -7,8 +7,8 @@ android {
         applicationId "net.osdn.gokigen.a01d"
         minSdkVersion 14
         targetSdkVersion 28
-        versionCode 10202
-        versionName "1.2.2"
+        versionCode 10203
+        versionName "1.2.3"
     }
     buildTypes {
         release {
index f82c755..2ae026d 100644 (file)
@@ -1,5 +1,6 @@
 package net.osdn.gokigen.a01d.camera.ricohgr2.operation;
 
+import android.content.Context;
 import android.support.annotation.NonNull;
 
 import net.osdn.gokigen.a01d.camera.ICaptureControl;
@@ -10,9 +11,9 @@ public class RicohGr2CameraCaptureControl implements ICaptureControl
 {
     private final RicohGr2SingleShotControl singleShotControl;
 
-    public RicohGr2CameraCaptureControl(@NonNull IAutoFocusFrameDisplay frameDisplayer)
+    public RicohGr2CameraCaptureControl(@NonNull Context context, @NonNull IAutoFocusFrameDisplay frameDisplayer)
     {
-        singleShotControl = new RicohGr2SingleShotControl(frameDisplayer);
+        singleShotControl = new RicohGr2SingleShotControl(context, frameDisplayer);
     }
 
     @Override
index 536baa7..c6aed07 100644 (file)
@@ -1,10 +1,14 @@
 package net.osdn.gokigen.a01d.camera.ricohgr2.operation.takepicture;
 
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
 import android.support.annotation.NonNull;
 import android.util.Log;
 
 import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
 import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
 
 /**
  *
@@ -16,15 +20,35 @@ public class RicohGr2SingleShotControl
     private static final String TAG = RicohGr2SingleShotControl.class.getSimpleName();
     private final String shootUrl = "http://192.168.0.1/v1/camera/shoot";
     private final IAutoFocusFrameDisplay frameDisplayer;
+    private boolean usePentaxDslr = false;
     private int timeoutMs = 6000;
 
     /**
      *
      *
      */
-    public RicohGr2SingleShotControl(@NonNull IAutoFocusFrameDisplay frameDisplayer)
+    public RicohGr2SingleShotControl(@NonNull Context context, @NonNull IAutoFocusFrameDisplay frameDisplayer)
     {
         this.frameDisplayer = frameDisplayer;
+        prepare(context);
+    }
+
+    /**
+     *
+     *
+     */
+    private void prepare(@NonNull Context context)
+    {
+        try
+        {
+            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+            usePentaxDslr = preferences.getBoolean(IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS, false);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        Log.v(TAG, "USE PENTAX DSLR : " + usePentaxDslr);
     }
 
     /**
@@ -43,7 +67,7 @@ public class RicohGr2SingleShotControl
                 {
                     try
                     {
-                        String postData = "af=camera";
+                        String postData = (usePentaxDslr) ? "" : "af=camera";
                         String result = SimpleHttpClient.httpPost(shootUrl, postData, timeoutMs);
                         if ((result == null)||(result.length() < 1))
                         {
@@ -64,5 +88,4 @@ public class RicohGr2SingleShotControl
             e.printStackTrace();
         }
     }
-
 }
index 071b54f..d87f215 100644 (file)
@@ -30,7 +30,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
 {
     private final String TAG = toString();
     private final Activity activity;
-    private final ICameraStatusReceiver provider;
+    //private final ICameraStatusReceiver provider;
     private final RicohGr2Connection gr2Connection;
     private RicohGr2LiveViewControl liveViewControl;
     private RicohGr2CameraCaptureControl captureControl;
@@ -44,11 +44,10 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     public RicohGr2InterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
     {
         this.activity = context;
-        this.provider = provider;
+        //this.provider = provider;
         gr2Connection = new RicohGr2Connection(context, provider);
         liveViewControl = new RicohGr2LiveViewControl(context);
         zoomControl = new RicohGr2CameraZoomLensControl();
-
     }
 
     /**
@@ -69,7 +68,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     {
         Log.v(TAG, "injectDisplay()");
         focusControl = new RicohGr2CameraFocusControl(activity, frameDisplayer, indicator);
-        captureControl = new RicohGr2CameraCaptureControl(frameDisplayer);
+        captureControl = new RicohGr2CameraCaptureControl(activity, frameDisplayer);
     }
 
     /**
index 71ca41b..b2990b9 100644 (file)
     <string name="dialog_confirm_title_output_log">ログの共有</string>
     <string name="dialog_confirm_message_output_log">デバッグログを共有します。</string>
 
-    <string name="pref_use_pentax_autofocus">PENTAXä¸\80ç\9c¼ã\82¿ã\83\83ã\83\81ã\83\95ã\82©ã\83¼ã\82«ã\82¹</string>
-    <string name="pref_use_pentax_autofocus_summary">タッチフォーカスでPENTAX一眼命令を使います。</string>
+    <string name="pref_use_pentax_autofocus">PENTAXä¸\80ç\9c¼ã\82«ã\83¡ã\83©ã\81®å\88¶å¾¡</string>
+    <string name="pref_use_pentax_autofocus_summary">PENTAX一眼カメラ用の命令を使って制御します。</string>
 
 </resources>
index fe9f76e..9e21b7a 100644 (file)
     <string name="pref_gr2_display_camera_view">Mirror Camera Screen</string>
     <string name="pref_gr2_display_camera_view_summary">Use same camera screen.</string>
 
-    <string name="pref_use_pentax_autofocus">PENTAX DSLR Touch focus control.</string>
-    <string name="pref_use_pentax_autofocus_summary">Do use a PENTAX DSLR Control for touch focus command.</string>
+    <string name="pref_use_pentax_autofocus">PENTAX DSLR control</string>
+    <string name="pref_use_pentax_autofocus_summary">Uses PENTAX DSLR control commands.</string>
 
 </resources>
index ac0e385..88ea6fd 100644 (file)
@@ -6,7 +6,7 @@ buildscript {
         google()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.2.1'
+        classpath 'com.android.tools.build:gradle:3.3.0'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
index 61ab215..5672024 100644 (file)
@@ -1,6 +1,6 @@
-#Tue Sep 25 23:41:43 JST 2018
+#Fri Jan 25 23:31:54 JST 2019
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip