• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

OPC(Olympus Air)用望遠鏡アプリ。


Commit MetaInfo

Révision2040bae4eba5f669af299dcba3ca6a06ec8d2a8e (tree)
l'heure2018-10-13 13:19:36
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

PENTAX一眼の制御の仕込みを入れる。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraFocusControl.java
@@ -1,5 +1,6 @@
11 package net.osdn.gokigen.a01d.camera.ricohgr2.operation;
22
3+import android.content.Context;
34 import android.graphics.PointF;
45 import android.support.annotation.NonNull;
56 import android.util.Log;
@@ -16,10 +17,10 @@ public class RicohGr2CameraFocusControl implements IFocusingControl
1617 private final RicohGr2AutoFocusControl afControl;
1718 private final IAutoFocusFrameDisplay frameDisplay;
1819
19- public RicohGr2CameraFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, @NonNull final IIndicatorControl indicator)
20+ public RicohGr2CameraFocusControl(@NonNull Context context, @NonNull final IAutoFocusFrameDisplay frameDisplayer, @NonNull final IIndicatorControl indicator)
2021 {
2122 this.frameDisplay = frameDisplayer;
22- this.afControl = new RicohGr2AutoFocusControl(frameDisplayer, indicator);
23+ this.afControl = new RicohGr2AutoFocusControl(context, frameDisplayer, indicator);
2324 }
2425
2526 @Override
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java
@@ -1,16 +1,24 @@
11 package net.osdn.gokigen.a01d.camera.ricohgr2.operation.takepicture;
22
3+import android.content.Context;
4+import android.content.SharedPreferences;
35 import android.graphics.PointF;
46 import android.graphics.RectF;
7+import android.preference.PreferenceManager;
58 import android.support.annotation.NonNull;
69 import android.util.Log;
710
811 import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
912 import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
1013 import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
14+import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
1115
1216 import org.json.JSONObject;
1317
18+/**
19+ *
20+ *
21+ */
1422 public class RicohGr2AutoFocusControl
1523 {
1624 private static final String TAG = RicohGr2AutoFocusControl.class.getSimpleName();
@@ -22,10 +30,38 @@ public class RicohGr2AutoFocusControl
2230 private int timeoutMs = 6000;
2331
2432
25- public RicohGr2AutoFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, final IIndicatorControl indicator)
33+ /**
34+ *
35+ *
36+ */
37+ public RicohGr2AutoFocusControl(@NonNull Context context, @NonNull final IAutoFocusFrameDisplay frameDisplayer, final IIndicatorControl indicator)
2638 {
2739 this.frameDisplayer = frameDisplayer;
2840 this.indicator = indicator;
41+
42+ prepare(context);
43+ }
44+
45+ /**
46+ *
47+ *
48+ */
49+ private void prepare(@NonNull Context context)
50+ {
51+ lockAutoFocusUrl = "http://192.168.0.1/v1/lens/focus/lock";
52+ try
53+ {
54+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
55+ if (preferences.getBoolean(IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS, false))
56+ {
57+ lockAutoFocusUrl = "http://192.168.0.1/v1/lens/focus";
58+ }
59+ }
60+ catch (Exception e)
61+ {
62+ e.printStackTrace();
63+ }
64+ Log.v(TAG, "FOCUS LOCK URL : " + lockAutoFocusUrl);
2965 }
3066
3167 /**
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
@@ -46,7 +46,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
4646 this.activity = context;
4747 this.provider = provider;
4848 gr2Connection = new RicohGr2Connection(context, provider);
49- liveViewControl = new RicohGr2LiveViewControl();
49+ liveViewControl = new RicohGr2LiveViewControl(context);
5050 zoomControl = new RicohGr2CameraZoomLensControl();
5151
5252 }
@@ -68,7 +68,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
6868 public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify)
6969 {
7070 Log.v(TAG, "injectDisplay()");
71- focusControl = new RicohGr2CameraFocusControl(frameDisplayer, indicator);
71+ focusControl = new RicohGr2CameraFocusControl(activity, frameDisplayer, indicator);
7272 captureControl = new RicohGr2CameraCaptureControl(frameDisplayer);
7373 }
7474
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java
@@ -1,5 +1,8 @@
11 package net.osdn.gokigen.a01d.camera.ricohgr2.wrapper;
22
3+import android.content.Context;
4+import android.content.SharedPreferences;
5+import android.preference.PreferenceManager;
36 import android.support.annotation.NonNull;
47 import android.util.Log;
58
@@ -8,6 +11,7 @@ import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
811 import net.osdn.gokigen.a01d.camera.utils.SimpleLiveviewSlicer;
912 import net.osdn.gokigen.a01d.liveview.liveviewlistener.CameraLiveViewListenerImpl;
1013 import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
14+import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
1115
1216 /**
1317 *
@@ -16,8 +20,9 @@ import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
1620 public class RicohGr2LiveViewControl implements ILiveViewControl
1721 {
1822 private final String TAG = toString();
23+ private final Context context;
1924 private final CameraLiveViewListenerImpl liveViewListener;
20- private String liveViewUrl = "http://192.168.0.1/v1/display";
25+ private String liveViewUrl = "http://192.168.0.1/v1/display"; // "http://192.168.0.1/v1/liveview";
2126 private float cropScale = 1.0f;
2227 private boolean whileFetching = false;
2328 private static final int FETCH_ERROR_MAX = 30;
@@ -26,11 +31,36 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
2631 *
2732 *
2833 */
29- RicohGr2LiveViewControl()
34+ RicohGr2LiveViewControl(final Context context)
3035 {
36+ this.context = context;
37+ prepare();
3138 liveViewListener = new CameraLiveViewListenerImpl();
3239 }
3340
41+ /**
42+ *
43+ *
44+ */
45+ private void prepare()
46+ {
47+ liveViewUrl = "http://192.168.0.1/v1/display";
48+ try
49+ {
50+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
51+ if (!(preferences.getBoolean(IPreferencePropertyAccessor.GR2_LIVE_VIEW, true)))
52+ {
53+ liveViewUrl = "http://192.168.0.1/v1/liveview";
54+ }
55+ }
56+ catch (Exception e)
57+ {
58+ e.printStackTrace();
59+ }
60+ Log.v(TAG, "LIVE VIEW URL : " + liveViewUrl);
61+ }
62+
63+
3464 /*
3565 public void setLiveViewAddress(@NonNull String address, @NonNull String page)
3666 {
@@ -49,6 +79,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
4979 public void startLiveView()
5080 {
5181 Log.v(TAG, "startLiveView()");
82+ //prepare();
5283 try
5384 {
5485 Thread thread = new Thread(new Runnable()
@@ -81,7 +112,6 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
81112
82113 }
83114
84-
85115 private void start(@NonNull final String streamUrl)
86116 {
87117 if (whileFetching)
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
@@ -47,6 +47,8 @@ public interface IPreferencePropertyAccessor
4747 String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
4848
4949 String GR2_LCD_SLEEP = "gr2_lcd_sleep";
50+ String GR2_LIVE_VIEW = "gr2_display_camera_view";
51+ String USE_PENTAX_AUTOFOCUS = "use_pentax_autofocus_mode";
5052
5153 /*
5254 int CHOICE_SPLASH_SCREEN = 10;
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/ricohgr2/RicohGr2PreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/ricohgr2/RicohGr2PreferenceFragment.java
@@ -116,6 +116,12 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem
116116 if (!items.containsKey(IPreferencePropertyAccessor.GR2_LCD_SLEEP)) {
117117 editor.putBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false);
118118 }
119+ if (!items.containsKey(IPreferencePropertyAccessor.GR2_LIVE_VIEW)) {
120+ editor.putBoolean(IPreferencePropertyAccessor.GR2_LIVE_VIEW, true);
121+ }
122+ if (!items.containsKey(IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS)) {
123+ editor.putBoolean(IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS, false);
124+ }
119125 if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_MODE)) {
120126 editor.putString(IPreferencePropertyAccessor.GR2_DISPLAY_MODE, IPreferencePropertyAccessor.GR2_DISPLAY_MODE_DEFAULT_VALUE);
121127 }
@@ -155,6 +161,16 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem
155161 Log.v(TAG, " " + key + " , " + value);
156162 break;
157163
164+ case IPreferencePropertyAccessor.GR2_LIVE_VIEW:
165+ value = preferences.getBoolean(key, true);
166+ Log.v(TAG, " " + key + " , " + value);
167+ break;
168+
169+ case IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS:
170+ value = preferences.getBoolean(key, false);
171+ Log.v(TAG, " " + key + " , " + value);
172+ break;
173+
158174 default:
159175 String strValue = preferences.getString(key, "");
160176 setListPreference(key, key, strValue);
@@ -319,7 +335,8 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem
319335 setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, defaultValue);
320336 setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue);
321337 setBooleanPreference(IPreferencePropertyAccessor.GR2_LCD_SLEEP, IPreferencePropertyAccessor.GR2_LCD_SLEEP, defaultValue);
322-
338+ setBooleanPreference(IPreferencePropertyAccessor.GR2_LIVE_VIEW, IPreferencePropertyAccessor.GR2_LIVE_VIEW, defaultValue);
339+ setBooleanPreference(IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS, IPreferencePropertyAccessor.USE_PENTAX_AUTOFOCUS, false);
323340 }
324341 catch (Exception e)
325342 {
--- a/app/src/main/res/values-ja/arrays.xml
+++ b/app/src/main/res/values-ja/arrays.xml
@@ -101,7 +101,7 @@
101101 <string-array name="connection_method">
102102 <item >OPC (Olympus Air)</item>
103103 <item >Sony</item>
104- <item>Ricoh GR II</item>
104+ <item>Ricoh GR II / PENTAX DSLR</item>
105105 </string-array>
106106
107107 <string-array name="connection_method_value">
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -122,8 +122,15 @@
122122 <string name="camera_not_found">カメラ未発見</string>
123123 <string name="pref_connection_method">接続方式</string>
124124 <string name="pref_gr2_display_mode">ディスプレイモード</string>
125- <string name="pref_gr2_lcd_sleep">接続中はカメラ画面OFF</string>
125+ <string name="pref_gr2_lcd_sleep">接続中はカメラ画面OFF(GR2専用)</string>
126+
127+ <string name="pref_gr2_display_camera_view">ディスプレイミラーモード</string>
128+ <string name="pref_gr2_display_camera_view_summary">カメラのLCD画面をそのまま表示します。(GR2専用)</string>
126129
127130 <string name="dialog_confirm_title_output_log">ログの共有</string>
128131 <string name="dialog_confirm_message_output_log">デバッグログを共有します。</string>
132+
133+ <string name="pref_use_pentax_autofocus">PENTAX一眼タッチフォーカス</string>
134+ <string name="pref_use_pentax_autofocus_summary">タッチフォーカスでPENTAX一眼命令を使います。</string>
135+
129136 </resources>
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -102,7 +102,7 @@
102102 <string-array name="connection_method">
103103 <item >OPC (Olympus Air)</item>
104104 <item >Sony</item>
105- <item>Ricoh GR II</item>
105+ <item>Ricoh GR II / PENTAX DSLR</item>
106106 </string-array>
107107
108108 <string-array name="connection_method_value">
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -131,4 +131,11 @@
131131
132132 <string name="dialog_confirm_title_output_log">Share debug log</string>
133133 <string name="dialog_confirm_message_output_log">Share the debug log, OK?</string>
134+
135+ <string name="pref_gr2_display_camera_view">Mirror Camera Screen</string>
136+ <string name="pref_gr2_display_camera_view_summary">Use same camera screen.</string>
137+
138+ <string name="pref_use_pentax_autofocus">PENTAX DSLR Touch focus control.</string>
139+ <string name="pref_use_pentax_autofocus_summary">Do use a PENTAX DSLR Control for touch focus command.</string>
140+
134141 </resources>
--- a/app/src/main/res/xml/preferences_ricoh_gr2.xml
+++ b/app/src/main/res/xml/preferences_ricoh_gr2.xml
@@ -30,6 +30,16 @@
3030 android:title="@string/pref_cat_initialize">
3131
3232 <CheckBoxPreference
33+ android:key="use_pentax_autofocus_mode"
34+ android:title="@string/pref_use_pentax_autofocus"
35+ android:summary="@string/pref_use_pentax_autofocus_summary"/>
36+
37+ <CheckBoxPreference
38+ android:key="gr2_display_camera_view"
39+ android:title="@string/pref_gr2_display_camera_view"
40+ android:summary="@string/pref_gr2_display_camera_view_summary"/>
41+
42+ <CheckBoxPreference
3343 android:key="gr2_lcd_sleep"
3444 android:title="@string/pref_gr2_lcd_sleep" />
3545
Afficher sur ancien navigateur de dépôt.