OSDN Git Service

OPC用のpreferenceを復活させた。レイアウトを少し調整。
authorMRSa <mrsa@myad.jp>
Fri, 17 Aug 2018 14:59:03 +0000 (23:59 +0900)
committerMRSa <mrsa@myad.jp>
Fri, 17 Aug 2018 14:59:03 +0000 (23:59 +0900)
12 files changed:
app/src/main/java/net/osdn/gokigen/gr2control/camera/CameraInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/IInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/olympus/myolycameraprops/LoadMyCameraPropertyFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceSynchronizer.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/gr2control/scene/CameraSceneUpdater.java
app/src/main/res/layout-land/fragment_live_view.xml
app/src/main/res/layout/fragment_live_view.xml
app/src/main/res/values/arrays.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_opc.xml [new file with mode: 0644]

index 7bbb6bd..1c639c9 100644 (file)
@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
 import android.support.annotation.NonNull;
 import android.support.v7.preference.PreferenceManager;
 
+import net.osdn.gokigen.gr2control.camera.olympus.IOlympusInterfaceProvider;
 import net.osdn.gokigen.gr2control.camera.olympus.wrapper.OlympusInterfaceProvider;
 import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
 import net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper.RicohGr2InterfaceProvider;
@@ -41,13 +42,13 @@ public class CameraInterfaceProvider implements IInterfaceProvider
         //sony = new SonyCameraWrapper(context, provider);
     }
 
