• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

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


Commit MetaInfo

Révisionb38a8d06c3ef41b61e4e4174d055507393a2e16a (tree)
l'heure2018-06-16 00:03:06
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

お気に入りボタンをSONY機では表示しないようにする。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/A01dMain.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/A01dMain.java
@@ -254,7 +254,7 @@ public class A01dMain extends AppCompatActivity implements ICameraStatusReceiver
254254 }
255255 else
256256 {
257- preferenceFragment = SonyPreferenceFragment.newInstance(this, interfaceProvider, this);
257+ preferenceFragment = SonyPreferenceFragment.newInstance(this, this);
258258 }
259259 }
260260
--- /dev/null
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/operation/CameraPowerOffSony.java
@@ -0,0 +1,81 @@
1+package net.osdn.gokigen.a01d.camera.sony.operation;
2+
3+import android.content.Context;
4+import android.support.v7.preference.Preference;
5+
6+import net.osdn.gokigen.a01d.ConfirmationDialog;
7+import net.osdn.gokigen.a01d.IChangeScene;
8+import net.osdn.gokigen.a01d.R;
9+import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
10+
11+
12+/**
13+ * Preferenceがクリックされた時に処理するクラス
14+ *
15+ */public class CameraPowerOffSony implements Preference.OnPreferenceClickListener, ConfirmationDialog.Callback
16+{
17+
18+ private final Context context;
19+ private final IChangeScene changeScene;
20+ private String preferenceKey = null;
21+
22+ /**
23+ * コンストラクタ
24+ *
25+ */
26+ public CameraPowerOffSony(Context context, IChangeScene changeScene)
27+ {
28+ this.context = context;
29+ this.changeScene = changeScene;
30+ }
31+
32+ /**
33+ * クラスの準備
34+ *
35+ */
36+ public void prepare()
37+ {
38+ // 何もしない
39+ }
40+
41+ /**
42+ *
43+ *
44+ * @param preference クリックしたpreference
45+ * @return false : ハンドルしない / true : ハンドルした
46+ */
47+ @Override
48+ public boolean onPreferenceClick(Preference preference)
49+ {
50+ if (!preference.hasKey())
51+ {
52+ return (false);
53+ }
54+
55+ preferenceKey = preference.getKey();
56+ if (preferenceKey.contains(IPreferencePropertyAccessor.EXIT_APPLICATION))
57+ {
58+
59+ // 確認ダイアログの生成と表示
60+ ConfirmationDialog dialog = new ConfirmationDialog(context);
61+ dialog.show(R.string.dialog_title_confirmation, R.string.dialog_message_exit_application, this);
62+ return (true);
63+ }
64+ return (false);
65+ }
66+
67+ /**
68+ *
69+ *
70+ */
71+ @Override
72+ public void confirm()
73+ {
74+ if (preferenceKey.contains(IPreferencePropertyAccessor.EXIT_APPLICATION))
75+ {
76+ // カメラの電源をOFFにしたうえで、アプリケーションを終了する。
77+ changeScene.exitApplication();
78+ }
79+ }
80+}
81+
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
@@ -149,9 +149,28 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
149149 view.findViewById(R.id.show_preference_button).setOnClickListener(onClickTouchListener);
150150 view.findViewById(R.id.camera_property_settings_button).setOnClickListener(onClickTouchListener);
151151 view.findViewById(R.id.shutter_button).setOnClickListener(onClickTouchListener);
152- view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener);
153152 view.findViewById(R.id.btn_zoomin).setOnClickListener(onClickTouchListener);
154153 view.findViewById(R.id.btn_zoomout).setOnClickListener(onClickTouchListener);
154+ if (interfaceProvider.useOlympusCamera())
155+ {
156+ view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener);
157+ }
158+ else
159+ {
160+ // お気に入りボタンは、SONYモードのときには表示しない
161+ final View favoriteButton = view.findViewById(R.id.show_favorite_settings_button);
162+ if (favoriteButton != null)
163+ {
164+ runOnUiThread(new Runnable()
165+ {
166+ @Override
167+ public void run()
168+ {
169+ favoriteButton.setVisibility(View.INVISIBLE);
170+ }
171+ });
172+ }
173+ }
155174
156175 manualFocus = view.findViewById(R.id.focusing_button);
157176 if (manualFocus != null)
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/sony/SonyPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/sony/SonyPreferenceFragment.java
@@ -15,8 +15,7 @@ import android.util.Log;
1515
1616 import net.osdn.gokigen.a01d.IChangeScene;
1717 import net.osdn.gokigen.a01d.R;
18-import net.osdn.gokigen.a01d.camera.IInterfaceProvider;
19-import net.osdn.gokigen.a01d.camera.olympus.operation.CameraPowerOff;
18+import net.osdn.gokigen.a01d.camera.sony.operation.CameraPowerOffSony;
2019 import net.osdn.gokigen.a01d.logcat.LogCatViewer;
2120 import net.osdn.gokigen.a01d.preference.olympus.IPreferencePropertyAccessor;
2221
@@ -30,17 +29,18 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements
3029 {
3130 private final String TAG = toString();
3231 private SharedPreferences preferences = null;
33- private CameraPowerOff powerOffController = null;
32+ private CameraPowerOffSony powerOffController = null;
3433 private LogCatViewer logCatViewer = null;
3534
3635 /**
3736 *
3837 *
3938 */
40- public static SonyPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
39+ //public static SonyPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
40+ public static SonyPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene)
4141 {
4242 SonyPreferenceFragment instance = new SonyPreferenceFragment();
43- instance.prepare(context, factory, changeScene);
43+ instance.prepare(context, changeScene);
4444
4545 // パラメータはBundleにまとめておく
4646 Bundle arguments = new Bundle();
@@ -55,11 +55,11 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements
5555 *
5656 *
5757 */
58- private void prepare(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
58+ private void prepare(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene)
5959 {
6060 try
6161 {
62- powerOffController = new CameraPowerOff(context, changeScene);
62+ powerOffController = new CameraPowerOffSony(context, changeScene);
6363 powerOffController.prepare();
6464
6565 logCatViewer = new LogCatViewer(changeScene);
@@ -290,6 +290,7 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements
290290 private void synchronizedProperty()
291291 {
292292 final FragmentActivity activity = getActivity();
293+ final boolean defaultValue = true;
293294 if (activity != null)
294295 {
295296 activity.runOnUiThread(new Runnable() {
@@ -298,8 +299,8 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements
298299 try
299300 {
300301 // 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);
302+ setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, defaultValue);
303+ setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue);
303304 }
304305 catch (Exception e)
305306 {
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -31,6 +31,7 @@
3131 <string name="pref_auto_connect_camera">カメラに自動接続</string>
3232 <string name="pref_summary_auto_connect_camera">通常、チェックを入れたままご使用ください</string>
3333 <string name="dialog_message_power_off">カメラの電源を切り、アプリケーションを終了します。</string>
34+ <string name="dialog_message_exit_application">アプリケーションを終了します。</string>
3435 <string name="pref_bluetooth_power_on">BLEでカメラ電源ON</string>
3536 <string name="pref_summary_bluetooth_power_on">起動時、BLEでカメラをONにします。</string>
3637
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -33,6 +33,7 @@
3333 <string name="pref_auto_connect_camera">Auto Connect To Camera</string>
3434 <string name="pref_summary_auto_connect_camera">Normally to keep ON.</string>
3535 <string name="dialog_message_power_off">Power Off</string>
36+ <string name="dialog_message_exit_application">Exit Application</string>
3637 <string name="pref_bluetooth_power_on">BLE Power On</string>
3738 <string name="pref_summary_bluetooth_power_on">Camera Power on via BLE</string>
3839
Afficher sur ancien navigateur de dépôt.