OSDN Git Service

モード変更は、GR専用コマンドで発行するように変更した。
authorMRSa <mrsa@myad.jp>
Mon, 20 Aug 2018 14:27:51 +0000 (23:27 +0900)
committerMRSa <mrsa@myad.jp>
Mon, 20 Aug 2018 14:27:51 +0000 (23:27 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewFragment.java
app/src/main/res/values-ja/arrays.xml [new file with mode: 0644]

index 3f19eff..bd433a8 100644 (file)
@@ -170,10 +170,19 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatu
             public void run() {
                 try
                 {
+                    String response;
                     String postData = key + "=" + value;
-                    String response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs);
-                    Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)");
-
+                    if (key.equals("exposureMode"))
+                    {
+                        //  撮影モードを変更するときは、GR専用コマンドを送ることにする。
+                        postData = "cmd=" + decideButtonCode(value);
+                        response = SimpleHttpClient.httpPost(grCommandUrl, postData, timeoutMs);
+                        Log.v(TAG, "CHANGE MODE : " + postData + " resp. (" + response.length() + "bytes.)");
+                    } else {
+                        // 通常の変更コマンド
+                        response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs);
+                        Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)");
+                    }
                     //  GR専用コマンドで、画面表示をリフレッシュ
                     response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs);
                     Log.v(TAG, "refresh resp. (" + response.length() + "bytes.)");
@@ -193,4 +202,42 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatu
             e.printStackTrace();
         }
     }
+
+    /**
+     *   撮影モードをGRのダイアルコマンドに変更する
+     *
+     */
+    private String decideButtonCode(String exposureMode)
+    {
+        String buttonCode = "bdial AUTO";
+        if (exposureMode == null)
+        {
+            return (buttonCode);
+        }
+        switch (exposureMode)
+        {
+            case "movie":
+                buttonCode = "bdial MOVIE";
+                break;
+            case "M":
+                buttonCode = "bdial M";
+                break;
+            case "TAV":
+                buttonCode = "bdial TAV";
+                break;
+            case "AV":
+                buttonCode = "bdial AV";
+                break;
+            case "TV":
+                buttonCode = "bdial TV";
+                break;
+            case "P":
+                buttonCode = "bdial P";
+                break;
+            case "auto":
+                buttonCode = "bdial AUTO";
+                break;
+        }
+        return (buttonCode);
+    }
 }
index 9069974..86f187d 100644 (file)
@@ -349,18 +349,26 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         try
         {
-            int id = (imageView.isShowGrid()) ? R.drawable.ic_grid_off_black_24dp : R.drawable.ic_grid_on_black_24dp;
-            if (showGrid == null)
+            Activity activity = getActivity();
+            if (activity != null)
             {
-                Activity activity = getActivity();
-                if (activity != null)
-                {
+                if (showGrid == null) {
                     showGrid = activity.findViewById(R.id.show_hide_grid_button);
                 }
+                activity.runOnUiThread(new Runnable() {
+                    @Override
+                    public void run()
+                    {
+                        int id = (imageView.isShowGrid()) ? R.drawable.ic_grid_off_black_24dp : R.drawable.ic_grid_on_black_24dp;
+                        if (showGrid != null)
+                        {
+                            showGrid.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
+                            showGrid.invalidate();
+                        }
+                        imageView.invalidate();
+                    }
+                });
             }
-            showGrid.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
-            showGrid.invalidate();
-            imageView.invalidate();
         }
         catch (Exception e)
         {
@@ -959,33 +967,38 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     }
 
     @Override
-    public void updateFocusedStatus(boolean focused)
+    public void updateFocusedStatus(final boolean focused)
     {
         Activity activity = getActivity();
         try
         {
             if (activity != null)
             {
-                ImageView view = getActivity().findViewById(R.id.focusUnlockImageView);
-                if (focused)
-                {
-                    Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_center_focus_strong_black_24dp, null);
-                    if (icon != null)
-                    {
-                        DrawableCompat.setTint(icon, Color.GREEN);
-                        view.setImageDrawable(icon);
-                    }
-                }
-                else
-                {
-                    Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_crop_free_black_24dp, null);
-                    if (icon != null)
-                    {
-                        DrawableCompat.setTint(icon, Color.BLACK);
-                        view.setImageDrawable(icon);
+                activity.runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        ImageView view = getActivity().findViewById(R.id.focusUnlockImageView);
+                        if (focused)
+                        {
+                            Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_center_focus_strong_black_24dp, null);
+                            if (icon != null)
+                            {
+                                DrawableCompat.setTint(icon, Color.GREEN);
+                                view.setImageDrawable(icon);
+                            }
+                        }
+                        else
+                        {
+                            Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_crop_free_black_24dp, null);
+                            if (icon != null)
+                            {
+                                DrawableCompat.setTint(icon, Color.BLACK);
+                                view.setImageDrawable(icon);
+                            }
+                        }
+                        view.invalidate();
                     }
-                }
-                view.invalidate();
+                });
             }
         }
         catch (Exception e)
diff --git a/app/src/main/res/values-ja/arrays.xml b/app/src/main/res/values-ja/arrays.xml
new file mode 100644 (file)
index 0000000..5fc136c
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string-array name="connection_method">
+        <item>Ricoh GR II</item>
+        <item>OPC(Olympus Air)</item>
+    </string-array>
+
+    <string-array name="connection_method_value">
+        <item >RICOH_GR2</item>
+        <item>OPC</item>
+    </string-array>
+
+    <string-array name="gr2_display_mode">
+        <item >0</item>
+        <item >1</item>
+        <item >2</item>
+        <item >3</item>
+    </string-array>
+
+    <string-array name="gr2_display_mode_value">
+        <item >0</item>
+        <item >1</item>
+        <item >2</item>
+        <item >3</item>
+    </string-array>
+
+    <string-array name="exif_exposure_program_value">
+        <item>Unknown</item>
+        <item>Manual</item>
+        <item>Program</item>
+        <item>Aperture priority</item>
+        <item>Shutter priority</item>
+        <item>Creative Program</item>
+        <item>Action Program</item>
+        <item>Portrait mode</item>
+        <item>Landscape mode</item>
+        <item>Other</item>
+    </string-array>
+
+    <string-array name="exif_metering_mode_value">
+        <item>Unknown</item>
+        <item>Average</item>
+        <item>CenterWeightedAverage</item>
+        <item>Spot</item>
+        <item>MutiSpot</item>
+        <item>Pattern</item>
+        <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>