• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: コミット

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


コミットメタ情報

リビジョン5fdb14451ea5e64713f48480cb981d4484910f4e (tree)
日時2018-06-15 00:45:03
作者MRSa <mrsa@myad...>
コミッターMRSa

ログメッセージ

SONY機でのPreferenceを準備。

変更サマリ

差分

--- a/app/src/main/java/net/osdn/gokigen/a01d/A01dMain.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/A01dMain.java
@@ -10,6 +10,7 @@ import android.support.v4.content.ContextCompat;
1010 import android.support.v7.app.ActionBar;
1111 import android.support.v7.app.AppCompatActivity;
1212 import android.os.Bundle;
13+import android.support.v7.preference.PreferenceFragmentCompat;
1314 import android.support.v7.preference.PreferenceManager;
1415 import android.util.Log;
1516 import android.view.WindowManager;
@@ -24,8 +25,9 @@ import net.osdn.gokigen.a01d.camera.olympus.wrapper.connection.ble.ICameraPowerO
2425 import net.osdn.gokigen.a01d.liveview.IStatusViewDrawer;
2526 import net.osdn.gokigen.a01d.liveview.LiveViewFragment;
2627 import net.osdn.gokigen.a01d.logcat.LogCatFragment;
27-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
28-import net.osdn.gokigen.a01d.preference.PreferenceFragment;
28+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
29+import net.osdn.gokigen.a01d.preference.olympus.PreferenceFragment;
30+import net.osdn.gokigen.a01d.preference.sony.SonyPreferenceFragment;
2931
3032 /**
3133 * A01d ;
@@ -37,7 +39,7 @@ public class A01dMain extends AppCompatActivity implements ICameraStatusReceiver
3739 private IInterfaceProvider interfaceProvider = null;
3840 private IStatusViewDrawer statusViewDrawer = null;
3941
40- private PreferenceFragment preferenceFragment = null;
42+ private PreferenceFragmentCompat preferenceFragment = null;
4143 private OlyCameraPropertyListFragment propertyListFragment = null;
4244 private LogCatFragment logCatFragment = null;
4345
@@ -245,11 +247,17 @@ public class A01dMain extends AppCompatActivity implements ICameraStatusReceiver
245247 {
246248 try
247249 {
248- if (preferenceFragment == null)
249- {
250- preferenceFragment = new PreferenceFragment();
250+ if (preferenceFragment == null) {
251+ if (useOlympusCamera())
252+ {
253+ preferenceFragment = PreferenceFragment.newInstance(this, interfaceProvider, this);
254+ }
255+ else
256+ {
257+ preferenceFragment = SonyPreferenceFragment.newInstance(this, interfaceProvider, this);
258+ }
251259 }
252- preferenceFragment.setInterface(this, interfaceProvider, this);
260+
253261 FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
254262 transaction.replace(R.id.fragment1, preferenceFragment);
255263 // backstackに追加
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/CameraInterfaceProvider.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/CameraInterfaceProvider.java
@@ -6,12 +6,11 @@ import android.support.annotation.NonNull;
66 import android.support.v7.preference.PreferenceManager;
77
88 import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlympusLiveViewListener;
9-import net.osdn.gokigen.a01d.camera.sony.wrapper.IDisplayInjector;
109 import net.osdn.gokigen.a01d.camera.olympus.IOlympusInterfaceProvider;
1110 import net.osdn.gokigen.a01d.camera.olympus.wrapper.OlympusInterfaceProvider;
1211 import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
1312 import net.osdn.gokigen.a01d.camera.sony.wrapper.SonyCameraWrapper;
14-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
13+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
1514
1615 public class CameraInterfaceProvider implements IInterfaceProvider
1716 {
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/operation/CameraPowerOff.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/operation/CameraPowerOff.java
@@ -7,7 +7,7 @@ import android.support.v7.preference.Preference;
77 import net.osdn.gokigen.a01d.ConfirmationDialog;
88 import net.osdn.gokigen.a01d.IChangeScene;
99 import net.osdn.gokigen.a01d.R;
10-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
10+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
1111
1212 /**
1313 * Preferenceがクリックされた時に処理するクラス
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraWrapper.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraWrapper.java
@@ -8,7 +8,7 @@ import android.util.Log;
88
99 import net.osdn.gokigen.a01d.camera.ILiveViewControl;
1010 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.CameraPropertyUtilities;
11-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
11+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
1212
1313 import java.util.Map;
1414
@@ -299,7 +299,7 @@ class OlyCameraWrapper implements ICameraRunMode, ILiveViewControl, IOlympusLive
299299 if (changeValue != null)
300300 {
301301 SharedPreferences.Editor editor = preferences.edit();
302- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE, changeValue);
302+ editor.putString(IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE, changeValue);
303303 editor.apply();
304304 }
305305 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraZoomLensControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraZoomLensControl.java
@@ -6,7 +6,7 @@ import android.support.v7.preference.PreferenceManager;
66 import android.util.Log;
77
88 import net.osdn.gokigen.a01d.camera.IZoomLensControl;
9-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
9+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
1010
1111 import jp.co.olympus.camerakit.OLYCamera;
1212
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/connection/ble/OlyCameraPowerOnSelector.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/connection/ble/OlyCameraPowerOnSelector.java
@@ -5,7 +5,7 @@ import android.util.Log;
55
66 import net.osdn.gokigen.a01d.ConfirmationDialog;
77 import net.osdn.gokigen.a01d.R;
8-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
8+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
99
1010 /**
1111 * Olympus AIR の Bluetooth設定を記録する
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/CameraLiveImageView.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/CameraLiveImageView.java
@@ -27,11 +27,10 @@ import net.osdn.gokigen.a01d.liveview.bitmapconvert.ImageConvertFactory;
2727 import net.osdn.gokigen.a01d.liveview.gridframe.GridFrameFactory;
2828 import net.osdn.gokigen.a01d.liveview.gridframe.IGridFrameDrawer;
2929 import net.osdn.gokigen.a01d.liveview.liveviewlistener.IImageDataReceiver;
30-import net.osdn.gokigen.a01d.liveview.liveviewlistener.OlympusCameraLiveViewListenerImpl;
3130 import net.osdn.gokigen.a01d.liveview.message.IMessageDrawer;
3231 import net.osdn.gokigen.a01d.liveview.message.IMessageHolder;
3332 import net.osdn.gokigen.a01d.liveview.message.ShowMessageHolder;
34-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
33+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
3534
3635 import java.util.Map;
3736 import java.util.Timer;
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewClickTouchListener.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewClickTouchListener.java
@@ -18,7 +18,7 @@ import net.osdn.gokigen.a01d.camera.ICameraConnection;
1818 import net.osdn.gokigen.a01d.camera.IZoomLensControl;
1919 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraProperty;
2020 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
21-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
21+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
2222
2323 /**
2424 *
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
@@ -33,7 +33,7 @@ import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraProperty;
3333 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
3434 import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
3535 import net.osdn.gokigen.a01d.liveview.liveviewlistener.OlympusCameraLiveViewListenerImpl;
36-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
36+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
3737
3838 /**
3939 * 撮影用ライブビュー画面
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/olympus/IPreferencePropertyAccessor.java
@@ -1,4 +1,4 @@
1-package net.osdn.gokigen.a01d.preference;
1+package net.osdn.gokigen.a01d.preference.olympus;
22
33 /**
44 *
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/PreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/olympus/PreferenceFragment.java
@@ -1,5 +1,6 @@
1-package net.osdn.gokigen.a01d.preference;
1+package net.osdn.gokigen.a01d.preference.olympus;
22
3+import android.support.annotation.NonNull;
34 import android.support.v4.app.FragmentActivity;
45 import android.support.v7.app.AppCompatActivity;
56 import android.app.ProgressDialog;
@@ -21,7 +22,6 @@ import net.osdn.gokigen.a01d.camera.olympus.wrapper.ICameraRunMode;
2122 import net.osdn.gokigen.a01d.camera.olympus.wrapper.connection.ble.OlyCameraPowerOnSelector;
2223 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraProperty;
2324 import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
24-import net.osdn.gokigen.a01d.camera.olympus.IOlympusInterfaceProvider;
2525 import net.osdn.gokigen.a01d.camera.olympus.operation.CameraPowerOff;
2626 import net.osdn.gokigen.a01d.logcat.LogCatViewer;
2727
@@ -49,11 +49,27 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar
4949 private ProgressDialog busyDialog = null;
5050 private PreferenceSynchronizer preferenceSynchronizer = null;
5151
52+
53+ public static PreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
54+ {
55+ PreferenceFragment instance = new PreferenceFragment();
56+ instance.setInterface(context, factory, changeScene);
57+
58+ // パラメータはBundleにまとめておく
59+ Bundle arguments = new Bundle();
60+ //arguments.putString("title", title);
61+ //arguments.putString("message", message);
62+ instance.setArguments(arguments);
63+
64+ return (instance);
65+ }
66+
67+
5268 /**
5369 *
5470 *
5571 */
56- public void setInterface(AppCompatActivity context, IInterfaceProvider factory, IChangeScene changeScene)
72+ private void setInterface(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
5773 {
5874 Log.v(TAG, "setInterface()");
5975 this.propertyInterface = factory.getOlympusInterface().getCameraPropertyProvider();
@@ -98,53 +114,53 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar
98114 Map<String, ?> items = preferences.getAll();
99115 SharedPreferences.Editor editor = preferences.edit();
100116
101- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE))
117+ if (!items.containsKey(IPreferencePropertyAccessor.TAKE_MODE))
102118 {
103- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE_DEFAULT_VALUE);
119+ editor.putString(IPreferencePropertyAccessor.TAKE_MODE, IPreferencePropertyAccessor.TAKE_MODE_DEFAULT_VALUE);
104120 }
105- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.LIVE_VIEW_QUALITY))
121+ if (!items.containsKey(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY))
106122 {
107- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE);
123+ editor.putString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE);
108124 }
109- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL))
125+ if (!items.containsKey(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL))
110126 {
111- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
127+ editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
112128 }
113- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.RAW))
129+ if (!items.containsKey(IPreferencePropertyAccessor.RAW))
114130 {
115- editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.RAW, true);
131+ editor.putBoolean(IPreferencePropertyAccessor.RAW, true);
116132 }
117133 if (!items.containsKey(IPreferencePropertyAccessor.BLE_POWER_ON))
118134 {
119- editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.BLE_POWER_ON, false);
135+ editor.putBoolean(IPreferencePropertyAccessor.BLE_POWER_ON, false);
120136 }
121- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA))
137+ if (!items.containsKey(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA))
122138 {
123- editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
139+ editor.putBoolean(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
124140 }
125- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW))
141+ if (!items.containsKey(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW))
126142 {
127- editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
143+ editor.putBoolean(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
128144 }
129- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL))
145+ if (!items.containsKey(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL))
130146 {
131- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
147+ editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
132148 }
133- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE))
149+ if (!items.containsKey(IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE))
134150 {
135- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE_DEFAULT_VALUE);
151+ editor.putString(IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE, IPreferencePropertyAccessor.MAGNIFYING_LIVE_VIEW_SCALE_DEFAULT_VALUE);
136152 }
137- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL))
153+ if (!items.containsKey(IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL))
138154 {
139- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL_DEFAULT_VALUE);
155+ editor.putString(IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL, IPreferencePropertyAccessor.DIGITAL_ZOOM_LEVEL_DEFAULT_VALUE);
140156 }
141- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.POWER_ZOOM_LEVEL))
157+ if (!items.containsKey(IPreferencePropertyAccessor.POWER_ZOOM_LEVEL))
142158 {
143- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.POWER_ZOOM_LEVEL, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.POWER_ZOOM_LEVEL_DEFAULT_VALUE);
159+ editor.putString(IPreferencePropertyAccessor.POWER_ZOOM_LEVEL, IPreferencePropertyAccessor.POWER_ZOOM_LEVEL_DEFAULT_VALUE);
144160 }
145- if (!items.containsKey(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.CONNECTION_METHOD))
161+ if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD))
146162 {
147- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.CONNECTION_METHOD, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
163+ editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
148164 }
149165 editor.apply();
150166 }
@@ -488,8 +504,8 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar
488504 public void run() {
489505 try {
490506 // Preferenceの画面に反映させる
491- setListPreference(IPreferencePropertyAccessor.TAKE_MODE, IPreferencePropertyAccessor.TAKE_MODE, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE_DEFAULT_VALUE);
492- setListPreference(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
507+ setListPreference(IPreferencePropertyAccessor.TAKE_MODE, IPreferencePropertyAccessor.TAKE_MODE, IPreferencePropertyAccessor.TAKE_MODE_DEFAULT_VALUE);
508+ setListPreference(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
493509 setBooleanPreference(IPreferencePropertyAccessor.RAW, IPreferencePropertyAccessor.RAW, true);
494510 setBooleanPreference(IPreferencePropertyAccessor.BLE_POWER_ON, IPreferencePropertyAccessor.BLE_POWER_ON, false);
495511 setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/PreferenceSynchronizer.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/olympus/PreferenceSynchronizer.java
@@ -1,4 +1,4 @@
1-package net.osdn.gokigen.a01d.preference;
1+package net.osdn.gokigen.a01d.preference.olympus;
22
33 import android.content.SharedPreferences;
44 import android.util.Log;
@@ -43,11 +43,11 @@ class PreferenceSynchronizer implements Runnable
4343 {
4444 Log.v(TAG, "run()");
4545 SharedPreferences.Editor editor = preference.edit();
46- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE, getPropertyValue(IOlyCameraProperty.TAKE_MODE));
47- editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, getPropertyValue(IOlyCameraProperty.SOUND_VOLUME_LEVEL));
46+ editor.putString(IPreferencePropertyAccessor.TAKE_MODE, getPropertyValue(IOlyCameraProperty.TAKE_MODE));
47+ editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, getPropertyValue(IOlyCameraProperty.SOUND_VOLUME_LEVEL));
4848
4949 boolean value = getPropertyValue(IOlyCameraProperty.RAW).equals("ON");
50- editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.RAW, value);
50+ editor.putBoolean(IPreferencePropertyAccessor.RAW, value);
5151 editor.apply();
5252 if (callback != null)
5353 {
--- /dev/null
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/sony/SonyPreferenceFragment.java
@@ -0,0 +1,313 @@
1+package net.osdn.gokigen.a01d.preference.sony;
2+
3+import android.content.Context;
4+import android.content.SharedPreferences;
5+import android.os.Bundle;
6+import android.support.annotation.NonNull;
7+import android.support.v4.app.FragmentActivity;
8+import android.support.v7.app.AppCompatActivity;
9+import android.support.v7.preference.CheckBoxPreference;
10+import android.support.v7.preference.ListPreference;
11+import android.support.v7.preference.Preference;
12+import android.support.v7.preference.PreferenceFragmentCompat;
13+import android.support.v7.preference.PreferenceManager;
14+import android.util.Log;
15+
16+import net.osdn.gokigen.a01d.IChangeScene;
17+import net.osdn.gokigen.a01d.R;
18+import net.osdn.gokigen.a01d.camera.IInterfaceProvider;
19+import net.osdn.gokigen.a01d.camera.olympus.operation.CameraPowerOff;
20+import net.osdn.gokigen.a01d.logcat.LogCatViewer;
21+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
22+
23+import java.util.Map;
24+
25+/**
26+ *
27+ *
28+ */
29+public class SonyPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
30+{
31+ private final String TAG = toString();
32+ private SharedPreferences preferences = null;
33+ private CameraPowerOff powerOffController = null;
34+ private LogCatViewer logCatViewer = null;
35+
36+ /**
37+ *
38+ *
39+ */
40+ public static SonyPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
41+ {
42+ SonyPreferenceFragment instance = new SonyPreferenceFragment();
43+ instance.prepare(context, factory, changeScene);
44+
45+ // パラメータはBundleにまとめておく
46+ Bundle arguments = new Bundle();
47+ //arguments.putString("title", title);
48+ //arguments.putString("message", message);
49+ instance.setArguments(arguments);
50+
51+ return (instance);
52+ }
53+
54+ /**
55+ *
56+ *
57+ */
58+ private void prepare(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
59+ {
60+ try
61+ {
62+ powerOffController = new CameraPowerOff(context, changeScene);
63+ powerOffController.prepare();
64+
65+ logCatViewer = new LogCatViewer(changeScene);
66+ logCatViewer.prepare();
67+ }
68+ catch (Exception e)
69+ {
70+ e.printStackTrace();
71+ }
72+ }
73+
74+ /**
75+ *
76+ *
77+ */
78+ @Override
79+ public void onAttach(Context activity)
80+ {
81+ super.onAttach(activity);
82+ Log.v(TAG, "onAttach()");
83+
84+ try
85+ {
86+ // Preference をつかまえる
87+ preferences = PreferenceManager.getDefaultSharedPreferences(activity);
88+
89+ // Preference を初期設定する
90+ initializePreferences();
91+
92+ preferences.registerOnSharedPreferenceChangeListener(this);
93+ }
94+ catch (Exception e)
95+ {
96+ e.printStackTrace();
97+ }
98+ }
99+
100+ /**
101+ * Preferenceの初期化...
102+ *
103+ */
104+ private void initializePreferences()
105+ {
106+ try
107+ {
108+ Map<String, ?> items = preferences.getAll();
109+ SharedPreferences.Editor editor = preferences.edit();
110+
111+ if (!items.containsKey(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA)) {
112+ editor.putBoolean(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
113+ }
114+ if (!items.containsKey(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW)) {
115+ editor.putBoolean(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
116+ }
117+ if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD)) {
118+ editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
119+ }
120+ editor.apply();
121+ }
122+ catch (Exception e)
123+ {
124+ e.printStackTrace();
125+ }
126+ }
127+
128+ /**
129+ *
130+ *
131+ */
132+ @Override
133+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
134+ {
135+ Log.v(TAG, "onSharedPreferenceChanged() : " + key);
136+ boolean value;
137+ if (key != null)
138+ {
139+ switch (key)
140+ {
141+ case IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA:
142+ value = preferences.getBoolean(key, true);
143+ Log.v(TAG, " " + key + " , " + value);
144+ break;
145+
146+ case IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW:
147+ value = preferences.getBoolean(key, true);
148+ Log.v(TAG, " " + key + " , " + value);
149+ break;
150+
151+ default:
152+ String strValue = preferences.getString(key, "");
153+ setListPreference(key, key, strValue);
154+ break;
155+ }
156+ }
157+ }
158+
159+ /**
160+ *
161+ *
162+ */
163+ @Override
164+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey)
165+ {
166+ Log.v(TAG, "onCreatePreferences()");
167+ try
168+ {
169+ //super.onCreate(savedInstanceState);
170+ addPreferencesFromResource(R.xml.preferences_sony);
171+
172+ ListPreference connectionMethod = (ListPreference) findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
173+ connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
174+ @Override
175+ public boolean onPreferenceChange(Preference preference, Object newValue) {
176+ preference.setSummary(newValue + " ");
177+ return (true);
178+ }
179+ });
180+ connectionMethod.setSummary(connectionMethod.getValue() + " ");
181+
182+ findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
183+ findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
184+ }
185+ catch (Exception e)
186+ {
187+ e.printStackTrace();
188+ }
189+ }
190+
191+ /**
192+ *
193+ *
194+ */
195+ @Override
196+ public void onResume()
197+ {
198+ super.onResume();
199+ Log.v(TAG, "onResume() Start");
200+
201+ try
202+ {
203+ synchronizedProperty();
204+ }
205+ catch (Exception e)
206+ {
207+ e.printStackTrace();
208+ }
209+
210+ Log.v(TAG, "onResume() End");
211+
212+ }
213+
214+ /**
215+ *
216+ *
217+ */
218+ @Override
219+ public void onPause()
220+ {
221+ super.onPause();
222+ Log.v(TAG, "onPause() Start");
223+
224+ try
225+ {
226+ // Preference変更のリスナを解除
227+ preferences.unregisterOnSharedPreferenceChangeListener(this);
228+ }
229+ catch (Exception e)
230+ {
231+ e.printStackTrace();
232+ }
233+
234+ Log.v(TAG, "onPause() End");
235+ }
236+
237+ /**
238+ * ListPreference の表示データを設定
239+ *
240+ * @param pref_key Preference(表示)のキー
241+ * @param key Preference(データ)のキー
242+ * @param defaultValue Preferenceのデフォルト値
243+ */
244+ private void setListPreference(String pref_key, String key, String defaultValue)
245+ {
246+ try
247+ {
248+ ListPreference pref;
249+ pref = (ListPreference) findPreference(pref_key);
250+ String value = preferences.getString(key, defaultValue);
251+ if (pref != null)
252+ {
253+ pref.setValue(value);
254+ pref.setSummary(value);
255+ }
256+ }
257+ catch (Exception e)
258+ {
259+ e.printStackTrace();
260+ }
261+ }
262+
263+ /**
264+ * BooleanPreference の表示データを設定
265+ *
266+ * @param pref_key Preference(表示)のキー
267+ * @param key Preference(データ)のキー
268+ * @param defaultValue Preferenceのデフォルト値
269+ */
270+ private void setBooleanPreference(String pref_key, String key, boolean defaultValue)
271+ {
272+ try
273+ {
274+ CheckBoxPreference pref = (CheckBoxPreference) findPreference(pref_key);
275+ if (pref != null) {
276+ boolean value = preferences.getBoolean(key, defaultValue);
277+ pref.setChecked(value);
278+ }
279+ }
280+ catch (Exception e)
281+ {
282+ e.printStackTrace();
283+ }
284+ }
285+
286+ /**
287+ *
288+ *
289+ */
290+ private void synchronizedProperty()
291+ {
292+ final FragmentActivity activity = getActivity();
293+ if (activity != null)
294+ {
295+ activity.runOnUiThread(new Runnable() {
296+ @Override
297+ public void run() {
298+ try
299+ {
300+ // Preferenceの画面に反映させる
301+ setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
302+ setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
303+ }
304+ catch (Exception e)
305+ {
306+ e.printStackTrace();
307+ }
308+ }
309+ });
310+ }
311+ }
312+
313+}
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -25,6 +25,7 @@
2525
2626 <string name="pref_cat_application_control">アプリ制御</string>
2727 <string name="pref_exit_power_off">アプリ終了(とカメラOFF)</string>
28+ <string name="pref_exit_power_off_sony">アプリ終了</string>
2829
2930 <string name="pref_cat_initialize">起動時設定</string>
3031 <string name="pref_auto_connect_camera">カメラに自動接続</string>
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -26,6 +26,7 @@
2626
2727 <string name="pref_cat_application_control">App. Control</string>
2828 <string name="pref_exit_power_off">Exit Application(and Camera OFF)</string>
29+ <string name="pref_exit_power_off_sony">Exit Application</string>
2930
3031
3132 <string name="pref_cat_initialize">App. Startup</string>
--- /dev/null
+++ b/app/src/main/res/xml/preferences_sony.xml
@@ -0,0 +1,65 @@
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+ <PreferenceScreen
7+ android:key="exit_application"
8+ android:icon="@drawable/ic_power_settings_new_black_24dp"
9+ android:title="@string/pref_exit_power_off_sony" />
10+
11+ <ListPreference
12+ android:title="@string/pref_connection_method"
13+ android:entryValues="@array/connection_method_value"
14+ android:entries="@array/connection_method"
15+ android:key="connection_method"
16+ android:defaultValue="OPC"/>
17+
18+ </PreferenceCategory>
19+
20+ <PreferenceCategory
21+ android:title="@string/pref_cat_camera">
22+
23+ <CheckBoxPreference
24+ android:key="capture_both_camera_and_live_view"
25+ android:title="@string/pref_capture_both_camera_and_live_view" />
26+
27+ </PreferenceCategory>
28+
29+ <PreferenceCategory
30+ android:title="@string/pref_cat_initialize">
31+
32+ <CheckBoxPreference
33+ android:key="auto_connect_to_camera"
34+ android:title="@string/pref_auto_connect_camera"
35+ android:summary="@string/pref_summary_auto_connect_camera" />
36+ </PreferenceCategory>
37+
38+ <PreferenceCategory
39+ android:title="@string/pref_cat_gokigen">
40+
41+ <Preference
42+ android:key="instruction_link"
43+ android:title="@string/pref_instruction_manual"
44+ android:summary="https://osdn.net/projects/gokigen/wiki/A01d"
45+ android:selectable="true">
46+ <intent android:action="android.intent.action.VIEW"
47+ android:data="https://osdn.net/projects/gokigen/wiki/A01d" />
48+ </Preference>
49+
50+ <Preference
51+ android:key="privacy_policy"
52+ android:title="@string/pref_privacy_policy"
53+ android:summary="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy"
54+ android:selectable="true">
55+ <intent android:action="android.intent.action.VIEW"
56+ android:data="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy" />
57+ </Preference>
58+
59+ <PreferenceScreen
60+ android:key="debug_info"
61+ android:title="@string/pref_degug_info"
62+ android:summary="@string/pref_summary_debug_info" />
63+
64+ </PreferenceCategory>
65+</PreferenceScreen>
旧リポジトリブラウザで表示