-/*
     @Override
-    public IOlympusInterfaceProvider getOlympusInterface()
+    public IOlympusInterfaceProvider getOlympusInterfaceProvider()
     {
         return (olympus);
     }
 
+    /*
     @Override
     public IOlympusLiveViewListener getOlympusLiveViewListener()
     {
index 11d640b..25156ce 100644 (file)
@@ -1,5 +1,6 @@
 package net.osdn.gokigen.gr2control.camera;
 
+import net.osdn.gokigen.gr2control.camera.olympus.IOlympusInterfaceProvider;
 import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl;
 import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
 
@@ -28,6 +29,8 @@ public interface IInterfaceProvider
     ICameraHardwareStatus getHardwareStatus();
     ICameraRunMode getCameraRunMode();
 
+    IOlympusInterfaceProvider getOlympusInterfaceProvider();
+
     ICameraConnection.CameraConnectionMethod getCammeraConnectionMethod();
     void resetCameraConnectionMethod();
 }
index 39430da..8fcf1a9 100644 (file)
@@ -54,7 +54,7 @@ public class LoadMyCameraPropertyFragment extends ListFragment implements ListVi
             listItems.add(new MyCameraPropertySetItems(0, idHeader, prefTitle, prefDate));
         }
 
-        //String prefDate = preferences.getString(LoadSaveCameraProperties.DATE_KEY, "");
+        //String prefDate = preferences_opc.getString(LoadSaveCameraProperties.DATE_KEY, "");
         //listItems.add(new MyCameraPropertySetItems(0, "000", getString(R.string.auto_save_props), prefDate));
 
         MyCameraPropertyLoadArrayAdapter adapter = new MyCameraPropertyLoadArrayAdapter(getActivity(),  R.layout.column_load, listItems);
index 68826d1..6ffe0cd 100644 (file)
@@ -10,10 +10,6 @@ public interface IPreferencePropertyAccessor
     String EXIT_APPLICATION = "exit_application";
 
     String AUTO_CONNECT_TO_CAMERA = "auto_connect_to_camera";
-    String BLE_POWER_ON = "ble_power_on";
-
-    String TAKE_MODE =  "take_mode";
-    String TAKE_MODE_DEFAULT_VALUE =  "P";
 
     String SOUND_VOLUME_LEVEL = "sound_volume_level";
     String SOUND_VOLUME_LEVEL_DEFAULT_VALUE = "OFF";
@@ -42,8 +38,6 @@ public interface IPreferencePropertyAccessor
 
     String CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW = "capture_both_camera_and_live_view";
 
-    String OLYCAMERA_BLUETOOTH_SETTINGS = "olympus_air_bt";
-
     String CONNECTION_METHOD = "connection_method";
     String CONNECTION_METHOD_DEFAULT_VALUE = "RICOH_GR2";
 
diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceFragment.java
new file mode 100644 (file)
index 0000000..8844605
--- /dev/null
@@ -0,0 +1,462 @@
+package net.osdn.gokigen.gr2control.preference.olympus;
+
+import android.support.annotation.NonNull;
+import android.support.v4.app.FragmentActivity;
+import android.support.v7.app.AppCompatActivity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceFragmentCompat;
+import android.support.v7.preference.PreferenceManager;
+import android.util.Log;
+
+import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraHardwareStatus;
+import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
+import net.osdn.gokigen.gr2control.camera.IInterfaceProvider;
+import net.osdn.gokigen.gr2control.camera.olympus.operation.CameraPowerOff;
+import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraProperty;
+import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
+import net.osdn.gokigen.gr2control.logcat.LogCatViewer;
+import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
+import net.osdn.gokigen.gr2control.scene.IChangeScene;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import jp.co.olympus.camerakit.OLYCamera;
+
+
+/**
+ *   SettingFragment
+ *
+ */
+public class PreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, PreferenceSynchronizer.IPropertySynchronizeCallback
+{
+    private final String TAG = toString();
+    private IOlyCameraPropertyProvider propertyInterface = null;
+    private ICameraHardwareStatus hardwareStatusInterface = null;
+    private ICameraRunMode changeRunModeExecutor = null;
+    private CameraPowerOff powerOffController = null;
+    private LogCatViewer logCatViewer = null;
+    private SharedPreferences preferences = null;
+    private ProgressDialog busyDialog = null;
+    private PreferenceSynchronizer preferenceSynchronizer = null;
+
+
+    public static PreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
+    {
+        PreferenceFragment instance = new PreferenceFragment();
+        instance.setInterface(context, factory, changeScene);
+
+        // パラメータはBundleにまとめておく
+        Bundle arguments = new Bundle();
+        //arguments.putString("title", title);
+        //arguments.putString("message", message);
+        instance.setArguments(arguments);
+
+        return (instance);
+    }
+
+    /**
+     *
+     *
+     */
+    private void setInterface(@NonNull AppCompatActivity context, @NonNull IInterfaceProvider factory, @NonNull IChangeScene changeScene)
+    {
+        Log.v(TAG, "setInterface()");
+        this.propertyInterface = factory.getOlympusInterfaceProvider().getCameraPropertyProvider();
+        this.changeRunModeExecutor = factory.getCameraRunMode();
+        hardwareStatusInterface = factory.getHardwareStatus();
+        powerOffController = new CameraPowerOff(context, changeScene);
+        powerOffController.prepare();
+        logCatViewer = new LogCatViewer(changeScene);
+        logCatViewer.prepare();
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onAttach(Context activity)
+    {
+        super.onAttach(activity);
+        Log.v(TAG, "onAttach()");
+
+        // Preference をつかまえる
+        preferences = PreferenceManager.getDefaultSharedPreferences(activity);
+        if (preferenceSynchronizer == null)
+        {
+            preferenceSynchronizer = new PreferenceSynchronizer(this.propertyInterface, preferences, this);
+        }
+
+        // Preference を初期設定する
+        initializePreferences();
+
+        preferences.registerOnSharedPreferenceChangeListener(this);
+    }
+
+    /**
+     * Preferenceの初期化...
+     */
+    private void initializePreferences()
+    {
+        Map<String, ?> items = preferences.getAll();
+        SharedPreferences.Editor editor = preferences.edit();
+
+        if (!items.containsKey(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY))
+        {
+            editor.putString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE);
+        }
+        if (!items.containsKey(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL))
+        {
+            editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
+        }
+        if (!items.containsKey(IPreferencePropertyAccessor.RAW))
+        {
+            editor.putBoolean(IPreferencePropertyAccessor.RAW, true);
+        }
+        if (!items.containsKey(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA))
+        {
+            editor.putBoolean(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
+        }
+        if (!items.containsKey(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW))
+        {
+            editor.putBoolean(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
+        }
+        if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD))
+        {
+            editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
+        }
+        editor.apply();
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onCreatePreferences(Bundle savedInstanceState, String rootKey)
+    {
+        Log.v(TAG, "onCreatePreferences()");
+
+        //super.onCreate(savedInstanceState);
+        addPreferencesFromResource(R.xml.preferences_opc);
+
+        {
+            final HashMap<String, String> sizeTable = new HashMap<>();
+            sizeTable.put("QVGA", "(320x240)");
+            sizeTable.put("VGA", "(640x480)");
+            sizeTable.put("SVGA", "(800x600)");
+            sizeTable.put("XGA", "(1024x768)");
+            sizeTable.put("QUAD_VGA", "(1280x960)");
+
+            ListPreference liveViewQuality = (ListPreference) findPreference(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY);
+            liveViewQuality.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+                @Override
+                public boolean onPreferenceChange(Preference preference, Object newValue) {
+                    String key = (String) newValue;
+                    preference.setSummary(newValue + " " + sizeTable.get(key));
+                    return (true);
+                }
+            });
+            liveViewQuality.setSummary(liveViewQuality.getValue() + " " + sizeTable.get(liveViewQuality.getValue()));
+
+            ListPreference connectionMethod = (ListPreference) findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
+            connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+                @Override
+                public boolean onPreferenceChange(Preference preference, Object newValue) {
+                    preference.setSummary(newValue + " ");
+                    return (true);
+                }
+            });
+            connectionMethod.setSummary(connectionMethod.getValue() + " ");
+        }
+        findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
+        findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
+    }
+
+    /**
+     * ハードウェアのサマリ情報を取得し設定する
+     */
+    private void setHardwareSummary()
+    {
+        // レンズ状態
+        findPreference("lens_status").setSummary(hardwareStatusInterface.getLensMountStatus());
+
+        // メディア状態
+        findPreference("media_status").setSummary(hardwareStatusInterface.getMediaMountStatus());
+
+        // 焦点距離
+        String focalLength;
+        float minLength = hardwareStatusInterface.getMinimumFocalLength();
+        float maxLength = hardwareStatusInterface.getMaximumFocalLength();
+        float actualLength = hardwareStatusInterface.getActualFocalLength();
+        if (minLength == maxLength)
+        {
+            focalLength = String.format(Locale.ENGLISH, "%3.0fmm", actualLength);
+        }
+        else
+        {
+            focalLength = String.format(Locale.ENGLISH, "%3.0fmm - %3.0fmm (%3.0fmm)", minLength, maxLength, actualLength);
+        }
+        findPreference("focal_length").setSummary(focalLength);
+
+        // カメラのバージョン
+        try
+        {
+            Map<String, Object> hardwareInformation = hardwareStatusInterface.inquireHardwareInformation();
+            findPreference("camera_version").setSummary((String) hardwareInformation.get(OLYCamera.HARDWARE_INFORMATION_CAMERA_FIRMWARE_VERSION_KEY));
+
+            // 取得した一覧はログに出力する。)
+            Log.v(TAG, "- - - - - - - - - -");
+            for (Map.Entry<String, Object> entry : hardwareInformation.entrySet())
+            {
+                String value = (String) entry.getValue();
+                Log.v(TAG, entry.getKey() + " : " + value);
+            }
+            Log.v(TAG, "- - - - - - - - - -");
+        }
+        catch (Exception e)
+        {
+            findPreference("camera_version").setSummary("Unknown");
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    private void setCameraProperty(String name, String value)
+    {
+        try
+        {
+            String propertyValue = "<" + name + "/" + value + ">";
+            Log.v(TAG, "setCameraProperty() : " + propertyValue);
+            propertyInterface.setCameraPropertyValue(name, propertyValue);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onResume()
+    {
+        super.onResume();
+        Log.v(TAG, "onResume() Start");
+
+        // 撮影モードかどうかを確認して、撮影モードではなかったら撮影モードに切り替える
+        if ((changeRunModeExecutor != null) && (!changeRunModeExecutor.isRecordingMode()))
+        {
+            // Runモードを切り替える。(でも切り替えると、設定がクリアされてしまう...。
+            changeRunModeExecutor.changeRunMode(true);
+        }
+        synchronizeCameraProperties(true);
+        Log.v(TAG, "onResume() End");
+
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onPause()
+    {
+        super.onPause();
+        Log.v(TAG, "onPause() Start");
+
+        // Preference変更のリスナを解除
+        preferences.unregisterOnSharedPreferenceChangeListener(this);
+
+        Log.v(TAG, "onPause() End");
+    }
+
+    /**
+     * カメラプロパティとPreferenceとの同期処理を実行
+     */
+    private void synchronizeCameraProperties(boolean isPropertyLoad)
+    {
+        // 実行中ダイアログを取得する
+        busyDialog = new ProgressDialog(getActivity());
+        busyDialog.setTitle(getString(R.string.dialog_title_loading_properties));
+        busyDialog.setMessage(getString(R.string.dialog_message_loading_properties));
+        busyDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+        busyDialog.setCancelable(false);
+        busyDialog.show();
+
+        // データ読み込み処理(別スレッドで実行)
+        if (isPropertyLoad)
+        {
+            new Thread(preferenceSynchronizer).start();
+        }
+    }
+
+    /**
+     * Preferenceが更新された時に呼び出される処理
+     *
+     * @param sharedPreferences sharedPreferences
+     * @param key               変更されたキー
+     */
+    @Override
+    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
+    {
+        Log.v(TAG, "onSharedPreferenceChanged() : " + key);
+        String propertyValue;
+        boolean value;
+        if (key != null)
+        {
+            switch (key)
+            {
+                case IPreferencePropertyAccessor.RAW:
+                    value = preferences.getBoolean(key, true);
+                    setBooleanPreference(key, key, value);
+                    propertyValue = (value) ? "ON" : "OFF";
+                    setCameraProperty(IOlyCameraProperty.RAW, propertyValue);
+                    break;
+
+                case IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA:
+                    value = preferences.getBoolean(key, true);
+                    Log.v(TAG, " " + key + " , " + value);
+                    break;
+
+                case IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW:
+                    value = preferences.getBoolean(key, true);
+                    Log.v(TAG, " " + key + " , " + value);
+                    break;
+
+                default:
+                    String strValue = preferences.getString(key, "");
+                    setListPreference(key, key, strValue);
+                    String propertyKey = convertKeyFromPreferenceToCameraPropertyKey(key);
+                    if (propertyKey != null)
+                    {
+                        setCameraProperty(propertyKey, strValue);
+                    }
+                    break;
+            }
+        }
+    }
+
+    /**
+     * ListPreference の表示データを設定
+     *
+     * @param pref_key     Preference(表示)のキー
+     * @param key          Preference(データ)のキー
+     * @param defaultValue Preferenceのデフォルト値
+     */
+    private void setListPreference(String pref_key, String key, String defaultValue)
+    {
+        ListPreference pref;
+        pref = (ListPreference) findPreference(pref_key);
+        String value = preferences.getString(key, defaultValue);
+        if (pref != null)
+        {
+            pref.setValue(value);
+            pref.setSummary(value);
+        }
+    }
+
+    /**
+     * BooleanPreference の表示データを設定
+     *
+     * @param pref_key     Preference(表示)のキー
+     * @param key          Preference(データ)のキー
+     * @param defaultValue Preferenceのデフォルト値
+     */
+    private void setBooleanPreference(String pref_key, String key, boolean defaultValue)
+    {
+        CheckBoxPreference pref = (CheckBoxPreference) findPreference(pref_key);
+        if (pref != null)
+        {
+            boolean value = preferences.getBoolean(key, defaultValue);
+            pref.setChecked(value);
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    private String convertKeyFromPreferenceToCameraPropertyKey(String key)
+    {
+        String target = null;
+        if (key == null)
+        {
+            return (null);
+        }
+        switch (key)
+        {
+            case IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL:
+                target = IOlyCameraProperty.SOUND_VOLUME_LEVEL;
+                break;
+
+            default:
+                // target == null
+                break;
+        }
+        return (target);
+    }
+
+    /**
+     * カメラプロパティの同期処理終了通知
+     */
+    @Override
+    public void synchronizedProperty()
+    {
+        FragmentActivity activity = getActivity();
+        if (activity == null)
+        {
+            try
+            {
+                busyDialog.dismiss();
+                busyDialog = null;
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+            return;
+        }
+        activity.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    // Preferenceの画面に反映させる
+                    setListPreference(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL_DEFAULT_VALUE);
+                    setBooleanPreference(IPreferencePropertyAccessor.RAW, IPreferencePropertyAccessor.RAW, true);
+                    setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
+
+                    // カメラキットのバージョン
+                    findPreference(IPreferencePropertyAccessor.CAMERAKIT_VERSION).setSummary(OLYCamera.getVersion());
+                    if (hardwareStatusInterface != null)
+                    {
+                        // その他のハードウェア情報の情報設定
+                        setHardwareSummary();
+                    }
+
+                    // 実行中ダイアログを消す
+                    busyDialog.dismiss();
+                    busyDialog = null;
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+}
diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceSynchronizer.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/olympus/PreferenceSynchronizer.java
new file mode 100644 (file)
index 0000000..9384e19
--- /dev/null
@@ -0,0 +1,62 @@
+package net.osdn.gokigen.gr2control.preference.olympus;
+
+import android.content.SharedPreferences;
+import android.util.Log;
+
+import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.CameraPropertyUtilities;
+import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraProperty;
+import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
+import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
+
+
+class PreferenceSynchronizer implements Runnable
+{
+    private final String TAG = toString();
+    private final IOlyCameraPropertyProvider propertyInterface;
+    private final SharedPreferences preference;
+    private final IPropertySynchronizeCallback callback;
+
+    PreferenceSynchronizer(IOlyCameraPropertyProvider propertyInterface, SharedPreferences preference, IPropertySynchronizeCallback callback)
+    {
+        this.propertyInterface = propertyInterface;
+        this.preference = preference;
+        this.callback = callback;
+    }
+
+    private String getPropertyValue(String key)
+    {
+        String propertyValue;
+        try
+        {
+            String value = propertyInterface.getCameraPropertyValue(key);
+            propertyValue = CameraPropertyUtilities.getPropertyValue(value);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            propertyValue = "";
+        }
+        Log.v(TAG, "getPropertyValue(" + key + ") : " + propertyValue);
+        return (propertyValue);
+    }
+
+    @Override
+    public void run()
+    {
+        Log.v(TAG, "run()");
+        SharedPreferences.Editor editor = preference.edit();
+        editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, getPropertyValue(IOlyCameraProperty.SOUND_VOLUME_LEVEL));
+        boolean value = getPropertyValue(IOlyCameraProperty.RAW).equals("ON");
+        editor.putBoolean(IPreferencePropertyAccessor.RAW, value);
+        editor.apply();
+        if (callback != null)
+        {
+            callback.synchronizedProperty();
+        }
+    }
+
+    interface IPropertySynchronizeCallback
+    {
+        void synchronizedProperty();
+    }
+}
index 9a2f123..4e6e899 100644 (file)
@@ -13,6 +13,7 @@ import net.osdn.gokigen.gr2control.camera.IInterfaceProvider;
 import net.osdn.gokigen.gr2control.liveview.IStatusViewDrawer;
 import net.osdn.gokigen.gr2control.logcat.LogCatFragment;
 import net.osdn.gokigen.gr2control.playback.ImageGridViewFragment;
+import net.osdn.gokigen.gr2control.preference.olympus.PreferenceFragment;
 import net.osdn.gokigen.gr2control.preference.ricohgr2.RicohGr2PreferenceFragment;
 
 /**
@@ -198,18 +199,16 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene
             {
                 try
                 {
-                    preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this);
-/*
+                    //preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this);
                     ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
                     if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2) {
-                        preferenceFragment = RicohGr2PreferenceFragment.newInstance(this, this);
-                    } else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY) {
-                        preferenceFragment = SonyPreferenceFragment.newInstance(this, this);
+                        preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this);
+                    //} else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY) {
+                    //    preferenceFragment = SonyPreferenceFragment.newInstance(this, this);
                     } else //  if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
                     {
-                        preferenceFragment = PreferenceFragment.newInstance(this, interfaceProvider, this);
+                        preferenceFragment = PreferenceFragment.newInstance(activity, interfaceProvider, this);
                     }
-*/
                 }
                 catch (Exception e)
                 {
index 6ed40f1..b3dbe3e 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:ignore="HardcodedText,ContentDescription" >
index 6b68857..6dd4c03 100644 (file)
         </LinearLayout>
 
         <LinearLayout
-            android:id="@+id/spacer1Layout"
+            android:id="@+id/spacer0Layout"
             android:orientation="horizontal"
             android:layout_width="fill_parent"
             android:layout_height="0dip"
             android:layout_weight="1"
             android:background="@color/colorBlack">
+        </LinearLayout>
 
+        <LinearLayout
+            android:id="@+id/spacer1Layout"
+            android:orientation="horizontal"
+            android:layout_width="fill_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:background="@color/colorBlack">
         </LinearLayout>
 
         <LinearLayout
             android:layout_weight="2"
             android:background="@color/colorBlack">
 
+            <ImageView
+                android:id="@+id/area_spacer1"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+<!--
+            <ImageView
+                android:id="@+id/area_spacer2"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+-->
             <ImageButton
                 android:id="@+id/shutter_button"
                 android:layout_width="match_parent"
                 android:src="@drawable/ic_camera_black_24dp"
                 android:gravity="center" />
 
+            <ImageView
+                android:id="@+id/area_spacer3"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+<!--
+            <ImageView
+                android:id="@+id/area_spacer4"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+-->
         </LinearLayout>
 
         <LinearLayout
             android:background="@color/colorBlack">
 
             <ImageView
+                android:id="@+id/area_spacer01"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
+                android:id="@+id/area_spacer02"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
+                android:id="@+id/area_spacer03"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
+                android:id="@+id/area_spacer04"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
+                android:id="@+id/area_spacer05"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
+                android:id="@+id/area_spacer06"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="2"
+                android:clickable="true"
+                android:focusable="true"
+                android:gravity="center"
+                android:scaleType="fitCenter"
+                android:visibility="invisible" />
+
+            <ImageView
                 android:id="@+id/focusUnlockImageView"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
                 android:layout_weight="1"
                 android:scaleType="fitCenter"
                 android:clickable="true"
                 android:src="@drawable/ic_crop_free_black_24dp"
                 android:layout_marginBottom="10dp"
                 android:gravity="center" />
-
         </LinearLayout>
 
         <LinearLayout
index e1f6d45..5fc136c 100644 (file)
         <item>Partial</item>
         <item>Other</item>
     </string-array>
+
+    <string-array name="sound_volume_level">
+        <item >OFF</item>
+        <item >1</item>
+        <item >2</item>
+        <item >3</item>
+        <item >4</item>
+        <item >5</item>
+    </string-array>
+
+    <string-array name="sound_volume_level_value">
+        <item >OFF</item>
+        <item >1</item>
+        <item >2</item>
+        <item >3</item>
+        <item >4</item>
+        <item >5</item>
+    </string-array>
+
+    <string-array name="live_view_quality">
+        <item >QVGA (320x240)</item>
+        <item >VGA (640x480)</item>
+        <item >SVGA (800x600)</item>
+        <item >XGA (1024x768)</item>
+        <item >QUAD VGA (1280x960)</item>
+    </string-array>
+
+    <string-array name="live_view_quality_value">
+        <item >QVGA</item>
+        <item >VGA</item>
+        <item >SVGA</item>
+        <item >XGA</item>
+        <item >QUAD_VGA</item>
+    </string-array>
+
 </resources>
index 42d532b..2c01434 100644 (file)
     <string name="exif_metering_mode_title">Metering Mode :</string>
     <string name="exif_custom_process_title">(Custom Image Processing)</string>    
     <string name="exif_with_gps">(with Geolocation)</string>
+
+    <string name="pref_camera_sound_volume">Shutter Sound</string>
+    <string name="pref_take_raw">Take Raw</string>
+
+    <string name="pref_cat_live_view">Live View Settings</string>
+    <string name="pref_live_view_quality">Live View Quality</string>
+
+    <string name="pref_cat_info">Information</string>
+    <string name="pref_focal_length">Focal Length</string>
+    <string name="pref_lens_status">Lens Status</string>
+    <string name="pref_media_status">SD Card Status</string>
+    <string name="pref_camera_version">Camera Version</string>
+    <string name="pref_camerakit_version">Camera kit Version</string>
+
 </resources>
diff --git a/app/src/main/res/xml/preferences_opc.xml b/app/src/main/res/xml/preferences_opc.xml
new file mode 100644 (file)
index 0000000..8cb33ab
--- /dev/null
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+    <PreferenceCategory
+        android:title="@string/pref_cat_application_control">
+
+        <PreferenceScreen
+            android:key="exit_application"
+            android:icon="@drawable/ic_power_settings_new_black_24dp"
+            android:title="@string/pref_exit_power_off" />
+
+        <ListPreference
+            android:title="@string/pref_connection_method"
+            android:entryValues="@array/connection_method_value"
+            android:entries="@array/connection_method"
+            android:key="connection_method"
+            android:defaultValue="OPC"/>
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_camera">
+
+        <ListPreference
+            android:title="@string/pref_camera_sound_volume"
+            android:entryValues="@array/sound_volume_level_value"
+            android:entries="@array/sound_volume_level"
+            android:key="sound_volume_level"
+            android:defaultValue="OFF"/>
+
+        <CheckBoxPreference
+            android:key="raw"
+            android:title="@string/pref_take_raw" />
+
+        <CheckBoxPreference
+            android:key="capture_both_camera_and_live_view"
+            android:title="@string/pref_capture_both_camera_and_live_view" />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_live_view">
+        <ListPreference
+            android:title="@string/pref_live_view_quality"
+            android:entryValues="@array/live_view_quality_value"
+            android:entries="@array/live_view_quality"
+            android:key="live_view_quality"
+            android:defaultValue="VGA"/>
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_info">
+        <PreferenceScreen
+            android:key="focal_length"
+            android:title="@string/pref_focal_length"
+            android:selectable="false" />
+
+        <PreferenceScreen
+            android:key="lens_status"
+            android:title="@string/pref_lens_status"
+            android:selectable="false" />
+
+        <PreferenceScreen
+            android:key="media_status"
+            android:title="@string/pref_media_status"
+            android:selectable="false" />
+
+        <PreferenceScreen
+            android:key="camera_version"
+            android:title="@string/pref_camera_version"
+            android:selectable="false" />
+
+        <PreferenceScreen
+        android:key="camerakit_version"
+        android:title="@string/pref_camerakit_version"
+        android:selectable="false" />
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_initialize">
+
+        <CheckBoxPreference
+        android:key="auto_connect_to_camera"
+        android:title="@string/pref_auto_connect_camera"
+        android:summary="@string/pref_summary_auto_connect_camera" />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_gokigen">
+
+        <Preference
+            android:key="instruction_link"
+            android:title="@string/pref_instruction_manual"
+            android:summary="https://osdn.net/projects/gokigen/wiki/A01d"
+            android:selectable="true">
+            <intent android:action="android.intent.action.VIEW"
+                android:data="https://osdn.net/projects/gokigen/wiki/A01d" />
+        </Preference>
+
+        <Preference
+            android:key="privacy_policy"
+            android:title="@string/pref_privacy_policy"
+            android:summary="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy"
+            android:selectable="true">
+            <intent android:action="android.intent.action.VIEW"
+                android:data="https://osdn.net/projects/gokigen/wiki/PrivacyPolicy" />
+        </Preference>
+
+        <PreferenceScreen
+            android:key="debug_info"
+            android:title="@string/pref_degug_info"
+            android:summary="@string/pref_summary_debug_info" />
+
+    </PreferenceCategory>
+</PreferenceScreen>