From 859e1612da889b33d2935d065f881a547f45e666 Mon Sep 17 00:00:00 2001 From: MRSa Date: Mon, 4 May 2020 21:56:40 +0900 Subject: [PATCH] =?utf8?q?GR2=E5=B0=82=E7=94=A8=E3=82=B3=E3=83=9E=E3=83=B3?= =?utf8?q?=E3=83=89=E3=82=92=E3=80=81GR2=E3=81=A8=E6=8E=A5=E7=B6=9A?= =?utf8?q?=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB=E3=81=A0=E3=81=91?= =?utf8?q?=E6=9C=89=E5=8A=B9=E3=81=AB=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E4=BB=95=E6=A7=98=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=97?= =?utf8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../operation/RicohGr2CameraCaptureControl.java | 13 +++-- .../operation/RicohGr2CameraFocusControl.java | 9 +++- .../takepicture/RicohGr2AutoFocusControl.java | 12 +++-- .../wrapper/RicohGr2InterfaceProvider.java | 58 +++++++++++++++++----- .../ricohgr2/wrapper/RicohGr2LiveViewControl.java | 12 +++-- .../ricohgr2/wrapper/RicohGr2StatusChecker.java | 15 +++--- .../wrapper/connection/IUseGR2CommandNotify.java | 6 +++ .../connection/RicohGr2CameraConnectSequence.java | 34 +++++++++---- .../wrapper/connection/RicohGr2Connection.java | 20 ++++++-- .../gr2control/playback/ImageGridViewFragment.java | 3 +- .../playback/detail/MyContentDownloader.java | 8 ++- .../preference/fuji_x/FujiXPreferenceFragment.java | 2 +- .../preference/olympus/PreferenceFragment.java | 2 +- .../ricohgr2/RicohGr2PreferenceFragment.java | 2 +- 14 files changed, 145 insertions(+), 51 deletions(-) create mode 100644 app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/IUseGR2CommandNotify.java diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java index bb4283d..b0e8d05 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java @@ -17,22 +17,27 @@ public class RicohGr2CameraCaptureControl implements ICaptureControl private final RicohGr2SingleShotControl singleShotControl; private final RicohGr2MovieShotControl movieShotControl; private final ICameraStatus cameraStatus; - private final boolean useGrCommand; private final boolean captureAfterAf; + private boolean useGR2command = false; + /** * * */ - public RicohGr2CameraCaptureControl(boolean useGrCommand, boolean captureAfterAf, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull ICameraStatus cameraStatus) + public RicohGr2CameraCaptureControl(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); } + public void setUseGR2Command(boolean useGR2command) + { + this.useGR2command = useGR2command; + } + /** * * @@ -48,7 +53,7 @@ public class RicohGr2CameraCaptureControl implements ICaptureControl } else { - singleShotControl.singleShot(useGrCommand, captureAfterAf); + singleShotControl.singleShot(useGR2command, captureAfterAf); } } catch (Exception e) diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java index cf5c811..ac9529b 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java @@ -25,10 +25,15 @@ public class RicohGr2CameraFocusControl implements IFocusingControl * * */ - public RicohGr2CameraFocusControl(boolean useGrCommand, @NonNull final IAutoFocusFrameDisplay frameDisplayer, @NonNull final IIndicatorControl indicator) + public RicohGr2CameraFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, @NonNull final IIndicatorControl indicator) { this.frameDisplay = frameDisplayer; - this.afControl = new RicohGr2AutoFocusControl(useGrCommand, frameDisplayer, indicator); + this.afControl = new RicohGr2AutoFocusControl(frameDisplayer, indicator); + } + + public void setUseGR2Command(boolean useGR2command) + { + afControl.setUseGR2Command(useGR2command); } /** diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java index 35c2bde..46a187d 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java @@ -21,21 +21,25 @@ public class RicohGr2AutoFocusControl private static final String TAG = RicohGr2AutoFocusControl.class.getSimpleName(); private final IIndicatorControl indicator; private final IAutoFocusFrameDisplay frameDisplayer; - private final boolean useGrCommand; private String autoFocusUrl = "http://192.168.0.1/v1/lens/focus"; private String lockAutoFocusUrl = "http://192.168.0.1/v1/lens/focus/lock"; private String unlockAutoFocusUrl = "http://192.168.0.1/v1/lens/focus/unlock"; private int timeoutMs = 6000; + private boolean useGR2command = false; /** * * */ - public RicohGr2AutoFocusControl(boolean useGrCommand, @NonNull final IAutoFocusFrameDisplay frameDisplayer, final IIndicatorControl indicator) + public RicohGr2AutoFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, final IIndicatorControl indicator) { this.frameDisplayer = frameDisplayer; this.indicator = indicator; - this.useGrCommand = useGrCommand; + } + + public void setUseGR2Command(boolean useGR2command) + { + this.useGR2command = useGR2command; } /** @@ -59,7 +63,7 @@ public class RicohGr2AutoFocusControl //int posX = (int) (Math.round(point.x * 100.0)); //int posY = (int) (Math.round(point.y * 100.0)); - String focusUrl = (useGrCommand) ? lockAutoFocusUrl : autoFocusUrl; + String focusUrl = (useGR2command) ? lockAutoFocusUrl : autoFocusUrl; String postData = "pos=" + ( (int) (Math.round(point.x * 100.0))) + "," + ((int) (Math.round(point.y * 100.0))); Log.v(TAG, "AF (" + postData + ")"); String result = SimpleHttpClient.httpPost(focusUrl, postData, timeoutMs); diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java index f14782b..75e57d0 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java @@ -1,6 +1,5 @@ package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper; -import android.app.Activity; import android.content.SharedPreferences; import android.util.Log; @@ -25,6 +24,7 @@ import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraCaptu import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraFocusControl; import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2CameraZoomLensControl; import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.RicohGr2HardwareStatus; +import net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper.connection.IUseGR2CommandNotify; import net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper.connection.RicohGr2Connection; import net.osdn.gokigen.gr2control.liveview.IAutoFocusFrameDisplay; import net.osdn.gokigen.gr2control.liveview.IIndicatorControl; @@ -32,13 +32,14 @@ import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener; import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor; import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; import androidx.preference.PreferenceManager; /** * * */ -public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, IDisplayInjector +public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, IDisplayInjector, IUseGR2CommandNotify { private final String TAG = toString(); //private final Activity activity; @@ -49,7 +50,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID private final RicohGr2PlaybackControl playbackControl; private final RicohGr2HardwareStatus hardwareStatus; private final RicohGr2RunMode runMode; - private final boolean useGrCommand; + //private final boolean useGrCommand; private final boolean pentaxCaptureAfterAf; private RicohGr2LiveViewControl liveViewControl; @@ -57,14 +58,16 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID private RicohGr2CameraZoomLensControl zoomControl; private RicohGr2CameraFocusControl focusControl; + private boolean useGR2Command = false; + private boolean useGR2CommandUpdated = false; + /** * * */ - public RicohGr2InterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider) + public RicohGr2InterfaceProvider(@NonNull FragmentActivity context, @NonNull ICameraStatusReceiver provider) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true); pentaxCaptureAfterAf = preferences.getBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false); int communicationTimeoutMs = 5000; // デフォルトは 5000ms とする try @@ -81,11 +84,11 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID } //this.activity = context; //this.provider = provider; - gr2Connection = new RicohGr2Connection(context, provider); - liveViewControl = new RicohGr2LiveViewControl(useGrCommand); + gr2Connection = new RicohGr2Connection(context, provider, this); + liveViewControl = new RicohGr2LiveViewControl(); zoomControl = new RicohGr2CameraZoomLensControl(); buttonControl = new RicohGr2CameraButtonControl(); - statusChecker = new RicohGr2StatusChecker(500, useGrCommand); + statusChecker = new RicohGr2StatusChecker(500); playbackControl = new RicohGr2PlaybackControl(communicationTimeoutMs); hardwareStatus = new RicohGr2HardwareStatus(); runMode = new RicohGr2RunMode(); @@ -100,8 +103,13 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify) { Log.v(TAG, "injectDisplay()"); - focusControl = new RicohGr2CameraFocusControl(useGrCommand, frameDisplayer, indicator); - captureControl = new RicohGr2CameraCaptureControl(useGrCommand, pentaxCaptureAfterAf, frameDisplayer, statusChecker); + focusControl = new RicohGr2CameraFocusControl(frameDisplayer, indicator); + captureControl = new RicohGr2CameraCaptureControl(pentaxCaptureAfterAf, frameDisplayer, statusChecker); + if (useGR2CommandUpdated) + { + captureControl.setUseGR2Command(useGR2Command); + focusControl.setUseGR2Command(useGR2Command); + } } @Override @@ -151,7 +159,8 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID } @Override - public IDisplayInjector getDisplayInjector() { + public IDisplayInjector getDisplayInjector() + { return (this); } @@ -168,7 +177,8 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID } @Override - public ICameraStatusWatcher getCameraStatusWatcher() { + public ICameraStatusWatcher getCameraStatusWatcher() + { return (statusChecker); } @@ -189,4 +199,28 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID { return (runMode); } + + @Override + public void setUseGR2Command(boolean useGR2Command) + { + try + { + this.useGR2Command = useGR2Command; + this.useGR2CommandUpdated = true; + statusChecker.setUseGR2Command(useGR2Command); + liveViewControl.setUseGR2Command(useGR2Command); + if (captureControl != null) + { + captureControl.setUseGR2Command(useGR2Command); + } + if (focusControl != null) + { + focusControl.setUseGR2Command(useGR2Command); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } } diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java index 2f52eea..abf3e03 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java @@ -18,20 +18,19 @@ public class RicohGr2LiveViewControl implements ILiveViewControl { private final String TAG = toString(); private final CameraLiveViewListenerImpl liveViewListener; - private final boolean useGrCommand; private String cameraDisplayUrl = "http://192.168.0.1/v1/display"; // カメラの画面をコピーする場合... private String liveViewUrl = "http://192.168.0.1/v1/liveview"; // 何も表示しない(ライブビューモード)の場合... private float cropScale = 1.0f; private boolean whileFetching = false; private static final int FETCH_ERROR_MAX = 30; + private boolean useGR2command = false; /** * * */ - RicohGr2LiveViewControl(boolean useGrControl) + RicohGr2LiveViewControl() { - this.useGrCommand = useGrControl; liveViewListener = new CameraLiveViewListenerImpl(); } @@ -42,6 +41,11 @@ public class RicohGr2LiveViewControl implements ILiveViewControl } */ + public void setUseGR2Command(boolean useGR2command) + { + this.useGR2command = useGR2command; + } + @Override public void changeLiveViewSize(String size) { @@ -51,7 +55,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl @Override public void startLiveView(final boolean useCameraScreen) { - final boolean isCameraScreen = useGrCommand && useCameraScreen; + final boolean isCameraScreen = useGR2command && useCameraScreen; Log.v(TAG, "startLiveView()"); try { diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java index 4b3de21..75d6eb7 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java @@ -24,22 +24,25 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatu private final String grCommandUrl = "http://192.168.0.1/_gr"; private final int sleepMs; - private final boolean useGrCommand; - private int timeoutMs = 5000; private boolean whileFetching = false; private RicohGr2StatusHolder statusHolder; + private boolean useGR2command = false; /** * * */ - RicohGr2StatusChecker(int sleepMs, boolean useGrCommand) + RicohGr2StatusChecker(int sleepMs) { - this.useGrCommand = useGrCommand; this.sleepMs = sleepMs; } + public void setUseGR2Command(boolean useGR2command) + { + this.useGR2command = useGR2command; + } + /** * * @@ -176,7 +179,7 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatu { String response; String postData = key + "=" + value; - if ((useGrCommand)&&(key.equals("exposureMode"))) + if ((useGR2command)&&(key.equals("exposureMode"))) { // 撮影モードを変更するときは、GR専用コマンドを送ることにする。 postData = "cmd=" + decideButtonCode(value); @@ -187,7 +190,7 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatu response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs); Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)"); } - if (useGrCommand) + if (useGR2command) { // GR専用コマンドで、画面表示をリフレッシュ response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs); diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/IUseGR2CommandNotify.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/IUseGR2CommandNotify.java new file mode 100644 index 0000000..15d7722 --- /dev/null +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/IUseGR2CommandNotify.java @@ -0,0 +1,6 @@ +package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper.connection; + +public interface IUseGR2CommandNotify +{ + void setUseGR2Command(boolean useGR2Command); +} diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2CameraConnectSequence.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2CameraConnectSequence.java index d79ef89..b6316a5 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2CameraConnectSequence.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2CameraConnectSequence.java @@ -19,13 +19,15 @@ class RicohGr2CameraConnectSequence implements Runnable private final Activity context; private final ICameraConnection cameraConnection; private final ICameraStatusReceiver cameraStatusReceiver; + private final IUseGR2CommandNotify gr2CommandNotify; - RicohGr2CameraConnectSequence(@NonNull Activity context, @NonNull ICameraStatusReceiver statusReceiver, @NonNull final ICameraConnection cameraConnection) + RicohGr2CameraConnectSequence(@NonNull Activity context, @NonNull ICameraStatusReceiver statusReceiver, @NonNull final ICameraConnection cameraConnection, @NonNull IUseGR2CommandNotify gr2CommandNotify) { Log.v(TAG, "RicohGr2CameraConnectSequence"); this.context = context; this.cameraConnection = cameraConnection; this.cameraStatusReceiver = statusReceiver; + this.gr2CommandNotify = gr2CommandNotify; } @Override @@ -42,19 +44,33 @@ class RicohGr2CameraConnectSequence implements Runnable { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); - // 接続時、レンズロックOFF + // 接続時、レンズロックOFF + GR2 コマンド有効/無効の確認 { 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)) - { - final String postData = "cmd=lcd sleep on"; - String response0 = SimpleHttpClient.httpPost(grCommandUrl, postData, TIMEOUT_MS); - Log.v(TAG, grCommandUrl + " " + response0); + // GR2 専用コマンドを受け付けられるかどうかで、Preference を書き換える + boolean enableGr2Command = (response0.length() > 0); + try + { + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, enableGr2Command); + editor.apply(); + } + catch (Exception e) + { + e.printStackTrace(); + } + gr2CommandNotify.setUseGR2Command(enableGr2Command); + + // 接続時、カメラの画面を消す + if ((enableGr2Command)&&(preferences.getBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false))) + { + final String postData0 = "cmd=lcd sleep on"; + String response1 = SimpleHttpClient.httpPost(grCommandUrl, postData0, TIMEOUT_MS); + Log.v(TAG, grCommandUrl + " " + response1); + } } onConnectNotify(); } diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2Connection.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2Connection.java index ca1ab4d..4bdbffd 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2Connection.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/connection/RicohGr2Connection.java @@ -33,6 +33,7 @@ public class RicohGr2Connection implements ICameraConnection private final Activity context; private final ICameraStatusReceiver statusReceiver; private final BroadcastReceiver connectionReceiver; + private final IUseGR2CommandNotify gr2CommandNotify; //private final ConnectivityManager connectivityManager; private final Executor cameraExecutor = Executors.newFixedThreadPool(1); //private final Handler networkConnectionTimeoutHandler; @@ -44,11 +45,12 @@ public class RicohGr2Connection implements ICameraConnection * * */ - public RicohGr2Connection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver) + public RicohGr2Connection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IUseGR2CommandNotify gr2CommandNotify) { Log.v(TAG, "RicohGr2Connection()"); this.context = context; this.statusReceiver = statusReceiver; + this.gr2CommandNotify = gr2CommandNotify; connectionReceiver = new BroadcastReceiver() { @Override @@ -87,17 +89,25 @@ public class RicohGr2Connection implements ICameraConnection WifiInfo info = wifiManager.getConnectionInfo(); if (wifiManager.isWifiEnabled() && info != null) { - if (info.getNetworkId() != -1) + if (info.getNetworkId() == -1) { Log.v(TAG, "Network ID is -1, there is no currently connected network."); } + else + { + Log.v(TAG, "Network ID is " + info.getNetworkId()); + } // 自動接続が指示されていた場合は、カメラとの接続処理を行う connectToCamera(); - } else { + } + else + { if (info == null) { Log.v(TAG, "NETWORK INFO IS NULL."); - } else { + } + else + { Log.v(TAG, "isWifiEnabled : " + wifiManager.isWifiEnabled() + " NetworkId : " + info.getNetworkId()); } } @@ -259,7 +269,7 @@ public class RicohGr2Connection implements ICameraConnection connectionStatus = CameraConnectionStatus.CONNECTING; try { - cameraExecutor.execute(new RicohGr2CameraConnectSequence(context, statusReceiver, this)); + cameraExecutor.execute(new RicohGr2CameraConnectSequence(context, statusReceiver, this, gr2CommandNotify)); } catch (Exception e) { diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java index d84f63b..a21f3bb 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java @@ -44,6 +44,7 @@ import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl; import net.osdn.gokigen.gr2control.playback.detail.ImageContentInfoEx; import net.osdn.gokigen.gr2control.playback.detail.ImagePagerViewFragment; import net.osdn.gokigen.gr2control.playback.detail.MyContentDownloader; +import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -181,7 +182,7 @@ public class ImageGridViewFragment extends Fragment implements ICameraRunModeCal SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext()); if (preferences != null) { - isShowActionBar = preferences.getBoolean("use_playback_menu", false); + isShowActionBar = preferences.getBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); } if (isShowActionBar) { diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/playback/detail/MyContentDownloader.java b/app/src/main/java/net/osdn/gokigen/gr2control/playback/detail/MyContentDownloader.java index 9b1d04b..263cdcd 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/playback/detail/MyContentDownloader.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/playback/detail/MyContentDownloader.java @@ -43,6 +43,7 @@ public class MyContentDownloader implements IDownloadContentCallback private static final String RAW_SUFFIX_1 = ".DNG"; private static final String RAW_SUFFIX_2 = ".ORF"; private static final String RAW_SUFFIX_3 = ".PEF"; + private static final String RAW_SUFFIX_4 = ".RAF"; private static final String MOVIE_SUFFIX = ".MOV"; private static final String JPEG_SUFFIX = ".JPG"; private ProgressDialog downloadDialog = null; @@ -99,6 +100,11 @@ public class MyContentDownloader implements IDownloadContentCallback mimeType = "image/x-pentax-pef"; isSmallSize = false; } + else if (targetFileName.toUpperCase().contains(RAW_SUFFIX_4)) + { + mimeType = "image/x-fuji-raf"; + isSmallSize = false; + } else if (targetFileName.toUpperCase().contains(MOVIE_SUFFIX)) { mimeType = "video/mp4"; @@ -196,7 +202,7 @@ public class MyContentDownloader implements IDownloadContentCallback outputStream.close(); outputStream = null; } - if ((!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_1))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_2))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_3))) + //if ((!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_1))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_2))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_3))) { // ギャラリーに受信したファイルを登録する long now = System.currentTimeMillis(); diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/fuji_x/FujiXPreferenceFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/fuji_x/FujiXPreferenceFragment.java index a4915cf..a636f55 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/preference/fuji_x/FujiXPreferenceFragment.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/preference/fuji_x/FujiXPreferenceFragment.java @@ -139,7 +139,7 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false); } if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) { - editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, false); + editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); } if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) { editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true); diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java index 021bffe..e1603f3 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java @@ -160,7 +160,7 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false); } if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) { - editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, false); + editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); } if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) { editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true); diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java index 66fcaab..77948da 100644 --- a/app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java +++ b/app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java @@ -140,7 +140,7 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false); } if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) { - editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, false); + editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); } if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) { editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true); -- 2.11.0