OPC(Olympus Air)用望遠鏡アプリ。
Revisión | 2040bae4eba5f669af299dcba3ca6a06ec8d2a8e (tree) |
---|---|
Tiempo | 2018-10-13 13:19:36 |
Autor | MRSa <mrsa@myad...> |
Commiter | MRSa |
PENTAX一眼の制御の仕込みを入れる。
@@ -1,5 +1,6 @@ | ||
1 | 1 | package net.osdn.gokigen.a01d.camera.ricohgr2.operation; |
2 | 2 | |
3 | +import android.content.Context; | |
3 | 4 | import android.graphics.PointF; |
4 | 5 | import android.support.annotation.NonNull; |
5 | 6 | import android.util.Log; |
@@ -16,10 +17,10 @@ public class RicohGr2CameraFocusControl implements IFocusingControl | ||
16 | 17 | private final RicohGr2AutoFocusControl afControl; |
17 | 18 | private final IAutoFocusFrameDisplay frameDisplay; |
18 | 19 | |
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) | |
20 | 21 | { |
21 | 22 | this.frameDisplay = frameDisplayer; |
22 | - this.afControl = new RicohGr2AutoFocusControl(frameDisplayer, indicator); | |
23 | + this.afControl = new RicohGr2AutoFocusControl(context, frameDisplayer, indicator); | |
23 | 24 | } |
24 | 25 | |
25 | 26 | @Override |
@@ -1,16 +1,24 @@ | ||
1 | 1 | package net.osdn.gokigen.a01d.camera.ricohgr2.operation.takepicture; |
2 | 2 | |
3 | +import android.content.Context; | |
4 | +import android.content.SharedPreferences; | |
3 | 5 | import android.graphics.PointF; |
4 | 6 | import android.graphics.RectF; |
7 | +import android.preference.PreferenceManager; | |
5 | 8 | import android.support.annotation.NonNull; |
6 | 9 | import android.util.Log; |
7 | 10 | |
8 | 11 | import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient; |
9 | 12 | import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay; |
10 | 13 | import net.osdn.gokigen.a01d.liveview.IIndicatorControl; |
14 | +import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor; | |
11 | 15 | |
12 | 16 | import org.json.JSONObject; |
13 | 17 | |
18 | +/** | |
19 | + * | |
20 | + * | |
21 | + */ | |
14 | 22 | public class RicohGr2AutoFocusControl |
15 | 23 | { |
16 | 24 | private static final String TAG = RicohGr2AutoFocusControl.class.getSimpleName(); |
@@ -22,10 +30,38 @@ public class RicohGr2AutoFocusControl | ||
22 | 30 | private int timeoutMs = 6000; |
23 | 31 | |
24 | 32 | |
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) | |
26 | 38 | { |
27 | 39 | this.frameDisplayer = frameDisplayer; |
28 | 40 | 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); | |
29 | 65 | } |
30 | 66 | |
31 | 67 | /** |
@@ -46,7 +46,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID | ||
46 | 46 | this.activity = context; |
47 | 47 | this.provider = provider; |
48 | 48 | gr2Connection = new RicohGr2Connection(context, provider); |
49 | - liveViewControl = new RicohGr2LiveViewControl(); | |
49 | + liveViewControl = new RicohGr2LiveViewControl(context); | |
50 | 50 | zoomControl = new RicohGr2CameraZoomLensControl(); |
51 | 51 | |
52 | 52 | } |
@@ -68,7 +68,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID | ||
68 | 68 | public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify) |
69 | 69 | { |
70 | 70 | Log.v(TAG, "injectDisplay()"); |
71 | - focusControl = new RicohGr2CameraFocusControl(frameDisplayer, indicator); | |
71 | + focusControl = new RicohGr2CameraFocusControl(activity, frameDisplayer, indicator); | |
72 | 72 | captureControl = new RicohGr2CameraCaptureControl(frameDisplayer); |
73 | 73 | } |
74 | 74 |
@@ -1,5 +1,8 @@ | ||
1 | 1 | package net.osdn.gokigen.a01d.camera.ricohgr2.wrapper; |
2 | 2 | |
3 | +import android.content.Context; | |
4 | +import android.content.SharedPreferences; | |
5 | +import android.preference.PreferenceManager; | |
3 | 6 | import android.support.annotation.NonNull; |
4 | 7 | import android.util.Log; |
5 | 8 |
@@ -8,6 +11,7 @@ import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient; | ||
8 | 11 | import net.osdn.gokigen.a01d.camera.utils.SimpleLiveviewSlicer; |
9 | 12 | import net.osdn.gokigen.a01d.liveview.liveviewlistener.CameraLiveViewListenerImpl; |
10 | 13 | import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener; |
14 | +import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor; | |
11 | 15 | |
12 | 16 | /** |
13 | 17 | * |
@@ -16,8 +20,9 @@ import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener; | ||
16 | 20 | public class RicohGr2LiveViewControl implements ILiveViewControl |
17 | 21 | { |
18 | 22 | private final String TAG = toString(); |
23 | + private final Context context; | |
19 | 24 | 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"; | |
21 | 26 | private float cropScale = 1.0f; |
22 | 27 | private boolean whileFetching = false; |
23 | 28 | private static final int FETCH_ERROR_MAX = 30; |
@@ -26,11 +31,36 @@ public class RicohGr2LiveViewControl implements ILiveViewControl | ||
26 | 31 | * |
27 | 32 | * |
28 | 33 | */ |
29 | - RicohGr2LiveViewControl() | |
34 | + RicohGr2LiveViewControl(final Context context) | |
30 | 35 | { |
36 | + this.context = context; | |
37 | + prepare(); | |
31 | 38 | liveViewListener = new CameraLiveViewListenerImpl(); |
32 | 39 | } |
33 | 40 | |
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 | + | |
34 | 64 | /* |
35 | 65 | public void setLiveViewAddress(@NonNull String address, @NonNull String page) |
36 | 66 | { |
@@ -49,6 +79,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl | ||
49 | 79 | public void startLiveView() |
50 | 80 | { |
51 | 81 | Log.v(TAG, "startLiveView()"); |
82 | + //prepare(); | |
52 | 83 | try |
53 | 84 | { |
54 | 85 | Thread thread = new Thread(new Runnable() |
@@ -81,7 +112,6 @@ public class RicohGr2LiveViewControl implements ILiveViewControl | ||
81 | 112 | |
82 | 113 | } |
83 | 114 | |
84 | - | |
85 | 115 | private void start(@NonNull final String streamUrl) |
86 | 116 | { |
87 | 117 | if (whileFetching) |
@@ -47,6 +47,8 @@ public interface IPreferencePropertyAccessor | ||
47 | 47 | String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0"; |
48 | 48 | |
49 | 49 | 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"; | |
50 | 52 | |
51 | 53 | /* |
52 | 54 | int CHOICE_SPLASH_SCREEN = 10; |
@@ -116,6 +116,12 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem | ||
116 | 116 | if (!items.containsKey(IPreferencePropertyAccessor.GR2_LCD_SLEEP)) { |
117 | 117 | editor.putBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false); |
118 | 118 | } |
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 | + } | |
119 | 125 | if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_MODE)) { |
120 | 126 | editor.putString(IPreferencePropertyAccessor.GR2_DISPLAY_MODE, IPreferencePropertyAccessor.GR2_DISPLAY_MODE_DEFAULT_VALUE); |
121 | 127 | } |
@@ -155,6 +161,16 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem | ||
155 | 161 | Log.v(TAG, " " + key + " , " + value); |
156 | 162 | break; |
157 | 163 | |
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 | + | |
158 | 174 | default: |
159 | 175 | String strValue = preferences.getString(key, ""); |
160 | 176 | setListPreference(key, key, strValue); |
@@ -319,7 +335,8 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem | ||
319 | 335 | setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, defaultValue); |
320 | 336 | setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue); |
321 | 337 | 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); | |
323 | 340 | } |
324 | 341 | catch (Exception e) |
325 | 342 | { |
@@ -101,7 +101,7 @@ | ||
101 | 101 | <string-array name="connection_method"> |
102 | 102 | <item >OPC (Olympus Air)</item> |
103 | 103 | <item >Sony</item> |
104 | - <item>Ricoh GR II</item> | |
104 | + <item>Ricoh GR II / PENTAX DSLR</item> | |
105 | 105 | </string-array> |
106 | 106 | |
107 | 107 | <string-array name="connection_method_value"> |
@@ -122,8 +122,15 @@ | ||
122 | 122 | <string name="camera_not_found">カメラ未発見</string> |
123 | 123 | <string name="pref_connection_method">接続方式</string> |
124 | 124 | <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> | |
126 | 129 | |
127 | 130 | <string name="dialog_confirm_title_output_log">ログの共有</string> |
128 | 131 | <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 | + | |
129 | 136 | </resources> |
@@ -102,7 +102,7 @@ | ||
102 | 102 | <string-array name="connection_method"> |
103 | 103 | <item >OPC (Olympus Air)</item> |
104 | 104 | <item >Sony</item> |
105 | - <item>Ricoh GR II</item> | |
105 | + <item>Ricoh GR II / PENTAX DSLR</item> | |
106 | 106 | </string-array> |
107 | 107 | |
108 | 108 | <string-array name="connection_method_value"> |
@@ -131,4 +131,11 @@ | ||
131 | 131 | |
132 | 132 | <string name="dialog_confirm_title_output_log">Share debug log</string> |
133 | 133 | <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 | + | |
134 | 141 | </resources> |
@@ -30,6 +30,16 @@ | ||
30 | 30 | android:title="@string/pref_cat_initialize"> |
31 | 31 | |
32 | 32 | <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 | |
33 | 43 | android:key="gr2_lcd_sleep" |
34 | 44 | android:title="@string/pref_gr2_lcd_sleep" /> |
35 | 45 |