OSDN Git Service

カメラプロパティの値を作りこみ。
authorMRSa <mrsa@myad.jp>
Wed, 8 Aug 2018 15:17:29 +0000 (00:17 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 8 Aug 2018 15:17:29 +0000 (00:17 +0900)
19 files changed:
app/build.gradle
app/src/main/java/net/osdn/gokigen/gr2control/camera/ICameraStatus.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/gr2control/camera/ILiveViewControl.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/IRicohGr2InterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusChecker.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/ricohgr2/wrapper/RicohGr2StatusHolder.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/utils/SimpleHttpClient.java
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewControlPanelClickListener.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/playback/ImageGridViewFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/gr2control/preference/ricohgr2/RicohGr2PreferenceFragment.java
app/src/main/res/drawable/ic_photo_library_black_24dp.xml [new file with mode: 0644]
app/src/main/res/layout-land/fragment_live_view.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_ricoh_gr2.xml
build.gradle

index 0d3789e..06921e0 100644 (file)
@@ -20,8 +20,8 @@ android {
 
 dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
-    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
-    implementation 'com.android.support:preference-v7:28.0.0-alpha3'
-    implementation 'com.android.support:exifinterface:28.0.0-alpha3'
+    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
+    implementation 'com.android.support:preference-v7:28.0.0-rc01'
+    implementation 'com.android.support:exifinterface:28.0.0-rc01'
     implementation 'com.android.support.constraint:constraint-layout:1.1.2'
 }
diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/camera/ICameraStatus.java b/app/src/main/java/net/osdn/gokigen/gr2control/camera/ICameraStatus.java
new file mode 100644 (file)
index 0000000..997a668
--- /dev/null
@@ -0,0 +1,36 @@
+package net.osdn.gokigen.gr2control.camera;
+
+import android.support.annotation.NonNull;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface ICameraStatus
+{
+    @NonNull List<String> getStatusList(@NonNull final String key);
+    String getStatus(@NonNull final String key);
+    void setStatus(@NonNull final String key, @NonNull final String value);
+
+    String BATTERY = "battery";
+    String STATE = "state";
+    String FOCUS_MODE = "focusMode";
+    String AF_MODE = "AFMode";
+
+    String RESOLUTION = "reso";
+    String DRIVE_MODE = "shootMode";
+    String WHITE_BALANCE = "WBMode";
+    String AE = "meteringMode";
+
+    String EFFECT = "effect";
+    String TAKE_MODE = "exposureMode";
+    String IMAGESIZE = "stillSize";
+    String MOVIESIZE = "movieSize";
+
+    String APERATURE = "av";
+    String SHUTTER_SPEED = "tv";
+    String ISO_SENSITIVITY = "sv";
+    String EXPREV = "xv";
+    String FLASH_XV = "flashxv";
+}
index 79abe6b..dde483f 100644 (file)
@@ -8,7 +8,7 @@ public interface ILiveViewControl
 {
     void changeLiveViewSize(String size);
 
-    void startLiveView();
+    void startLiveView(boolean isCameraScreen);
     void stopLiveView();
     void updateDigitalZoom();
     void updateMagnifyingLiveViewScale(boolean isChangeScale);
index 00d4ba8..a99abc8 100644 (file)
@@ -3,6 +3,7 @@ package net.osdn.gokigen.gr2control.camera.ricohgr2;
 import net.osdn.gokigen.gr2control.camera.ICameraButtonControl;
 import net.osdn.gokigen.gr2control.camera.ICameraConnection;
 import net.osdn.gokigen.gr2control.camera.ICameraInformation;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
 import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
 import net.osdn.gokigen.gr2control.camera.ICaptureControl;
 import net.osdn.gokigen.gr2control.camera.IDisplayInjector;
@@ -26,6 +27,7 @@ public interface IRicohGr2InterfaceProvider
     IZoomLensControl getZoomLensControl();
     ICaptureControl getCaptureControl();
     IDisplayInjector getDisplayInjector();
+    ICameraStatus getCameraStatusListHolder();
     ICameraButtonControl getButtonControl();
     ICameraStatusWatcher getCameraStatusWatcher();
     IPlaybackControl getPlaybackControl();
index 70e7d5f..b55f970 100644 (file)
@@ -7,6 +7,7 @@ import android.util.Log;
 import net.osdn.gokigen.gr2control.camera.ICameraButtonControl;
 import net.osdn.gokigen.gr2control.camera.ICameraConnection;
 import net.osdn.gokigen.gr2control.camera.ICameraInformation;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
 import net.osdn.gokigen.gr2control.camera.ICameraStatusReceiver;
 import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
 import net.osdn.gokigen.gr2control.camera.ICaptureControl;
@@ -145,6 +146,12 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
     }
 
     @Override
+    public ICameraStatus getCameraStatusListHolder()
+    {
+        return (statusChecker);
+    }
+
+    @Override
     public ICameraButtonControl getButtonControl()
     {
         return (buttonControl);
index a5d085e..00b964a 100644 (file)
@@ -17,7 +17,8 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
 {
     private final String TAG = toString();
     private final CameraLiveViewListenerImpl liveViewListener;
-    private String liveViewUrl = "http://192.168.0.1/v1/display";
+    private String cameraDisplayUrl = "http://192.168.0.1/v1/display";    //  カメラの画面をコピーする場合...
+    private String liveViewUrl = "http://192.168.0.1/v1/liveview";         //  何も表示しない(ライブビューモード)の場合...
     private float cropScale = 1.0f;
     private boolean whileFetching = false;
     private static final int FETCH_ERROR_MAX = 30;
@@ -34,7 +35,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
 /*
     public void setLiveViewAddress(@NonNull String address, @NonNull String page)
     {
-        liveViewUrl = "http://" + address + "/" + page;
+        cameraDisplayUrl = "http://" + address + "/" + page;
     }
 */
 
@@ -46,7 +47,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
     }
 
     @Override
-    public void startLiveView()
+    public void startLiveView(final boolean isCameraScreen)
     {
         Log.v(TAG, "startLiveView()");
         try
@@ -58,7 +59,14 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
                 {
                     try
                     {
-                        start(liveViewUrl);
+                        if (isCameraScreen)
+                        {
+                            start(cameraDisplayUrl);
+                        }
+                        else
+                        {
+                            start(liveViewUrl);
+                        }
                     }
                     catch (Exception e)
                     {
index 7bb2281..3f19eff 100644 (file)
@@ -3,21 +3,27 @@ package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper;
 import android.support.annotation.NonNull;
 import android.util.Log;
 
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
 import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
 import net.osdn.gokigen.gr2control.camera.utils.SimpleHttpClient;
 import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  *
  *
  */
-public class RicohGr2StatusChecker implements ICameraStatusWatcher
+public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatus
 {
     private final String TAG = toString();
     private final String statusCheckUrl = "http://192.168.0.1/v1/props";
+    private final String statusSetUrl = "http://192.168.0.1/v1/params/camera";
+    private final String grCommandUrl = "http://192.168.0.1/_gr";
     private final int sleepMs;
 
-    private int timeoutMs = 6000;
+    private int timeoutMs = 5000;
     private boolean whileFetching = false;
     private RicohGr2StatusHolder statusHolder;
 
@@ -118,4 +124,73 @@ public class RicohGr2StatusChecker implements ICameraStatusWatcher
             e.printStackTrace();
         }
     }
+
+    @Override
+    public @NonNull List<String> getStatusList(@NonNull final String key)
+    {
+        try
+        {
+            if (statusHolder == null)
+            {
+                return (new ArrayList<>());
+            }
+            String listKey = key + "List";
+            return (statusHolder.getAvailableItemList(listKey));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (new ArrayList<>());
+    }
+
+    @Override
+    public String getStatus(@NonNull String key)
+    {
+        try
+        {
+            if (statusHolder == null)
+            {
+                return ("");
+            }
+            return (statusHolder.getItemStatus(key));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return ("");
+    }
+
+    @Override
+    public void setStatus(@NonNull final String key, @NonNull final String value)
+    {
+        Thread thread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try
+                {
+                    String postData = key + "=" + value;
+                    String 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.)");
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        });
+        try
+        {
+            thread.start();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
 }
index e9b5a9a..e973157 100644 (file)
@@ -1,11 +1,15 @@
 package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper;
 
+import android.support.annotation.NonNull;
 import android.util.Log;
 
 import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
 
+import org.json.JSONArray;
 import org.json.JSONObject;
 
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  *
@@ -16,6 +20,7 @@ class RicohGr2StatusHolder
     private final String TAG = toString();
     private final ICameraStatusUpdateNotify notifier;
 
+    private JSONObject latestResultObject = null;
     private String avStatus = "";
     private String tvStatus = "";
     private String xvStatus = "";
@@ -37,6 +42,53 @@ class RicohGr2StatusHolder
      *
      *
      */
+    List<String> getAvailableItemList(@NonNull String key)
+    {
+        List<String> itemList = new ArrayList<>();
+        try
+        {
+            JSONArray array = latestResultObject.getJSONArray(key);
+            if (array == null)
+            {
+                return (itemList);
+            }
+            int nofItems = array.length();
+            for (int index = 0; index < nofItems; index++)
+            {
+                try
+                {
+                    itemList.add(array.getString(index));
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (itemList);
+    }
+
+    String getItemStatus(@NonNull String key)
+    {
+        try
+        {
+            return (latestResultObject.getString(key));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return ("");
+    }
+
+    /**
+     *
+     *
+     */
     void updateStatus(String replyString)
     {
         if ((replyString == null)||(replyString.length() < 1))
@@ -47,15 +99,15 @@ class RicohGr2StatusHolder
 
         try
         {
-            JSONObject resultObject = new JSONObject(replyString);
-            String result = resultObject.getString("errMsg");
-            String av = resultObject.getString("av");
-            String tv = resultObject.getString("tv");
-            String xv = resultObject.getString("xv");
-            String exposureMode = resultObject.getString("exposureMode");
-            String meteringMode = resultObject.getString("meteringMode");
-            String wbMode = resultObject.getString("WBMode");
-            String battery = resultObject.getString("battery");
+            latestResultObject = new JSONObject(replyString);
+            String result = latestResultObject.getString("errMsg");
+            String av = latestResultObject.getString("av");
+            String tv = latestResultObject.getString("tv");
+            String xv = latestResultObject.getString("xv");
+            String exposureMode = latestResultObject.getString("exposureMode");
+            String meteringMode = latestResultObject.getString("meteringMode");
+            String wbMode = latestResultObject.getString("WBMode");
+            String battery = latestResultObject.getString("battery");
 
             if (result.contains("OK"))
             {
@@ -95,6 +147,7 @@ class RicohGr2StatusHolder
                     notifier.updateRemainBattery(Integer.parseInt(batteryStatus));
                 }
             }
+            System.gc();
         }
         catch (Exception e)
         {
index 24437fa..753bdb3 100644 (file)
@@ -274,6 +274,26 @@ public class SimpleHttpClient
      */
     public static String httpPost(String url, String postData, int timeoutMs)
     {
+        return (httpCommand(url, "POST", postData, timeoutMs));
+    }
+
+    /**
+     *
+     *
+     *
+     */
+    public static String httpPut(String url, String postData, int timeoutMs)
+    {
+        return (httpCommand(url, "PUT", postData, timeoutMs));
+    }
+
+    /**
+     *
+     *
+     *
+     */
+    private static String httpCommand(String url, String requestMethod, String postData, int timeoutMs)
+    {
         HttpURLConnection httpConn = null;
         OutputStream outputStream = null;
         OutputStreamWriter writer = null;
@@ -285,12 +305,12 @@ public class SimpleHttpClient
             timeout = DEFAULT_TIMEOUT;
         }
 
-        //  HTTP Postメソッドで要求を送出
+        //  HTTP メソッドで要求を送出
         try
         {
             final URL urlObj = new URL(url);
             httpConn = (HttpURLConnection) urlObj.openConnection();
-            httpConn.setRequestMethod("POST");
+            httpConn.setRequestMethod(requestMethod);
             httpConn.setConnectTimeout(timeout);
             httpConn.setReadTimeout(timeout);
             httpConn.setDoInput(true);
@@ -312,13 +332,13 @@ public class SimpleHttpClient
             }
             if (inputStream == null)
             {
-                Log.w(TAG, "httpPost: Response Code Error: " + responseCode + ": " + url);
+                Log.w(TAG, "http " + requestMethod + " : Response Code Error: " + responseCode + ": " + url);
                 return ("");
             }
         }
         catch (Exception e)
         {
-            Log.w(TAG, "httpPost: IOException: " + e.getMessage());
+            Log.w(TAG, "http " + requestMethod + " : IOException: " + e.getMessage());
             e.printStackTrace();
             if (httpConn != null)
             {
diff --git a/app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewControlPanelClickListener.java b/app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewControlPanelClickListener.java
new file mode 100644 (file)
index 0000000..8f3907b
--- /dev/null
@@ -0,0 +1,220 @@
+package net.osdn.gokigen.gr2control.liveview;
+
+import android.app.Activity;
+import android.content.DialogInterface;
+import android.support.annotation.NonNull;
+import android.support.v7.app.AlertDialog;
+import android.util.Log;
+import android.view.View;
+
+import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
+import net.osdn.gokigen.gr2control.camera.IInterfaceProvider;
+
+import java.util.List;
+
+/**
+ *
+ *
+ */
+class LiveViewControlPanelClickListener  implements View.OnClickListener
+{
+    private final String TAG = toString();
+    private final Activity activity;
+    private final IInterfaceProvider interfaceProvider;
+
+    LiveViewControlPanelClickListener(Activity context, IInterfaceProvider interfaceProvider)
+    {
+        this.activity = context;
+        this.interfaceProvider = interfaceProvider;
+    }
+
+
+    @Override
+    public void onClick(View view)
+    {
+        try
+        {
+            int id = view.getId();
+            ICameraStatus statusList = interfaceProvider.getRicohGr2Infterface().getCameraStatusListHolder();
+            if (statusList == null)
+            {
+                // ステータスリストの保持クラスが取れなかった...
+                Log.w(TAG, "ICameraStatus is NULL...");
+                return;
+            }
+            switch (id)
+            {
+                case R.id.takemodeTextView:
+                    //  撮影モードは変えられない...なぜ?
+                    // selectTakeMode(statusList);
+                    break;
+
+                case R.id.shutterSpeedTextView:
+                    selectShutterSpeed(statusList);
+                    break;
+
+                case R.id.apertureValueTextView:
+                    selectAperture(statusList);
+                    break;
+
+                case R.id.exposureCompensationTextView:
+                    selectExposureCompensation(statusList);
+                    break;
+
+                case R.id.aeModeTextView:
+                    selectAeMode(statusList);
+                    break;
+
+                case R.id.whiteBalanceImageView:
+                    selectWhiteBalance(statusList);
+                    break;
+
+                default:
+                    Log.v(TAG, "onClick() : " + id);
+                    break;
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void selectTakeMode(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectTakeMode()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.TAKE_MODE);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void selectShutterSpeed(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectShutterSpeed()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.SHUTTER_SPEED);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    private void selectAperture(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectAperture()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.APERATURE);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    private void selectExposureCompensation(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectExposureCompensation()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.EXPREV);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    private void selectAeMode(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectAeMode()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.AE);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    private void selectWhiteBalance(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectWhiteBalance()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.WHITE_BALANCE);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     *
+     *
+     */
+    private void choiceStatusList(@NonNull final ICameraStatus statusList, final String key)
+    {
+        try
+        {
+            final String current = statusList.getStatus(key);
+            final List<String> itemList = statusList.getStatusList(key);
+
+            if (itemList.size() <= 0)
+            {
+                // アイテム(選択肢)が登録されていなければ、何もしない
+                return;
+            }
+
+            // しかし、ここ、ちょーダサいんだけど...
+            String[] items = new String[itemList.size()];
+            for (int ii = 0; ii < items.length; ++ii)
+            {
+                items[ii] = itemList.get(ii);
+                // ついでにもうべたべたで...ここで表示用の文字列を置き換える
+                //  (注: itemsだけ置き換え、itemList と current は 内部値のままとなっている
+                if (key.equals(ICameraStatus.SHUTTER_SPEED))
+                {
+                    items[ii] = items[ii].replace(".", "/");
+                }
+                else if (key.equals(ICameraStatus.APERATURE))
+                {
+                    items[ii] = "F" + items[ii];
+                }
+            }
+
+            AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+            builder.setSingleChoiceItems(items, itemList.indexOf(current), new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i)
+                {
+                    String choice = itemList.get(i);
+                    Log.v(TAG, key + " ITEM CHOICED : " + choice + "(CURRENT : " + current + ")");
+
+                    statusList.setStatus(key, choice);
+                    dialogInterface.dismiss();
+                }
+            });
+            builder.show();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+}
index 9a6893a..4bb8e1c 100644 (file)
@@ -51,6 +51,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     private ICameraInformation cameraInformation = null;
     private ICameraStatusWatcher statusWatcher = null;
     private LiveViewClickTouchListener onClickTouchListener = null;
+    private LiveViewControlPanelClickListener onPanelClickListener = null;
 
     private TextView statusArea = null;
     private TextView focalLengthArea = null;
@@ -158,6 +159,17 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             setOnClickListener(view, R.id.camera_power_off_button);
             setOnClickListener(view, R.id.show_preference_button);
 
+            if (onPanelClickListener == null)
+            {
+                onPanelClickListener = new LiveViewControlPanelClickListener(this.getActivity(), interfaceProvider);
+            }
+            setPanelClickListener(view, R.id.takemodeTextView);
+            setPanelClickListener(view, R.id.shutterSpeedTextView);
+            setPanelClickListener(view, R.id.apertureValueTextView);
+            setPanelClickListener(view, R.id.exposureCompensationTextView);
+            setPanelClickListener(view, R.id.aeModeTextView);
+            setPanelClickListener(view, R.id.whiteBalanceImageView);
+
             /*
             view.findViewById(R.id.show_preference_button).setOnClickListener(onClickTouchListener);
             view.findViewById(R.id.camera_property_settings_button).setOnClickListener(onClickTouchListener);
@@ -261,6 +273,23 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         }
     }
 
+    private void setPanelClickListener(View view, int id)
+    {
+        try
+        {
+            View button = view.findViewById(id);
+            if (button != null)
+            {
+                button.setOnClickListener(onPanelClickListener);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+
     /**
      *
      */
@@ -593,10 +622,12 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         {
             // ライブビューの開始
             Context context = getContext();
+            boolean isCameraScreen = true;
             if (context != null)
             {
                 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
                 liveViewControl.changeLiveViewSize(preferences.getString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE));
+                isCameraScreen = preferences.getBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true);
             }
             ILiveViewListener lvListener = interfaceProvider.getRicohGr2Infterface().getLiveViewListener();
 /*
@@ -615,8 +646,9 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
                 lvListener = liveViewListener;
             }
 */
+
             lvListener.setCameraLiveImageView(imageView);
-            liveViewControl.startLiveView();
+            liveViewControl.startLiveView(isCameraScreen);   // false : ライブビューのみ、 true : カメラ画面をミラー
 
             // ステータス監視も実施する
             startWatchStatus();
@@ -843,7 +875,8 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     @Override
     public void updatedWBMode(final String wbMode)
     {
-        // とりあえず何もしない...
+        // とりあえず何もしない... 選択肢は以下
+        // auto, multiAuto, daylight, shade, cloud, tungsten, warmWhiteFluorescent, daylightFluorescent, dayWhiteFluorescent, coolWhiteFluorescent, incandescent,manual1, cte, custom
     }
 
     /**
index 2317cb0..b2c9103 100644 (file)
@@ -270,6 +270,7 @@ public class ImageGridViewFragment extends Fragment
                         ImageContentInfoEx raw = rawItems.get(target);
                         if (raw != null)
                         {
+                               // RAW は、JPEGファイルがあった場合にのみリストする
                             item.setHasRaw(true);
                             Log.v(TAG, "DETECT RAW FILE: " + target);
                         }
index ce183ab..95539e1 100644 (file)
@@ -50,6 +50,8 @@ public interface IPreferencePropertyAccessor
     String GR2_DISPLAY_MODE = "gr2_display_mode";
     String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
 
+    String GR2_DISPLAY_CAMERA_VIEW = "gr2_display_camera_view";
+
     String GR2_LCD_SLEEP = "gr2_lcd_sleep";
 
     /*
index be93792..4026688 100644 (file)
@@ -114,6 +114,9 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
             if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD)) {
                 editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
             }
+            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);
             }
@@ -156,6 +159,11 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
                     Log.v(TAG, " " + key + " , " + value);
                     break;
 
+                case IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW:
+                    value = preferences.getBoolean(key, true);
+                    Log.v(TAG, " " + key + " , " + value);
+                    break;
+
                 case IPreferencePropertyAccessor.GR2_LCD_SLEEP:
                     value = preferences.getBoolean(key, false);
                     Log.v(TAG, " " + key + " , " + value);
@@ -322,6 +330,7 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
                         setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, defaultValue);
                         setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue);
                         setBooleanPreference(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, IPreferencePropertyAccessor.USE_PLAYBACK_MENU, defaultValue);
+                        setBooleanPreference(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, defaultValue);
                         setBooleanPreference(IPreferencePropertyAccessor.GR2_LCD_SLEEP, IPreferencePropertyAccessor.GR2_LCD_SLEEP, defaultValue);
                     }
                     catch (Exception e)
diff --git a/app/src/main/res/drawable/ic_photo_library_black_24dp.xml b/app/src/main/res/drawable/ic_photo_library_black_24dp.xml
new file mode 100644 (file)
index 0000000..68d5d0e
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M22,16L22,4c0,-1.1 -0.9,-2 -2,-2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zM11,12l2.03,2.71L16,11l4,5L8,16l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6L2,6z"/>
+</vector>
index 25cc52f..0de0501 100644 (file)
@@ -78,7 +78,7 @@
                 android:focusable="true"
                 android:gravity="center"
                 android:scaleType="fitCenter"
-                android:src="@drawable/ic_image_black_24dp"
+                android:src="@drawable/ic_photo_library_black_24dp"
                 android:visibility="visible" />
 
         </RelativeLayout>
index df66f24..fdcf513 100644 (file)
@@ -28,6 +28,8 @@
     <string name="pref_connection_method">Connection Method</string>
 
     <string name="pref_gr2_display_mode">Display Mode</string>
+    <string name="pref_gr2_display_camera_view">Mirror Camera Screen</string>
+    <string name="pref_gr2_display_camera_view_summary">Use same camera screen.</string>
     <string name="pref_gr2_lcd_sleep">Screen off during connected</string>
 
     <string name="pref_cat_camera">Camera</string>
index a35e379..3e61d3b 100644 (file)
         android:title="@string/pref_cat_initialize">
 
         <CheckBoxPreference
+            android:key="gr2_display_camera_view"
+            android:title="@string/pref_gr2_display_camera_view"
+            android:summary="@string/pref_gr2_display_camera_view_summary"/>
+
+        <CheckBoxPreference
             android:key="gr2_lcd_sleep"
             android:title="@string/pref_gr2_lcd_sleep" />
 
index 43c0708..077cb2f 100644 (file)
@@ -7,7 +7,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.1.3'
+        classpath 'com.android.tools.build:gradle:3.1.4'
         
 
         // NOTE: Do not place your application dependencies here; they belong