OSDN Git Service

Pentax DSLR機で、AFを動作後シャッターを切る設定ができるよう変更する。(でも、再起動必要...)
authorMRSa <mrsa@myad.jp>
Sat, 19 Jan 2019 13:28:00 +0000 (22:28 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 19 Jan 2019 13:28:00 +0000 (22:28 +0900)
app/build.gradle
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/takepicture/RicohGr2SingleShotControl.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_ricoh_gr2.xml

index 30d19a6..c988801 100644 (file)
@@ -6,8 +6,8 @@ android {
         applicationId "net.osdn.gokigen.gr2control"
         minSdkVersion 14
         targetSdkVersion 28
-        versionCode 1001001
-        versionName "1.1.1"
+        versionCode 1001002
+        versionName "1.1.2"
     }
     buildTypes {
         release {
index 18dca47..0c15a04 100644 (file)
@@ -18,14 +18,16 @@ public class RicohGr2CameraCaptureControl implements ICaptureControl
     private final RicohGr2MovieShotControl movieShotControl;
     private final ICameraStatus cameraStatus;
     private final boolean useGrCommand;
+    private final boolean captureAfterAf;
 
     /**
      *
      *
      */
-    public RicohGr2CameraCaptureControl(boolean useGrCommand, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull ICameraStatus cameraStatus)
+    public RicohGr2CameraCaptureControl(boolean useGrCommand, boolean captureAfterAf, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull ICameraStatus cameraStatus)
     {
         this.useGrCommand = useGrCommand;
+        this.captureAfterAf = captureAfterAf;
         this.cameraStatus = cameraStatus;
         singleShotControl = new RicohGr2SingleShotControl(frameDisplayer);
         movieShotControl = new RicohGr2MovieShotControl(frameDisplayer);
@@ -46,7 +48,7 @@ public class RicohGr2CameraCaptureControl implements ICaptureControl
             }
             else
             {
-                singleShotControl.singleShot(useGrCommand);
+                singleShotControl.singleShot(useGrCommand, captureAfterAf);
             }
         }
         catch (Exception e)
index 587efc9..2889705 100644 (file)
@@ -31,7 +31,7 @@ public class RicohGr2SingleShotControl
      *
      *
      */
-    public void singleShot(final boolean isCamera)
+    public void singleShot(final boolean isCamera, final boolean isDriveAutoFocus)
     {
         Log.v(TAG, "singleShot()");
         try
@@ -43,8 +43,17 @@ public class RicohGr2SingleShotControl
                 {
                     try
                     {
-                        //String postData = (isCamera) ? "af=camera" : "af=on";
-                        String postData = (isCamera) ? "af=camera" : "";
+                        String postData = "";
+                        if ((isCamera)&&(isDriveAutoFocus))
+                        {
+                            // RICOH GR II
+                            postData = "af=camera";
+                        }
+                        else if ((!isCamera)&&(isDriveAutoFocus))
+                        {
+                            // PENTAX DSLR
+                            postData = "af=on";
+                        }
                         String result = SimpleHttpClient.httpPost(shootUrl, postData, timeoutMs);
                         if ((result == null)||(result.length() < 1))
                         {
index e1f5655..bc675b3 100644 (file)
@@ -49,6 +49,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     private final RicohGr2HardwareStatus hardwareStatus;
     private final RicohGr2RunMode runMode;
     private final boolean useGrCommand;
+    private final boolean pentaxCaptureAfterAf;
 
     private RicohGr2LiveViewControl liveViewControl;
     private RicohGr2CameraCaptureControl captureControl;
@@ -63,6 +64,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     {
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
         useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
+        pentaxCaptureAfterAf = preferences.getBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
 
         //this.activity = context;
         //this.provider = provider;
@@ -86,7 +88,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     {
         Log.v(TAG, "injectDisplay()");
         focusControl = new RicohGr2CameraFocusControl(useGrCommand, frameDisplayer, indicator);
-        captureControl = new RicohGr2CameraCaptureControl(useGrCommand, frameDisplayer, statusChecker);
+        captureControl = new RicohGr2CameraCaptureControl(useGrCommand, pentaxCaptureAfterAf, frameDisplayer, statusChecker);
     }
 
     @Override
index b2623ab..1d48db8 100644 (file)
@@ -38,6 +38,8 @@ public interface IPreferencePropertyAccessor
 
     String USE_GR2_SPECIAL_COMMAND = "use_gr2_special_command";
 
+    String PENTAX_CAPTURE_AFTER_AF = "pentax_capture_after_auto_focus";
+
     String DIGITAL_ZOOM_LEVEL = "digital_zoom_level";
     String DIGITAL_ZOOM_LEVEL_DEFAULT_VALUE = "1.0";
 
index 1a53214..90c3150 100644 (file)
@@ -149,6 +149,9 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar
         if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) {
             editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
         }
+        if (!items.containsKey(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF)) {
+            editor.putBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
+        }
         editor.apply();
     }
 
index 14a80b4..16ede36 100644 (file)
@@ -126,6 +126,9 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
             if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) {
                 editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
             }
+            if (!items.containsKey(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF)) {
+                editor.putBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
+            }
             editor.apply();
         }
         catch (Exception e)
@@ -182,6 +185,11 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
                     Log.v(TAG, " " + key + " , " + value);
                     break;
 
+                case IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF:
+                    value = preferences.getBoolean(key, false);
+                    Log.v(TAG, " " + key + " , " + value);
+                    break;
+
                 default:
                     String strValue = preferences.getString(key, "");
                     setListPreference(key, key, strValue);
@@ -337,6 +345,7 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
                         setBooleanPreference(IPreferencePropertyAccessor.GR2_LCD_SLEEP, IPreferencePropertyAccessor.GR2_LCD_SLEEP, defaultValue);
                         setBooleanPreference(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, IPreferencePropertyAccessor.SHARE_AFTER_SAVE, defaultValue);
                         setBooleanPreference(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, defaultValue);
+                        setBooleanPreference(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
                     }
                     catch (Exception e)
                     {
index 7a4018f..aa784f5 100644 (file)
@@ -43,6 +43,8 @@
     <string name="pref_gr2_display_mode">ディスプレイモード</string>
     <string name="pref_gr2_display_camera_view">ディスプレイミラーモード</string>
     <string name="pref_gr2_display_camera_view_summary">カメラのLCD画面をそのまま表示します。</string>
+    <string name="pref_pentax_capture_after_auto_focus">AF動作後に撮影(PENTAX)</string>
+    <string name="summary_pentax_capture_after_auto_focus">AF動作後に撮影します。(PENTAX DSLR, 再起動が必要)</string>
     <string name="pref_gr2_lcd_sleep">接続時にカメラのLCDをオフにする</string>
     <string name="pref_cat_camera">カメラ設定</string>
     <string name="pref_cat_initialize">起動時設定</string>
index f065027..f7e7036 100644 (file)
     <string name="pref_use_gr2_special_command">Use GR2 Special Command</string>
     <string name="summary_use_gr2_special_command">Use some GR2 special command.</string>
 
+    <string name="pref_pentax_capture_after_auto_focus">Capture after AF(PENTAX)</string>
+    <string name="summary_pentax_capture_after_auto_focus">Capture after AF.(for PENTAX DSLR, need restart)</string>
+
     <string name="dialog_confirm_title_output_log">Share debug log</string>
     <string name="dialog_confirm_message_output_log">Share the debug log, OK?</string>
 
index 0a2c468..f96ee3d 100644 (file)
             android:title="@string/pref_use_gr2_special_command"
             android:summary="@string/summary_use_gr2_special_command"
             />
+
+        <CheckBoxPreference
+            android:key="pentax_capture_after_auto_focus"
+            android:title="@string/pref_pentax_capture_after_auto_focus"
+            android:summary="@string/summary_pentax_capture_after_auto_focus"
+            />
+
     </PreferenceCategory>
 
     <PreferenceCategory