OSDN Git Service

androidx に置き換えた。
[gokigen/Gr2Control.git] / app / src / main / java / net / osdn / gokigen / gr2control / camera / ricohgr2 / wrapper / RicohGr2LiveViewControl.java
index a5d085e..2f52eea 100644 (file)
@@ -1,6 +1,5 @@
 package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper;
 
-import android.support.annotation.NonNull;
 import android.util.Log;
 
 import net.osdn.gokigen.gr2control.camera.ILiveViewControl;
@@ -9,6 +8,8 @@ import net.osdn.gokigen.gr2control.camera.utils.SimpleLiveviewSlicer;
 import net.osdn.gokigen.gr2control.liveview.liveviewlistener.CameraLiveViewListenerImpl;
 import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
 
+import androidx.annotation.NonNull;
+
 /**
  *
  *
@@ -17,7 +18,9 @@ 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 final boolean useGrCommand;
+    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;
@@ -26,15 +29,16 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
      *
      *
      */
-    RicohGr2LiveViewControl()
+    RicohGr2LiveViewControl(boolean useGrControl)
     {
+        this.useGrCommand = useGrControl;
         liveViewListener = new CameraLiveViewListenerImpl();
     }
 
 /*
     public void setLiveViewAddress(@NonNull String address, @NonNull String page)
     {
-        liveViewUrl = "http://" + address + "/" + page;
+        cameraDisplayUrl = "http://" + address + "/" + page;
     }
 */
 
@@ -42,12 +46,12 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
     public void changeLiveViewSize(String size)
     {
         //
-
     }
 
     @Override
-    public void startLiveView()
+    public void startLiveView(final boolean useCameraScreen)
     {
+        final boolean isCameraScreen = useGrCommand && useCameraScreen;
         Log.v(TAG, "startLiveView()");
         try
         {
@@ -58,7 +62,14 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
                 {
                     try
                     {
-                        start(liveViewUrl);
+                        if (isCameraScreen)
+                        {
+                            start(cameraDisplayUrl);
+                        }
+                        else
+                        {
+                            start(liveViewUrl);
+                        }
                     }
                     catch (Exception e)
                     {