Ricoh GR2 Control App for Android.
Revision | 78871207d0817480796d556e61e4b953292ec8b8 (tree) |
---|---|
Zeit | 2020-05-05 20:54:15 |
Autor | MRSa <mrsa@myad...> |
Commiter | MRSa |
Preferenceを階層化して整理。
@@ -132,7 +132,7 @@ class LiveViewClickTouchListener implements View.OnClickListener, View.OnTouchLi | ||
132 | 132 | |
133 | 133 | case R.id.show_preference_button: |
134 | 134 | // カメラの設定 |
135 | - changeScene.changeSceneToConfiguration(); | |
135 | + changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.UNKNOWN); | |
136 | 136 | isVibrate = true; |
137 | 137 | break; |
138 | 138 |
@@ -0,0 +1,437 @@ | ||
1 | +package net.osdn.gokigen.gr2control.preference; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.content.Intent; | |
5 | +import android.content.SharedPreferences; | |
6 | +import android.os.Bundle; | |
7 | +import android.provider.Settings; | |
8 | +import android.util.Log; | |
9 | + | |
10 | +import net.osdn.gokigen.gr2control.R; | |
11 | +import net.osdn.gokigen.gr2control.camera.ICameraConnection; | |
12 | +import net.osdn.gokigen.gr2control.logcat.LogCatViewer; | |
13 | +import net.osdn.gokigen.gr2control.scene.IChangeScene; | |
14 | + | |
15 | +import java.util.Map; | |
16 | + | |
17 | +import androidx.annotation.NonNull; | |
18 | +import androidx.appcompat.app.AppCompatActivity; | |
19 | +import androidx.fragment.app.FragmentActivity; | |
20 | +import androidx.preference.CheckBoxPreference; | |
21 | +import androidx.preference.ListPreference; | |
22 | +import androidx.preference.Preference; | |
23 | +import androidx.preference.PreferenceFragmentCompat; | |
24 | +import androidx.preference.PreferenceManager; | |
25 | + | |
26 | +public class Gr2ControlPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener | |
27 | +{ | |
28 | + private final String TAG = toString(); | |
29 | + private IChangeScene changeScene = null; | |
30 | + private AppCompatActivity context = null; | |
31 | + private SharedPreferences preferences = null; | |
32 | + private LogCatViewer logCatViewer = null; | |
33 | + | |
34 | + /** | |
35 | + * | |
36 | + * | |
37 | + */ | |
38 | + public static Gr2ControlPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene) | |
39 | + { | |
40 | + Gr2ControlPreferenceFragment instance = new Gr2ControlPreferenceFragment(); | |
41 | + instance.prepare(context, changeScene); | |
42 | + | |
43 | + // パラメータはBundleにまとめておく | |
44 | + Bundle arguments = new Bundle(); | |
45 | + //arguments.putString("title", title); | |
46 | + //arguments.putString("message", message); | |
47 | + instance.setArguments(arguments); | |
48 | + | |
49 | + return (instance); | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * | |
54 | + * | |
55 | + */ | |
56 | + private void prepare(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene) | |
57 | + { | |
58 | + try | |
59 | + { | |
60 | + logCatViewer = new LogCatViewer(changeScene); | |
61 | + logCatViewer.prepare(); | |
62 | + this.changeScene = changeScene; | |
63 | + this.context = context; | |
64 | + } | |
65 | + catch (Exception e) | |
66 | + { | |
67 | + e.printStackTrace(); | |
68 | + } | |
69 | + } | |
70 | + | |
71 | + /** | |
72 | + * | |
73 | + * | |
74 | + */ | |
75 | + @Override | |
76 | + public void onAttach(@NonNull Context activity) | |
77 | + { | |
78 | + super.onAttach(activity); | |
79 | + Log.v(TAG, " onAttach()"); | |
80 | + try | |
81 | + { | |
82 | + // Preference をつかまえる | |
83 | + preferences = PreferenceManager.getDefaultSharedPreferences(activity); | |
84 | + | |
85 | + // Preference を初期設定する | |
86 | + initializePreferences(); | |
87 | + | |
88 | + preferences.registerOnSharedPreferenceChangeListener(this); | |
89 | + } | |
90 | + catch (Exception e) | |
91 | + { | |
92 | + e.printStackTrace(); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * Preferenceの初期化... | |
98 | + * | |
99 | + */ | |
100 | + private void initializePreferences() | |
101 | + { | |
102 | + try | |
103 | + { | |
104 | + Map<String, ?> items = preferences.getAll(); | |
105 | + SharedPreferences.Editor editor = preferences.edit(); | |
106 | + | |
107 | + if (!items.containsKey(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT)) | |
108 | + { | |
109 | + editor.putString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE); | |
110 | + } | |
111 | + if (!items.containsKey(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY)) | |
112 | + { | |
113 | + editor.putString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE); | |
114 | + } | |
115 | + if (!items.containsKey(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL)) | |
116 | + { | |
117 | + editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE); | |
118 | + } | |
119 | + if (!items.containsKey(IPreferencePropertyAccessor.RAW)) | |
120 | + { | |
121 | + editor.putBoolean(IPreferencePropertyAccessor.RAW, true); | |
122 | + } | |
123 | + if (!items.containsKey(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA)) | |
124 | + { | |
125 | + editor.putBoolean(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true); | |
126 | + } | |
127 | + if (!items.containsKey(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW)) | |
128 | + { | |
129 | + editor.putBoolean(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, false); | |
130 | + } | |
131 | + if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD)) | |
132 | + { | |
133 | + editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE); | |
134 | + } | |
135 | + if (!items.containsKey(IPreferencePropertyAccessor.SHARE_AFTER_SAVE)) { | |
136 | + editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false); | |
137 | + } | |
138 | + if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) { | |
139 | + editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); | |
140 | + } | |
141 | + if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) { | |
142 | + editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true); | |
143 | + } | |
144 | + if (!items.containsKey(IPreferencePropertyAccessor.GR2_LCD_SLEEP)) { | |
145 | + editor.putBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false); | |
146 | + } | |
147 | + if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) { | |
148 | + editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true); | |
149 | + } | |
150 | + if (!items.containsKey(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF)) { | |
151 | + editor.putBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false); | |
152 | + } | |
153 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW)) { | |
154 | + editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW, false); | |
155 | + } | |
156 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_FOCUS_XY)) { | |
157 | + editor.putString(IPreferencePropertyAccessor.FUJI_X_FOCUS_XY, IPreferencePropertyAccessor.FUJI_X_FOCUS_XY_DEFAULT_VALUE); | |
158 | + } | |
159 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT)) { | |
160 | + editor.putString(IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT, IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT_DEFAULT_VALUE); | |
161 | + } | |
162 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) { | |
163 | + editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE); | |
164 | + } | |
165 | + editor.apply(); | |
166 | + } | |
167 | + catch (Exception e) | |
168 | + { | |
169 | + e.printStackTrace(); | |
170 | + } | |
171 | + } | |
172 | + | |
173 | + /** | |
174 | + * | |
175 | + * | |
176 | + */ | |
177 | + @Override | |
178 | + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) | |
179 | + { | |
180 | + Log.v(TAG, " onSharedPreferenceChanged() : " + key); | |
181 | + boolean value; | |
182 | + if (key != null) | |
183 | + { | |
184 | + switch (key) | |
185 | + { | |
186 | + case IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA: | |
187 | + value = preferences.getBoolean(key, true); | |
188 | + Log.v(TAG, " " + key + " , " + value); | |
189 | + break; | |
190 | + | |
191 | + case IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW: | |
192 | + value = preferences.getBoolean(key, false); | |
193 | + Log.v(TAG, " BOTH LV : " + key + " , " + value); | |
194 | + break; | |
195 | + | |
196 | + case IPreferencePropertyAccessor.USE_PLAYBACK_MENU: | |
197 | + value = preferences.getBoolean(key, true); | |
198 | + Log.v(TAG, " PLAYBACK MENU : " + key + " , " + value); | |
199 | + break; | |
200 | + | |
201 | + case IPreferencePropertyAccessor.SHARE_AFTER_SAVE: | |
202 | + value = preferences.getBoolean(key, false); | |
203 | + Log.v(TAG, " SHARE : " + key + " , " + value); | |
204 | + break; | |
205 | + | |
206 | + default: | |
207 | + String strValue = preferences.getString(key, ""); | |
208 | + setListPreference(key, key, strValue); | |
209 | + break; | |
210 | + } | |
211 | + } | |
212 | + } | |
213 | + | |
214 | + /** | |
215 | + * | |
216 | + * | |
217 | + */ | |
218 | + @Override | |
219 | + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) | |
220 | + { | |
221 | + Log.v(TAG, " onCreatePreferences()"); | |
222 | + try | |
223 | + { | |
224 | + //super.onCreate(savedInstanceState); | |
225 | + addPreferencesFromResource(R.xml.preferences_summary); | |
226 | + | |
227 | + ListPreference connectionMethod = findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD); | |
228 | + if (connectionMethod != null) | |
229 | + { | |
230 | + connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { | |
231 | + @Override | |
232 | + public boolean onPreferenceChange(Preference preference, Object newValue) { | |
233 | + preference.setSummary(newValue + " "); | |
234 | + return (true); | |
235 | + } | |
236 | + }); | |
237 | + connectionMethod.setSummary(connectionMethod.getValue() + " "); | |
238 | + } | |
239 | + | |
240 | + Preference opcPreference = findPreference("opc_settings"); | |
241 | + if (opcPreference != null) | |
242 | + { | |
243 | + opcPreference.setOnPreferenceClickListener(this); | |
244 | + } | |
245 | + Preference gr2Preference = findPreference("ricoh_settings"); | |
246 | + if (gr2Preference != null) | |
247 | + { | |
248 | + gr2Preference.setOnPreferenceClickListener(this); | |
249 | + } | |
250 | + Preference fujiXPreference = findPreference("fuji_x_settings"); | |
251 | + if (fujiXPreference != null) | |
252 | + { | |
253 | + fujiXPreference.setOnPreferenceClickListener(this); | |
254 | + } | |
255 | + | |
256 | + Preference debug = findPreference("debug_info"); | |
257 | + if (debug != null) | |
258 | + { | |
259 | + debug.setOnPreferenceClickListener(logCatViewer); | |
260 | + } | |
261 | + | |
262 | + Preference wifi = findPreference("wifi_settings"); | |
263 | + if (wifi != null) | |
264 | + { | |
265 | + wifi.setOnPreferenceClickListener(this); | |
266 | + } | |
267 | + } | |
268 | + catch (Exception e) | |
269 | + { | |
270 | + e.printStackTrace(); | |
271 | + } | |
272 | + } | |
273 | + | |
274 | + /** | |
275 | + * | |
276 | + * | |
277 | + */ | |
278 | + @Override | |
279 | + public void onResume() | |
280 | + { | |
281 | + super.onResume(); | |
282 | + Log.v(TAG, " onResume() Start"); | |
283 | + try | |
284 | + { | |
285 | + synchronizedProperty(); | |
286 | + } | |
287 | + catch (Exception e) | |
288 | + { | |
289 | + e.printStackTrace(); | |
290 | + } | |
291 | + | |
292 | + Log.v(TAG, " onResume() End"); | |
293 | + } | |
294 | + | |
295 | + /** | |
296 | + * | |
297 | + * | |
298 | + */ | |
299 | + @Override | |
300 | + public void onPause() | |
301 | + { | |
302 | + super.onPause(); | |
303 | + Log.v(TAG, " onPause() Start"); | |
304 | + try | |
305 | + { | |
306 | + // Preference変更のリスナを解除 | |
307 | + preferences.unregisterOnSharedPreferenceChangeListener(this); | |
308 | + } | |
309 | + catch (Exception e) | |
310 | + { | |
311 | + e.printStackTrace(); | |
312 | + } | |
313 | + | |
314 | + Log.v(TAG, " onPause() End"); | |
315 | + } | |
316 | + | |
317 | + /** | |
318 | + * ListPreference の表示データを設定 | |
319 | + * | |
320 | + * @param pref_key Preference(表示)のキー | |
321 | + * @param key Preference(データ)のキー | |
322 | + * @param defaultValue Preferenceのデフォルト値 | |
323 | + */ | |
324 | + private void setListPreference(String pref_key, String key, String defaultValue) | |
325 | + { | |
326 | + try | |
327 | + { | |
328 | + ListPreference pref; | |
329 | + pref = findPreference(pref_key); | |
330 | + String value = preferences.getString(key, defaultValue); | |
331 | + if (pref != null) | |
332 | + { | |
333 | + pref.setValue(value); | |
334 | + pref.setSummary(value); | |
335 | + } | |
336 | + } | |
337 | + catch (Exception e) | |
338 | + { | |
339 | + e.printStackTrace(); | |
340 | + } | |
341 | + } | |
342 | + | |
343 | + /** | |
344 | + * BooleanPreference の表示データを設定 | |
345 | + * | |
346 | + * @param pref_key Preference(表示)のキー | |
347 | + * @param key Preference(データ)のキー | |
348 | + * @param defaultValue Preferenceのデフォルト値 | |
349 | + */ | |
350 | + private void setBooleanPreference(String pref_key, String key, boolean defaultValue) | |
351 | + { | |
352 | + try | |
353 | + { | |
354 | + CheckBoxPreference pref = findPreference(pref_key); | |
355 | + if (pref != null) | |
356 | + { | |
357 | + boolean value = preferences.getBoolean(key, defaultValue); | |
358 | + pref.setChecked(value); | |
359 | + } | |
360 | + } | |
361 | + catch (Exception e) | |
362 | + { | |
363 | + e.printStackTrace(); | |
364 | + } | |
365 | + } | |
366 | + | |
367 | + /** | |
368 | + * | |
369 | + * | |
370 | + */ | |
371 | + private void synchronizedProperty() | |
372 | + { | |
373 | + final FragmentActivity activity = getActivity(); | |
374 | + if (activity != null) | |
375 | + { | |
376 | + activity.runOnUiThread(new Runnable() { | |
377 | + @Override | |
378 | + public void run() { | |
379 | + try | |
380 | + { | |
381 | + // Preferenceの画面に反映させる | |
382 | + setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true); | |
383 | + setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, false); | |
384 | + setBooleanPreference(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true); | |
385 | + setBooleanPreference(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false); | |
386 | + } | |
387 | + catch (Exception e) | |
388 | + { | |
389 | + e.printStackTrace(); | |
390 | + } | |
391 | + } | |
392 | + }); | |
393 | + } | |
394 | + } | |
395 | + | |
396 | + | |
397 | + @Override | |
398 | + public boolean onPreferenceClick(Preference preference) | |
399 | + { | |
400 | + try | |
401 | + { | |
402 | + String preferenceKey = preference.getKey(); | |
403 | + Log.v(TAG, " onPreferenceClick() : " + preferenceKey); | |
404 | + if (preferenceKey.contains("wifi_settings")) | |
405 | + { | |
406 | + // Wifi 設定画面を表示する | |
407 | + Log.v(TAG, " onPreferenceClick : " + preferenceKey); | |
408 | + if (context != null) | |
409 | + { | |
410 | + context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); | |
411 | + } | |
412 | + } | |
413 | + else if (preferenceKey.contains("ricoh_settings")) | |
414 | + { | |
415 | + changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.RICOH_GR2); | |
416 | + } | |
417 | + else if (preferenceKey.contains("fuji_x_settings")) | |
418 | + { | |
419 | + changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.FUJI_X); | |
420 | + } | |
421 | + else if (preferenceKey.contains("opc_settings")) | |
422 | + { | |
423 | + changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.OPC); | |
424 | + } | |
425 | + else | |
426 | + { | |
427 | + return (false); | |
428 | + } | |
429 | + return (true); | |
430 | + } | |
431 | + catch (Exception e) | |
432 | + { | |
433 | + e.printStackTrace(); | |
434 | + } | |
435 | + return (false); | |
436 | + } | |
437 | +} |
@@ -9,6 +9,7 @@ import net.osdn.gokigen.gr2control.camera.IInterfaceProvider; | ||
9 | 9 | import net.osdn.gokigen.gr2control.liveview.IStatusViewDrawer; |
10 | 10 | import net.osdn.gokigen.gr2control.logcat.LogCatFragment; |
11 | 11 | import net.osdn.gokigen.gr2control.playback.ImageGridViewFragment; |
12 | +import net.osdn.gokigen.gr2control.preference.Gr2ControlPreferenceFragment; | |
12 | 13 | import net.osdn.gokigen.gr2control.preference.fuji_x.FujiXPreferenceFragment; |
13 | 14 | import net.osdn.gokigen.gr2control.preference.olympus.PreferenceFragment; |
14 | 15 | import net.osdn.gokigen.gr2control.preference.ricohgr2.RicohGr2PreferenceFragment; |
@@ -30,6 +31,10 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene | ||
30 | 31 | private IStatusViewDrawer statusViewDrawer; |
31 | 32 | |
32 | 33 | private PreferenceFragmentCompat preferenceFragment = null; |
34 | + private PreferenceFragmentCompat preferenceFragmentOpc = null; | |
35 | + private PreferenceFragmentCompat preferenceFragmentRicoh = null; | |
36 | + private PreferenceFragmentCompat preferenceFragmentFujiX = null; | |
37 | + | |
33 | 38 | private LogCatFragment logCatFragment = null; |
34 | 39 | private ImageGridViewFragment imageGridViewFragment = null; |
35 | 40 |
@@ -194,37 +199,41 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene | ||
194 | 199 | |
195 | 200 | // IChangeScene |
196 | 201 | @Override |
197 | - public void changeSceneToConfiguration() | |
202 | + public void changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod connectionMethod) | |
198 | 203 | { |
199 | 204 | try |
200 | 205 | { |
201 | - if (preferenceFragment == null) | |
206 | + if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2) | |
202 | 207 | { |
203 | - try | |
204 | - { | |
205 | - //preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this); | |
206 | - ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod(); | |
207 | - if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2) { | |
208 | - preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this); | |
209 | - //} else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY) { | |
210 | - // preferenceFragment = SonyPreferenceFragment.newInstance(this, this); | |
211 | - } | |
212 | - else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X) | |
213 | - { | |
214 | - preferenceFragment = FujiXPreferenceFragment.newInstance(activity, this); | |
215 | - } | |
216 | - else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC) | |
217 | - { | |
218 | - preferenceFragment = PreferenceFragment.newInstance(activity, interfaceProvider, this); | |
219 | - } | |
220 | - } | |
221 | - catch (Exception e) | |
222 | - { | |
223 | - e.printStackTrace(); | |
224 | - //preferenceFragment = SonyPreferenceFragment.newInstance(this, this); | |
225 | - } | |
208 | + changeSceneToRicohConfiguration(); | |
209 | + } | |
210 | + else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X) | |
211 | + { | |
212 | + changeSceneToFujiXConfiguration(); | |
213 | + } | |
214 | + else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC) | |
215 | + { | |
216 | + changeSceneToOpcConfiguration(); | |
226 | 217 | } |
218 | + else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.UNKNOWN) | |
219 | + { | |
220 | + changeSceneToSummaryConfiguration(); | |
221 | + } | |
222 | + } | |
223 | + catch (Exception e) | |
224 | + { | |
225 | + e.printStackTrace(); | |
226 | + } | |
227 | + } | |
227 | 228 | |
229 | + private void changeSceneToSummaryConfiguration() | |
230 | + { | |
231 | + try | |
232 | + { | |
233 | + if (preferenceFragment == null) | |
234 | + { | |
235 | + preferenceFragment = Gr2ControlPreferenceFragment.newInstance(activity, this); | |
236 | + } | |
228 | 237 | FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction(); |
229 | 238 | transaction.replace(R.id.fragment1, preferenceFragment); |
230 | 239 | // backstackに追加 |
@@ -237,6 +246,66 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene | ||
237 | 246 | } |
238 | 247 | } |
239 | 248 | |
249 | + private void changeSceneToOpcConfiguration() | |
250 | + { | |
251 | + try | |
252 | + { | |
253 | + if (preferenceFragmentOpc == null) | |
254 | + { | |
255 | + preferenceFragmentOpc = PreferenceFragment.newInstance(activity, interfaceProvider, this); | |
256 | + } | |
257 | + FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction(); | |
258 | + transaction.replace(R.id.fragment1, preferenceFragmentOpc); | |
259 | + // backstackに追加 | |
260 | + transaction.addToBackStack(null); | |
261 | + transaction.commit(); | |
262 | + } | |
263 | + catch (Exception e) | |
264 | + { | |
265 | + e.printStackTrace(); | |
266 | + } | |
267 | + } | |
268 | + | |
269 | + private void changeSceneToRicohConfiguration() | |
270 | + { | |
271 | + try | |
272 | + { | |
273 | + if (preferenceFragmentRicoh == null) | |
274 | + { | |
275 | + preferenceFragmentRicoh = RicohGr2PreferenceFragment.newInstance(activity, this); | |
276 | + } | |
277 | + FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction(); | |
278 | + transaction.replace(R.id.fragment1, preferenceFragmentRicoh); | |
279 | + // backstackに追加 | |
280 | + transaction.addToBackStack(null); | |
281 | + transaction.commit(); | |
282 | + } | |
283 | + catch (Exception e) | |
284 | + { | |
285 | + e.printStackTrace(); | |
286 | + } | |
287 | + } | |
288 | + | |
289 | + private void changeSceneToFujiXConfiguration() | |
290 | + { | |
291 | + try | |
292 | + { | |
293 | + if (preferenceFragmentFujiX == null) | |
294 | + { | |
295 | + preferenceFragmentFujiX = FujiXPreferenceFragment.newInstance(activity, this); | |
296 | + } | |
297 | + FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction(); | |
298 | + transaction.replace(R.id.fragment1, preferenceFragmentFujiX); | |
299 | + // backstackに追加 | |
300 | + transaction.addToBackStack(null); | |
301 | + transaction.commit(); | |
302 | + } | |
303 | + catch (Exception e) | |
304 | + { | |
305 | + e.printStackTrace(); | |
306 | + } | |
307 | + } | |
308 | + | |
240 | 309 | // IChangeScene |
241 | 310 | @Override |
242 | 311 | public void changeCameraConnection() |
@@ -1,12 +1,14 @@ | ||
1 | 1 | package net.osdn.gokigen.gr2control.scene; |
2 | 2 | |
3 | +import net.osdn.gokigen.gr2control.camera.ICameraConnection; | |
4 | + | |
3 | 5 | /** |
4 | 6 | * |
5 | 7 | */ |
6 | 8 | public interface IChangeScene |
7 | 9 | { |
8 | 10 | void changeSceneToCameraPropertyList(); |
9 | - void changeSceneToConfiguration(); | |
11 | + void changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod connectionMethod); | |
10 | 12 | void changeCameraConnection(); |
11 | 13 | void changeSceneToDebugInformation(); |
12 | 14 | void changeSceneToApiList(); |
@@ -136,7 +136,7 @@ | ||
136 | 136 | <string name="pref_fujix_focus_xy">フォーカス点数[X,Y] (default: 7,7)</string> |
137 | 137 | <string name="pref_summary_fujix_focus_xy">接続するカメラに合わせてフォーカス点数を指定します</string> |
138 | 138 | <string name="pref_fujix_liveview_wait">LV画像受信待ち間隔(default: 80)</string> |
139 | - <string name="pref_summary_fujix_liveview_wait">ライブビュー画像受信間隔を指定します</string> | |
139 | + <string name="pref_summary_fujix_liveview_wait">ライブビュー画像受信待ち間隔を指定します。(単位:ms)</string> | |
140 | 140 | <string name="pref_fujix_command_polling_wait">コマンド間隔(default: 500)</string> |
141 | 141 | <string name="pref_summary_fujix_command_polling_wait">カメラ状態の確認間隔を調整します</string> |
142 | 142 | <string name="pref_special_thanks">Special Thanks to</string> |
@@ -191,4 +191,16 @@ | ||
191 | 191 | <string name="shutter_speed">Shutter</string> |
192 | 192 | <string name="aperture">Aperture</string> |
193 | 193 | |
194 | + <string name="pref_ricoh_settings">RICOH GR/PENTAX用設定</string> | |
195 | + <string name="pref_summary_ricoh_settings"> </string> | |
196 | + | |
197 | + <string name="pref_fuji_x_settings">Fujifilm X用設定</string> | |
198 | + <string name="pref_summary_fuji_x_settings"> </string> | |
199 | + | |
200 | + <string name="pref_opc_settings">Olympus Air用設定</string> | |
201 | + <string name="pref_summary_opc_settings"> </string> | |
202 | + | |
203 | + <string name="pref_fuji_x_exit_only">アプリ終了 (FUJI)</string> | |
204 | + <string name="pref_opc_exit_power_off">アプリ終了 (OPC)</string> | |
205 | + <string name="pref_ricoh_exit_power_off">アプリ終了 (RICOH)</string> | |
194 | 206 | </resources> |
@@ -231,4 +231,17 @@ | ||
231 | 231 | |
232 | 232 | <string name="shutter_speed">Shutter</string> |
233 | 233 | <string name="aperture">Aperture</string> |
234 | + | |
235 | + <string name="pref_ricoh_settings">RICOH GR/PENTAX Settings</string> | |
236 | + <string name="pref_summary_ricoh_settings"> </string> | |
237 | + | |
238 | + <string name="pref_fuji_x_settings">Fujifilm X Settings</string> | |
239 | + <string name="pref_summary_fuji_x_settings"> </string> | |
240 | + | |
241 | + <string name="pref_opc_settings">Olympus Air Settings</string> | |
242 | + <string name="pref_summary_opc_settings"> </string> | |
243 | + | |
244 | + <string name="pref_fuji_x_exit_only">Exit Application (FUJI)</string> | |
245 | + <string name="pref_opc_exit_power_off">Exit Application (OPC)</string> | |
246 | + <string name="pref_ricoh_exit_power_off">Exit Application (RICOH)</string> | |
234 | 247 | </resources> |
@@ -6,8 +6,8 @@ | ||
6 | 6 | <PreferenceScreen |
7 | 7 | android:key="exit_application" |
8 | 8 | android:icon="@drawable/ic_power_settings_new_black_24dp" |
9 | - android:title="@string/pref_exit_only" /> | |
10 | - | |
9 | + android:title="@string/pref_fuji_x_exit_only" /> | |
10 | +<!-- | |
11 | 11 | <ListPreference |
12 | 12 | android:title="@string/pref_connection_method" |
13 | 13 | android:entryValues="@array/connection_method_value" |
@@ -19,16 +19,16 @@ | ||
19 | 19 | android:key="wifi_settings" |
20 | 20 | android:title="@string/pref_wifi_settings" |
21 | 21 | android:summary="@string/pref_summary_wifi_settings" /> |
22 | - | |
22 | +--> | |
23 | 23 | </PreferenceCategory> |
24 | 24 | |
25 | 25 | <PreferenceCategory |
26 | 26 | android:title="@string/pref_cat_camera"> |
27 | - | |
27 | +<!-- | |
28 | 28 | <CheckBoxPreference |
29 | 29 | android:key="capture_both_camera_and_live_view" |
30 | 30 | android:title="@string/pref_capture_both_camera_and_live_view" /> |
31 | - | |
31 | +--> | |
32 | 32 | <CheckBoxPreference |
33 | 33 | android:key="fujix_display_camera_view" |
34 | 34 | android:title="@string/pref_fujix_display_camera_view" |
@@ -53,7 +53,7 @@ | ||
53 | 53 | android:summary="@string/pref_summary_fujix_liveview_wait" /> |
54 | 54 | |
55 | 55 | </PreferenceCategory> |
56 | - | |
56 | +<!-- | |
57 | 57 | <PreferenceCategory |
58 | 58 | android:title="@string/pref_cat_initialize"> |
59 | 59 |
@@ -62,10 +62,11 @@ | ||
62 | 62 | android:title="@string/pref_auto_connect_camera" |
63 | 63 | android:summary="@string/pref_summary_auto_connect_camera" /> |
64 | 64 | </PreferenceCategory> |
65 | +--> | |
65 | 66 | |
66 | 67 | <PreferenceCategory |
67 | 68 | android:title="@string/pref_cat_others"> |
68 | - | |
69 | +<!-- | |
69 | 70 | <CheckBoxPreference |
70 | 71 | android:key="share_after_save" |
71 | 72 | android:title="@string/pref_call_share_after_save" /> |
@@ -74,6 +75,7 @@ | ||
74 | 75 | android:key="use_playback_menu" |
75 | 76 | android:title="@string/pref_use_playback_menu" |
76 | 77 | android:summary="@string/summary_use_playback_menu" /> |
78 | +--> | |
77 | 79 | |
78 | 80 | <Preference |
79 | 81 | android:key="special_thanks" |
@@ -83,9 +85,8 @@ | ||
83 | 85 | <intent android:action="android.intent.action.VIEW" |
84 | 86 | android:data="https://github.com/hkr/fuji-cam-wifi-tool" /> |
85 | 87 | </Preference> |
86 | - | |
87 | 88 | </PreferenceCategory> |
88 | - | |
89 | +<!-- | |
89 | 90 | <PreferenceCategory |
90 | 91 | android:title="@string/pref_cat_gokigen"> |
91 | 92 |
@@ -111,6 +112,6 @@ | ||
111 | 112 | android:key="debug_info" |
112 | 113 | android:title="@string/pref_degug_info" |
113 | 114 | android:summary="@string/pref_summary_debug_info" /> |
114 | - | |
115 | 115 | </PreferenceCategory> |
116 | +--> | |
116 | 117 | </PreferenceScreen> |
@@ -6,8 +6,8 @@ | ||
6 | 6 | <PreferenceScreen |
7 | 7 | android:key="exit_application" |
8 | 8 | android:icon="@drawable/ic_power_settings_new_black_24dp" |
9 | - android:title="@string/pref_exit_power_off" /> | |
10 | - | |
9 | + android:title="@string/pref_opc_exit_power_off" /> | |
10 | +<!-- | |
11 | 11 | <ListPreference |
12 | 12 | android:title="@string/pref_connection_method" |
13 | 13 | android:entryValues="@array/connection_method_value" |
@@ -19,7 +19,7 @@ | ||
19 | 19 | android:key="wifi_settings" |
20 | 20 | android:title="@string/pref_wifi_settings" |
21 | 21 | android:summary="@string/pref_summary_wifi_settings" /> |
22 | - | |
22 | +--> | |
23 | 23 | </PreferenceCategory> |
24 | 24 | |
25 | 25 | <PreferenceCategory |
@@ -35,11 +35,11 @@ | ||
35 | 35 | <CheckBoxPreference |
36 | 36 | android:key="raw" |
37 | 37 | android:title="@string/pref_take_raw" /> |
38 | - | |
38 | +<!-- | |
39 | 39 | <CheckBoxPreference |
40 | 40 | android:key="capture_both_camera_and_live_view" |
41 | 41 | android:title="@string/pref_capture_both_camera_and_live_view" /> |
42 | - | |
42 | +--> | |
43 | 43 | </PreferenceCategory> |
44 | 44 | |
45 | 45 | <PreferenceCategory |
@@ -53,6 +53,7 @@ | ||
53 | 53 | |
54 | 54 | </PreferenceCategory> |
55 | 55 | |
56 | + <!-- | |
56 | 57 | <PreferenceCategory |
57 | 58 | android:title="@string/pref_cat_others"> |
58 | 59 |
@@ -63,8 +64,8 @@ | ||
63 | 64 | <CheckBoxPreference |
64 | 65 | android:key="use_playback_menu" |
65 | 66 | android:title="@string/pref_use_playback_menu" /> |
66 | - | |
67 | 67 | </PreferenceCategory> |
68 | +--> | |
68 | 69 | |
69 | 70 | <PreferenceCategory |
70 | 71 | android:title="@string/pref_cat_info"> |
@@ -94,6 +95,7 @@ | ||
94 | 95 | android:selectable="false" /> |
95 | 96 | </PreferenceCategory> |
96 | 97 | |
98 | +<!-- | |
97 | 99 | <PreferenceCategory |
98 | 100 | android:title="@string/pref_cat_initialize"> |
99 | 101 |
@@ -101,7 +103,6 @@ | ||
101 | 103 | android:key="auto_connect_to_camera" |
102 | 104 | android:title="@string/pref_auto_connect_camera" |
103 | 105 | android:summary="@string/pref_summary_auto_connect_camera" /> |
104 | - | |
105 | 106 | </PreferenceCategory> |
106 | 107 | |
107 | 108 | <PreferenceCategory |
@@ -129,6 +130,6 @@ | ||
129 | 130 | android:key="debug_info" |
130 | 131 | android:title="@string/pref_degug_info" |
131 | 132 | android:summary="@string/pref_summary_debug_info" /> |
132 | - | |
133 | 133 | </PreferenceCategory> |
134 | +--> | |
134 | 135 | </PreferenceScreen> |
@@ -6,8 +6,8 @@ | ||
6 | 6 | <PreferenceScreen |
7 | 7 | android:key="exit_application" |
8 | 8 | android:icon="@drawable/ic_power_settings_new_black_24dp" |
9 | - android:title="@string/pref_exit_power_off" /> | |
10 | - | |
9 | + android:title="@string/pref_ricoh_exit_power_off" /> | |
10 | +<!-- | |
11 | 11 | <ListPreference |
12 | 12 | android:title="@string/pref_connection_method" |
13 | 13 | android:entryValues="@array/connection_method_value" |
@@ -19,17 +19,18 @@ | ||
19 | 19 | android:key="wifi_settings" |
20 | 20 | android:title="@string/pref_wifi_settings" |
21 | 21 | android:summary="@string/pref_summary_wifi_settings" /> |
22 | - | |
22 | +--> | |
23 | 23 | </PreferenceCategory> |
24 | 24 | |
25 | +<!-- | |
25 | 26 | <PreferenceCategory |
26 | 27 | android:title="@string/pref_cat_camera"> |
27 | 28 | |
28 | 29 | <CheckBoxPreference |
29 | 30 | android:key="capture_both_camera_and_live_view" |
30 | 31 | android:title="@string/pref_capture_both_camera_and_live_view" /> |
31 | - | |
32 | 32 | </PreferenceCategory> |
33 | +--> | |
33 | 34 | |
34 | 35 | <PreferenceCategory |
35 | 36 | android:title="@string/pref_cat_initialize"> |
@@ -43,15 +44,17 @@ | ||
43 | 44 | android:key="gr2_lcd_sleep" |
44 | 45 | android:title="@string/pref_gr2_lcd_sleep" /> |
45 | 46 | |
47 | +<!-- | |
46 | 48 | <CheckBoxPreference |
47 | 49 | android:key="auto_connect_to_camera" |
48 | 50 | android:title="@string/pref_auto_connect_camera" |
49 | 51 | android:summary="@string/pref_summary_auto_connect_camera" /> |
52 | +--> | |
50 | 53 | </PreferenceCategory> |
51 | 54 | |
52 | 55 | <PreferenceCategory |
53 | 56 | android:title="@string/pref_cat_others"> |
54 | - | |
57 | +<!-- | |
55 | 58 | <CheckBoxPreference |
56 | 59 | android:key="share_after_save" |
57 | 60 | android:title="@string/pref_call_share_after_save" /> |
@@ -59,10 +62,8 @@ | ||
59 | 62 | <CheckBoxPreference |
60 | 63 | android:key="use_playback_menu" |
61 | 64 | android:title="@string/pref_use_playback_menu" |
62 | - android:summary="@string/summary_use_playback_menu" | |
63 | - | |
64 | - /> | |
65 | - | |
65 | + android:summary="@string/summary_use_playback_menu" /> | |
66 | +--> | |
66 | 67 | <CheckBoxPreference |
67 | 68 | android:key="use_gr2_special_command" |
68 | 69 | android:title="@string/pref_use_gr2_special_command" |
@@ -81,9 +82,9 @@ | ||
81 | 82 | android:defaultValue="5" |
82 | 83 | android:inputType="number" |
83 | 84 | android:summary="@string/pref_summary_ricoh_get_pics_list_timeout" /> |
84 | - | |
85 | 85 | </PreferenceCategory> |
86 | 86 | |
87 | + <!-- | |
87 | 88 | <PreferenceCategory |
88 | 89 | android:title="@string/pref_cat_gokigen"> |
89 | 90 |
@@ -109,6 +110,6 @@ | ||
109 | 110 | android:key="debug_info" |
110 | 111 | android:title="@string/pref_degug_info" |
111 | 112 | android:summary="@string/pref_summary_debug_info" /> |
112 | - | |
113 | 113 | </PreferenceCategory> |
114 | +--> | |
114 | 115 | </PreferenceScreen> |
@@ -0,0 +1,94 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > | |
3 | + <PreferenceCategory | |
4 | + android:title="@string/pref_cat_application_control"> | |
5 | + | |
6 | + <ListPreference | |
7 | + android:title="@string/pref_connection_method" | |
8 | + android:entryValues="@array/connection_method_value" | |
9 | + android:entries="@array/connection_method" | |
10 | + android:key="connection_method" | |
11 | + android:defaultValue="RICOH_GR2"/> | |
12 | + | |
13 | + <PreferenceScreen | |
14 | + android:key="wifi_settings" | |
15 | + android:title="@string/pref_wifi_settings" | |
16 | + android:summary="@string/pref_summary_wifi_settings" /> | |
17 | + | |
18 | + </PreferenceCategory> | |
19 | + | |
20 | + <PreferenceCategory | |
21 | + android:title="@string/pref_cat_camera"> | |
22 | + | |
23 | + <PreferenceScreen | |
24 | + android:key="ricoh_settings" | |
25 | + android:title="@string/pref_ricoh_settings" | |
26 | + android:summary="@string/pref_summary_ricoh_settings" /> | |
27 | + | |
28 | + <PreferenceScreen | |
29 | + android:key="fuji_x_settings" | |
30 | + android:title="@string/pref_fuji_x_settings" | |
31 | + android:summary="@string/pref_summary_fuji_x_settings" /> | |
32 | + | |
33 | + <PreferenceScreen | |
34 | + android:key="opc_settings" | |
35 | + android:title="@string/pref_opc_settings" | |
36 | + android:summary="@string/pref_summary_opc_settings" /> | |
37 | + | |
38 | + <CheckBoxPreference | |
39 | + android:key="capture_both_camera_and_live_view" | |
40 | + android:title="@string/pref_capture_both_camera_and_live_view" /> | |
41 | + | |
42 | + </PreferenceCategory> | |
43 | + | |
44 | + <PreferenceCategory | |
45 | + android:title="@string/pref_cat_initialize"> | |
46 | + | |
47 | + <CheckBoxPreference | |
48 | + android:key="auto_connect_to_camera" | |
49 | + android:title="@string/pref_auto_connect_camera" | |
50 | + android:summary="@string/pref_summary_auto_connect_camera" /> | |
51 | + </PreferenceCategory> | |
52 | + | |
53 | + <PreferenceCategory | |
54 | + android:title="@string/pref_cat_others"> | |
55 | + | |
56 | + <CheckBoxPreference | |
57 | + android:key="share_after_save" | |
58 | + android:title="@string/pref_call_share_after_save" /> | |
59 | + | |
60 | + <CheckBoxPreference | |
61 | + android:key="use_playback_menu" | |
62 | + android:title="@string/pref_use_playback_menu" | |
63 | + android:summary="@string/summary_use_playback_menu" /> | |
64 | + | |
65 | + </PreferenceCategory> | |
66 | + | |
67 | + <PreferenceCategory | |
68 | + android:title="@string/pref_cat_gokigen"> | |
69 | + | |
70 | + <Preference | |
71 | + android:key="instruction_link" | |
72 | + android:title="@string/pref_instruction_manual" | |
73 | + android:summary="https://osdn.net/projects/gokigen/wiki/GR2Control" | |
74 | + android:selectable="true"> | |
75 | + <intent android:action="android.intent.action.VIEW" | |
76 | + android:data="https://osdn.net/projects/gokigen/wiki/GR2Control" /> | |
77 | + </Preference> | |
78 | + | |
79 | + <Preference | |
80 | + android:key="privacy_policy" | |
81 | + android:title="@string/pref_privacy_policy" | |
82 | + android:summary="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy" | |
83 | + android:selectable="true"> | |
84 | + <intent android:action="android.intent.action.VIEW" | |
85 | + android:data="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy" /> | |
86 | + </Preference> | |
87 | + | |
88 | + <PreferenceScreen | |
89 | + android:key="debug_info" | |
90 | + android:title="@string/pref_degug_info" | |
91 | + android:summary="@string/pref_summary_debug_info" /> | |
92 | + | |
93 | + </PreferenceCategory> | |
94 | +</PreferenceScreen> |