OSDN Git Service

Preferenceを階層化して整理。
authorMRSa <mrsa@myad.jp>
Tue, 5 May 2020 11:54:15 +0000 (20:54 +0900)
committerMRSa <mrsa@myad.jp>
Tue, 5 May 2020 11:54:15 +0000 (20:54 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewClickTouchListener.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/Gr2ControlPreferenceFragment.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/gr2control/scene/CameraSceneUpdater.java
app/src/main/java/net/osdn/gokigen/gr2control/scene/IChangeScene.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_fuji_x.xml
app/src/main/res/xml/preferences_opc.xml
app/src/main/res/xml/preferences_ricoh_gr2.xml
app/src/main/res/xml/preferences_summary.xml [new file with mode: 0644]

index 13c398d..2610c37 100644 (file)
@@ -132,7 +132,7 @@ class LiveViewClickTouchListener implements View.OnClickListener, View.OnTouchLi
 
                 case R.id.show_preference_button:
                     // カメラの設定
-                    changeScene.changeSceneToConfiguration();
+                    changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.UNKNOWN);
                     isVibrate = true;
                     break;
 
diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/preference/Gr2ControlPreferenceFragment.java b/app/src/main/java/net/osdn/gokigen/gr2control/preference/Gr2ControlPreferenceFragment.java
new file mode 100644 (file)
index 0000000..bcbdeae
--- /dev/null
@@ -0,0 +1,437 @@
+package net.osdn.gokigen.gr2control.preference;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.util.Log;
+
+import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
+import net.osdn.gokigen.gr2control.logcat.LogCatViewer;
+import net.osdn.gokigen.gr2control.scene.IChangeScene;
+
+import java.util.Map;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.FragmentActivity;
+import androidx.preference.CheckBoxPreference;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.PreferenceManager;
+
+public class Gr2ControlPreferenceFragment  extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
+{
+    private final String TAG = toString();
+    private IChangeScene changeScene = null;
+    private AppCompatActivity context = null;
+    private SharedPreferences preferences = null;
+    private LogCatViewer logCatViewer = null;
+
+    /**
+     *
+     *
+     */
+    public static Gr2ControlPreferenceFragment newInstance(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene)
+    {
+        Gr2ControlPreferenceFragment instance = new Gr2ControlPreferenceFragment();
+        instance.prepare(context, changeScene);
+
+        // パラメータはBundleにまとめておく
+        Bundle arguments = new Bundle();
+        //arguments.putString("title", title);
+        //arguments.putString("message", message);
+        instance.setArguments(arguments);
+
+        return (instance);
+    }
+
+    /**
+     *
+     *
+     */
+    private void prepare(@NonNull AppCompatActivity context, @NonNull IChangeScene changeScene)
+    {
+        try
+        {
+            logCatViewer = new LogCatViewer(changeScene);
+            logCatViewer.prepare();
+            this.changeScene = changeScene;
+            this.context = context;
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onAttach(@NonNull Context activity)
+    {
+        super.onAttach(activity);
+        Log.v(TAG, " onAttach()");
+        try
+        {
+            // Preference をつかまえる
+            preferences = PreferenceManager.getDefaultSharedPreferences(activity);
+
+            // Preference を初期設定する
+            initializePreferences();
+
+            preferences.registerOnSharedPreferenceChangeListener(this);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Preferenceの初期化...
+     *
+     */
+    private void initializePreferences()
+    {
+        try
+        {
+            Map<String, ?> items = preferences.getAll();
+            SharedPreferences.Editor editor = preferences.edit();
+
+            if (!items.containsKey(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT))
+            {
+                editor.putString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE);
+            }
+            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, false);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD))
+            {
+                editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.SHARE_AFTER_SAVE)) {
+                editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) {
+                editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) {
+                editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.GR2_LCD_SLEEP)) {
+                editor.putBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) {
+                editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF)) {
+                editor.putBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW)) {
+                editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW, false);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_FOCUS_XY)) {
+                editor.putString(IPreferencePropertyAccessor.FUJI_X_FOCUS_XY, IPreferencePropertyAccessor.FUJI_X_FOCUS_XY_DEFAULT_VALUE);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT)) {
+                editor.putString(IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT, IPreferencePropertyAccessor.FUJI_X_LIVEVIEW_WAIT_DEFAULT_VALUE);
+            }
+            if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) {
+                editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE);
+            }
+            editor.apply();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
+    {
+        Log.v(TAG, " onSharedPreferenceChanged() : " + key);
+        boolean value;
+        if (key != null)
+        {
+            switch (key)
+            {
+                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, false);
+                    Log.v(TAG, " BOTH LV : " + key + " , " + value);
+                    break;
+
+                case IPreferencePropertyAccessor.USE_PLAYBACK_MENU:
+                    value = preferences.getBoolean(key, true);
+                    Log.v(TAG, " PLAYBACK MENU : " + key + " , " + value);
+                    break;
+
+                case IPreferencePropertyAccessor.SHARE_AFTER_SAVE:
+                    value = preferences.getBoolean(key, false);
+                    Log.v(TAG, " SHARE : " + key + " , " + value);
+                    break;
+
+                default:
+                    String strValue = preferences.getString(key, "");
+                    setListPreference(key, key, strValue);
+                    break;
+            }
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onCreatePreferences(Bundle savedInstanceState, String rootKey)
+    {
+        Log.v(TAG, " onCreatePreferences()");
+        try
+        {
+            //super.onCreate(savedInstanceState);
+            addPreferencesFromResource(R.xml.preferences_summary);
+
+            ListPreference connectionMethod = findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
+            if (connectionMethod != null)
+            {
+                connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+                    @Override
+                    public boolean onPreferenceChange(Preference preference, Object newValue) {
+                        preference.setSummary(newValue + " ");
+                        return (true);
+                    }
+                });
+                connectionMethod.setSummary(connectionMethod.getValue() + " ");
+            }
+
+            Preference opcPreference = findPreference("opc_settings");
+            if (opcPreference != null)
+            {
+                opcPreference.setOnPreferenceClickListener(this);
+            }
+            Preference gr2Preference = findPreference("ricoh_settings");
+            if (gr2Preference != null)
+            {
+                gr2Preference.setOnPreferenceClickListener(this);
+            }
+            Preference fujiXPreference = findPreference("fuji_x_settings");
+            if (fujiXPreference != null)
+            {
+                fujiXPreference.setOnPreferenceClickListener(this);
+            }
+
+            Preference debug = findPreference("debug_info");
+            if (debug != null)
+            {
+                debug.setOnPreferenceClickListener(logCatViewer);
+            }
+
+            Preference wifi = findPreference("wifi_settings");
+            if (wifi != null)
+            {
+                wifi.setOnPreferenceClickListener(this);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onResume()
+    {
+        super.onResume();
+        Log.v(TAG, " onResume() Start");
+        try
+        {
+            synchronizedProperty();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        Log.v(TAG, " onResume() End");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onPause()
+    {
+        super.onPause();
+        Log.v(TAG, " onPause() Start");
+        try
+        {
+            // Preference変更のリスナを解除
+            preferences.unregisterOnSharedPreferenceChangeListener(this);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        Log.v(TAG, " onPause() End");
+    }
+
+    /**
+     * ListPreference の表示データを設定
+     *
+     * @param pref_key     Preference(表示)のキー
+     * @param key          Preference(データ)のキー
+     * @param defaultValue Preferenceのデフォルト値
+     */
+    private void setListPreference(String pref_key, String key, String defaultValue)
+    {
+        try
+        {
+            ListPreference pref;
+            pref = findPreference(pref_key);
+            String value = preferences.getString(key, defaultValue);
+            if (pref != null)
+            {
+                pref.setValue(value);
+                pref.setSummary(value);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * BooleanPreference の表示データを設定
+     *
+     * @param pref_key     Preference(表示)のキー
+     * @param key          Preference(データ)のキー
+     * @param defaultValue Preferenceのデフォルト値
+     */
+    private void setBooleanPreference(String pref_key, String key, boolean defaultValue)
+    {
+        try
+        {
+            CheckBoxPreference pref = findPreference(pref_key);
+            if (pref != null)
+            {
+                boolean value = preferences.getBoolean(key, defaultValue);
+                pref.setChecked(value);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    private void synchronizedProperty()
+    {
+        final FragmentActivity activity = getActivity();
+        if (activity != null)
+        {
+            activity.runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    try
+                    {
+                        // Preferenceの画面に反映させる
+                        setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
+                        setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, false);
+                        setBooleanPreference(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, IPreferencePropertyAccessor.USE_PLAYBACK_MENU, true);
+                        setBooleanPreference(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false);
+                    }
+                    catch (Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+    }
+
+
+    @Override
+    public boolean onPreferenceClick(Preference preference)
+    {
+        try
+        {
+            String preferenceKey = preference.getKey();
+            Log.v(TAG, " onPreferenceClick() : " + preferenceKey);
+            if (preferenceKey.contains("wifi_settings"))
+            {
+                // Wifi 設定画面を表示する
+                Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+                if (context != null)
+                {
+                    context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+                }
+            }
+            else if (preferenceKey.contains("ricoh_settings"))
+            {
+                changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.RICOH_GR2);
+            }
+            else if (preferenceKey.contains("fuji_x_settings"))
+            {
+                changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.FUJI_X);
+            }
+            else if (preferenceKey.contains("opc_settings"))
+            {
+                changeScene.changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod.OPC);
+            }
+            else
+            {
+                return (false);
+            }
+            return (true);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (false);
+    }
+}
index c0a3ce6..f01fa10 100644 (file)
@@ -9,6 +9,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.Gr2ControlPreferenceFragment;
 import net.osdn.gokigen.gr2control.preference.fuji_x.FujiXPreferenceFragment;
 import net.osdn.gokigen.gr2control.preference.olympus.PreferenceFragment;
 import net.osdn.gokigen.gr2control.preference.ricohgr2.RicohGr2PreferenceFragment;
@@ -30,6 +31,10 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene
     private IStatusViewDrawer statusViewDrawer;
 
     private PreferenceFragmentCompat preferenceFragment = null;
+    private PreferenceFragmentCompat preferenceFragmentOpc = null;
+    private PreferenceFragmentCompat preferenceFragmentRicoh = null;
+    private PreferenceFragmentCompat preferenceFragmentFujiX = null;
+
     private LogCatFragment logCatFragment = null;
     private ImageGridViewFragment imageGridViewFragment = null;
 
@@ -194,37 +199,41 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene
 
     //  IChangeScene
     @Override
-    public void changeSceneToConfiguration()
+    public void changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod connectionMethod)
     {
         try
         {
-            if (preferenceFragment == null)
+            if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
             {
-                try
-                {
-                    //preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this);
-                    ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
-                    if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2) {
-                        preferenceFragment = RicohGr2PreferenceFragment.newInstance(activity, this);
-                    //} else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY) {
-                    //    preferenceFragment = SonyPreferenceFragment.newInstance(this, this);
-                    }
-                    else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
-                    {
-                        preferenceFragment = FujiXPreferenceFragment.newInstance(activity, this);
-                    }
-                    else //  if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
-                    {
-                        preferenceFragment = PreferenceFragment.newInstance(activity, interfaceProvider, this);
-                    }
-                }
-                catch (Exception e)
-                {
-                    e.printStackTrace();
-                    //preferenceFragment = SonyPreferenceFragment.newInstance(this, this);
-                }
+                changeSceneToRicohConfiguration();
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X)
+            {
+                changeSceneToFujiXConfiguration();
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
+            {
+                changeSceneToOpcConfiguration();
             }
+            else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.UNKNOWN)
+            {
+                changeSceneToSummaryConfiguration();
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
 
+    private void changeSceneToSummaryConfiguration()
+    {
+        try
+        {
+            if (preferenceFragment == null)
+            {
+                preferenceFragment = Gr2ControlPreferenceFragment.newInstance(activity, this);
+            }
             FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
             transaction.replace(R.id.fragment1, preferenceFragment);
             // backstackに追加
@@ -237,6 +246,66 @@ public class CameraSceneUpdater implements ICameraStatusReceiver, IChangeScene
         }
     }
 
+    private void changeSceneToOpcConfiguration()
+    {
+        try
+        {
+            if (preferenceFragmentOpc == null)
+            {
+                preferenceFragmentOpc = PreferenceFragment.newInstance(activity, interfaceProvider, this);
+            }
+            FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
+            transaction.replace(R.id.fragment1, preferenceFragmentOpc);
+            // backstackに追加
+            transaction.addToBackStack(null);
+            transaction.commit();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void changeSceneToRicohConfiguration()
+    {
+        try
+        {
+            if (preferenceFragmentRicoh == null)
+            {
+                preferenceFragmentRicoh = RicohGr2PreferenceFragment.newInstance(activity, this);
+            }
+            FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
+            transaction.replace(R.id.fragment1, preferenceFragmentRicoh);
+            // backstackに追加
+            transaction.addToBackStack(null);
+            transaction.commit();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void changeSceneToFujiXConfiguration()
+    {
+        try
+        {
+            if (preferenceFragmentFujiX == null)
+            {
+                preferenceFragmentFujiX = FujiXPreferenceFragment.newInstance(activity, this);
+            }
+            FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
+            transaction.replace(R.id.fragment1, preferenceFragmentFujiX);
+            // backstackに追加
+            transaction.addToBackStack(null);
+            transaction.commit();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
     //  IChangeScene
     @Override
     public void changeCameraConnection()
index 9dc4c7b..92fdc3f 100644 (file)
@@ -1,12 +1,14 @@
 package net.osdn.gokigen.gr2control.scene;
 
+import net.osdn.gokigen.gr2control.camera.ICameraConnection;
+
 /**
  *
  */
 public interface IChangeScene
 {
     void changeSceneToCameraPropertyList();
-    void changeSceneToConfiguration();
+    void changeSceneToConfiguration(ICameraConnection.CameraConnectionMethod connectionMethod);
     void changeCameraConnection();
     void changeSceneToDebugInformation();
     void changeSceneToApiList();
index 227b231..1710652 100644 (file)
     <string name="pref_fujix_focus_xy">フォーカス点数[X,Y] (default: 7,7)</string>
     <string name="pref_summary_fujix_focus_xy">接続するカメラに合わせてフォーカス点数を指定します</string>
     <string name="pref_fujix_liveview_wait">LV画像受信待ち間隔(default: 80)</string>
-    <string name="pref_summary_fujix_liveview_wait">ライブビュー画像受信間隔を指定します</string>
+    <string name="pref_summary_fujix_liveview_wait">ライブビュー画像受信待ち間隔を指定します。(単位:ms)</string>
     <string name="pref_fujix_command_polling_wait">コマンド間隔(default: 500)</string>
     <string name="pref_summary_fujix_command_polling_wait">カメラ状態の確認間隔を調整します</string>
     <string name="pref_special_thanks">Special Thanks to</string>
     <string name="shutter_speed">Shutter</string>
     <string name="aperture">Aperture</string>
 
+    <string name="pref_ricoh_settings">RICOH GR/PENTAX用設定</string>
+    <string name="pref_summary_ricoh_settings"> </string>
+
+    <string name="pref_fuji_x_settings">Fujifilm X用設定</string>
+    <string name="pref_summary_fuji_x_settings"> </string>
+
+    <string name="pref_opc_settings">Olympus Air用設定</string>
+    <string name="pref_summary_opc_settings"> </string>
+
+    <string name="pref_fuji_x_exit_only">アプリ終了 (FUJI)</string>
+    <string name="pref_opc_exit_power_off">アプリ終了 (OPC)</string>
+    <string name="pref_ricoh_exit_power_off">アプリ終了 (RICOH)</string>
 </resources>
index a4c64f4..9504cf2 100644 (file)
 
     <string name="shutter_speed">Shutter</string>
     <string name="aperture">Aperture</string>
+
+    <string name="pref_ricoh_settings">RICOH GR/PENTAX Settings</string>
+    <string name="pref_summary_ricoh_settings"> </string>
+
+    <string name="pref_fuji_x_settings">Fujifilm X Settings</string>
+    <string name="pref_summary_fuji_x_settings"> </string>
+
+    <string name="pref_opc_settings">Olympus Air Settings</string>
+    <string name="pref_summary_opc_settings"> </string>
+
+    <string name="pref_fuji_x_exit_only">Exit Application (FUJI)</string>
+    <string name="pref_opc_exit_power_off">Exit Application (OPC)</string>
+    <string name="pref_ricoh_exit_power_off">Exit Application (RICOH)</string>
 </resources>
index f128942..66c78a8 100644 (file)
@@ -6,8 +6,8 @@
         <PreferenceScreen
             android:key="exit_application"
             android:icon="@drawable/ic_power_settings_new_black_24dp"
-            android:title="@string/pref_exit_only" />
-
+            android:title="@string/pref_fuji_x_exit_only" />
+<!--
         <ListPreference
             android:title="@string/pref_connection_method"
             android:entryValues="@array/connection_method_value"
             android:key="wifi_settings"
             android:title="@string/pref_wifi_settings"
             android:summary="@string/pref_summary_wifi_settings" />
-
+-->
     </PreferenceCategory>
 
     <PreferenceCategory
         android:title="@string/pref_cat_camera">
-
+<!--
         <CheckBoxPreference
             android:key="capture_both_camera_and_live_view"
             android:title="@string/pref_capture_both_camera_and_live_view" />
-
+-->
         <CheckBoxPreference
             android:key="fujix_display_camera_view"
             android:title="@string/pref_fujix_display_camera_view"
@@ -53,7 +53,7 @@
             android:summary="@string/pref_summary_fujix_liveview_wait" />
 
     </PreferenceCategory>
-
+<!--
     <PreferenceCategory
         android:title="@string/pref_cat_initialize">
 
             android:title="@string/pref_auto_connect_camera"
             android:summary="@string/pref_summary_auto_connect_camera" />
     </PreferenceCategory>
+-->
 
     <PreferenceCategory
         android:title="@string/pref_cat_others">
-
+<!--
         <CheckBoxPreference
             android:key="share_after_save"
             android:title="@string/pref_call_share_after_save" />
@@ -74,6 +75,7 @@
             android:key="use_playback_menu"
             android:title="@string/pref_use_playback_menu"
             android:summary="@string/summary_use_playback_menu" />
+-->
 
         <Preference
             android:key="special_thanks"
@@ -83,9 +85,8 @@
             <intent android:action="android.intent.action.VIEW"
                 android:data="https://github.com/hkr/fuji-cam-wifi-tool" />
         </Preference>
-
     </PreferenceCategory>
-
+<!--
     <PreferenceCategory
         android:title="@string/pref_cat_gokigen">
 
             android:key="debug_info"
             android:title="@string/pref_degug_info"
             android:summary="@string/pref_summary_debug_info" />
-
     </PreferenceCategory>
+-->
 </PreferenceScreen>
index afe9783..0debb51 100644 (file)
@@ -6,8 +6,8 @@
         <PreferenceScreen
             android:key="exit_application"
             android:icon="@drawable/ic_power_settings_new_black_24dp"
-            android:title="@string/pref_exit_power_off" />
-
+            android:title="@string/pref_opc_exit_power_off" />
+<!--
         <ListPreference
             android:title="@string/pref_connection_method"
             android:entryValues="@array/connection_method_value"
@@ -19,7 +19,7 @@
             android:key="wifi_settings"
             android:title="@string/pref_wifi_settings"
             android:summary="@string/pref_summary_wifi_settings" />
-
+-->
     </PreferenceCategory>
 
     <PreferenceCategory
         <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
@@ -53,6 +53,7 @@
 
     </PreferenceCategory>
 
+    <!--
     <PreferenceCategory
         android:title="@string/pref_cat_others">
 
@@ -63,8 +64,8 @@
         <CheckBoxPreference
             android:key="use_playback_menu"
             android:title="@string/pref_use_playback_menu" />
-
     </PreferenceCategory>
+-->
 
     <PreferenceCategory
         android:title="@string/pref_cat_info">
@@ -94,6 +95,7 @@
         android:selectable="false" />
     </PreferenceCategory>
 
+<!--
     <PreferenceCategory
         android:title="@string/pref_cat_initialize">
 
         android:key="auto_connect_to_camera"
         android:title="@string/pref_auto_connect_camera"
         android:summary="@string/pref_summary_auto_connect_camera" />
-
     </PreferenceCategory>
 
     <PreferenceCategory
             android:key="debug_info"
             android:title="@string/pref_degug_info"
             android:summary="@string/pref_summary_debug_info" />
-
     </PreferenceCategory>
+-->
 </PreferenceScreen>
index 9ea0916..1330325 100644 (file)
@@ -6,8 +6,8 @@
         <PreferenceScreen
             android:key="exit_application"
             android:icon="@drawable/ic_power_settings_new_black_24dp"
-            android:title="@string/pref_exit_power_off" />
-
+            android:title="@string/pref_ricoh_exit_power_off" />
+<!--
         <ListPreference
             android:title="@string/pref_connection_method"
             android:entryValues="@array/connection_method_value"
             android:key="wifi_settings"
             android:title="@string/pref_wifi_settings"
             android:summary="@string/pref_summary_wifi_settings" />
-
+-->
     </PreferenceCategory>
 
+<!--
     <PreferenceCategory
         android:title="@string/pref_cat_camera">
 
         <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_initialize">
             android:key="gr2_lcd_sleep"
             android:title="@string/pref_gr2_lcd_sleep" />
 
+<!--
         <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_others">
-
+<!--
         <CheckBoxPreference
             android:key="share_after_save"
             android:title="@string/pref_call_share_after_save" />
         <CheckBoxPreference
             android:key="use_playback_menu"
             android:title="@string/pref_use_playback_menu"
-            android:summary="@string/summary_use_playback_menu"
-
-            />
-
+            android:summary="@string/summary_use_playback_menu" />
+-->
         <CheckBoxPreference
             android:key="use_gr2_special_command"
             android:title="@string/pref_use_gr2_special_command"
@@ -81,9 +82,9 @@
             android:defaultValue="5"
             android:inputType="number"
             android:summary="@string/pref_summary_ricoh_get_pics_list_timeout" />
-
     </PreferenceCategory>
 
+    <!--
     <PreferenceCategory
         android:title="@string/pref_cat_gokigen">
 
             android:key="debug_info"
             android:title="@string/pref_degug_info"
             android:summary="@string/pref_summary_debug_info" />
-
     </PreferenceCategory>
+-->
 </PreferenceScreen>
diff --git a/app/src/main/res/xml/preferences_summary.xml b/app/src/main/res/xml/preferences_summary.xml
new file mode 100644 (file)
index 0000000..3fba833
--- /dev/null
@@ -0,0 +1,94 @@
+<?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">
+
+        <ListPreference
+            android:title="@string/pref_connection_method"
+            android:entryValues="@array/connection_method_value"
+            android:entries="@array/connection_method"
+            android:key="connection_method"
+            android:defaultValue="RICOH_GR2"/>
+
+        <PreferenceScreen
+            android:key="wifi_settings"
+            android:title="@string/pref_wifi_settings"
+            android:summary="@string/pref_summary_wifi_settings" />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:title="@string/pref_cat_camera">
+
+        <PreferenceScreen
+            android:key="ricoh_settings"
+            android:title="@string/pref_ricoh_settings"
+            android:summary="@string/pref_summary_ricoh_settings" />
+
+        <PreferenceScreen
+            android:key="fuji_x_settings"
+            android:title="@string/pref_fuji_x_settings"
+            android:summary="@string/pref_summary_fuji_x_settings" />
+
+        <PreferenceScreen
+            android:key="opc_settings"
+            android:title="@string/pref_opc_settings"
+            android:summary="@string/pref_summary_opc_settings" />
+
+        <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_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_others">
+
+        <CheckBoxPreference
+            android:key="share_after_save"
+            android:title="@string/pref_call_share_after_save" />
+
+        <CheckBoxPreference
+            android:key="use_playback_menu"
+            android:title="@string/pref_use_playback_menu"
+            android:summary="@string/summary_use_playback_menu" />
+
+    </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/GR2Control"
+            android:selectable="true">
+            <intent android:action="android.intent.action.VIEW"
+                android:data="https://osdn.net/projects/gokigen/wiki/GR2Control" />
+        </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>