OSDN Git Service

イメージファイルのプロバイダを上から与えるように。合わせてサンプル表示モードの画像を記憶するように。
authorMRSa <mrsa@myad.jp>
Wed, 9 Mar 2022 14:23:50 +0000 (23:23 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 9 Mar 2022 14:23:50 +0000 (23:23 +0900)
13 files changed:
.idea/deploymentTargetDropDown.xml [new file with mode: 0644]
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/example/ExamplePictureControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/camerax/operation/CameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/omds/OmdsCameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/panasonic/wrapper/PanasonicCameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/pixpro/PixproCameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/ricohpentax/RicohPentaxCameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/sony/SonyCameraControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/theta/ThetaCameraControl.kt
app/src/main/java/net/osdn/gokigen/objectdetection/a01f/liaison/CameraLiaison.kt
app/src/main/java/net/osdn/gokigen/objectdetection/a01f/liaison/CameraProvider.kt
app/src/main/java/net/osdn/gokigen/objectdetection/a01f/tflite/ObjectDetectionModelReader.kt
app/src/main/java/net/osdn/gokigen/objectdetection/a01f/ui/view/LiveViewScreen.kt

diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644 (file)
index 0000000..0ac92dc
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="deploymentTargetDropDown">
+    <runningDeviceTargetSelectedWithDropDown>
+      <Target>
+        <type value="RUNNING_DEVICE_TARGET" />
+        <deviceKey>
+          <Key>
+            <type value="SERIAL_NUMBER" />
+            <value value="3e50111c1220" />
+          </Key>
+        </deviceKey>
+      </Target>
+    </runningDeviceTargetSelectedWithDropDown>
+    <timeTargetWasSelectedWithDropDown value="2022-03-09T13:41:39.682012500Z" />
+  </component>
+</project>
\ No newline at end of file
index 77c035c..f2878ca 100644 (file)
@@ -25,9 +25,8 @@ import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 import java.io.InputStream
 
-class ExamplePictureControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, private val number : Int = 0) : IDisplayInjector, ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IKeyDown, ICameraStatus
+class ExamplePictureControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, private val number : Int = 0, private val liveViewListener :CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify, isDisableCache = true)) : IDisplayInjector, ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IKeyDown, ICameraStatus
 {
-    private val liveViewListener = CameraLiveViewListenerImpl(context, informationNotify, isDisableCache = true)
     private lateinit var refresher : ILiveViewRefresher
 
     private var startForResult : ActivityResultLauncher<Intent> = context.registerForActivityResult(StartActivityForResult()) { result : ActivityResult ->
@@ -39,6 +38,7 @@ class ExamplePictureControl(private val context: AppCompatActivity, private val
                         val uri = result.data?.data
                         if (uri != null)
                         {
+                            context.contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
                             applyPictureFile(uri, isStoreUri = true)
                         }
                     }
@@ -58,6 +58,8 @@ class ExamplePictureControl(private val context: AppCompatActivity, private val
         //val intent = Intent(Intent.ACTION_PICK)
         //val intent = Intent(Intent.ACTION_GET_CONTENT)
         val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
+        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+        intent.addCategory(Intent.CATEGORY_OPENABLE)
         intent.type = "image/*"
         startForResult.launch(intent)
     }
@@ -96,6 +98,7 @@ class ExamplePictureControl(private val context: AppCompatActivity, private val
     {
         try
         {
+            Log.v(TAG, "setRefresher() : ${preference.getCameraOption1()}")
             this.refresher = refresher
             liveViewListener.setRefresher(refresher)
             imageView.setImageProvider(liveViewListener)
@@ -104,6 +107,7 @@ class ExamplePictureControl(private val context: AppCompatActivity, private val
             val option1 = preference.getCameraOption1()
             if ((option1.isNotEmpty())&&(option1.contains("content://")))
             {
+                Log.v(TAG, " setRefresher() : $option1 ")
                 applyPictureFile(Uri.parse(option1))
             }
         }
@@ -155,6 +159,7 @@ class ExamplePictureControl(private val context: AppCompatActivity, private val
                     {
                         preference.getUpdater()?.setCameraOption1(uri.toString())
                         vibrator.vibrate(IVibrator.VibratePattern.SIMPLE_LONG)
+                        Log.v(TAG, " ----- STORE PREFERENCE : ${uri.toString()}")
                     }
                     liveViewListener.onUpdateLiveView(fis.readBytes(), null, degrees)
                     if (::refresher.isInitialized)
index 80213c3..11f2d3a 100644 (file)
@@ -31,10 +31,9 @@ import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 import java.util.concurrent.ExecutorService
 import java.util.concurrent.Executors
 
-class CameraControl(private val activity : AppCompatActivity, private val preference: ICameraPreferenceProvider, private val vibrator : IVibrator, private val informationReceiver : IInformationReceiver, private val statusReceiver : ICameraStatusReceiver, private val number : Int = 0) : ICameraControl, ICameraShutter
+class CameraControl(private val activity : AppCompatActivity, private val preference: ICameraPreferenceProvider, private val vibrator : IVibrator, private val informationReceiver : IInformationReceiver, private val statusReceiver : ICameraStatusReceiver, private val number : Int = 0, private val liveViewListener:CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(activity, informationReceiver)) : ICameraControl, ICameraShutter
 {
     private lateinit var cameraExecutor: ExecutorService
-    private lateinit var liveViewListener : CameraLiveViewListenerImpl
     private lateinit var fileControl : FileControl
     private lateinit var storeImage : StoreImage
     private lateinit var cameraXCamera : Camera
@@ -53,7 +52,6 @@ class CameraControl(private val activity : AppCompatActivity, private val prefer
     override fun initialize()
     {
         Log.v(TAG, " initialize()")
-        liveViewListener = CameraLiveViewListenerImpl(activity, informationReceiver)
         cameraExecutor = Executors.newSingleThreadExecutor()
         storeImage = StoreImage(activity, liveViewListener)
         clickKeyDownListeners.clear()
@@ -350,7 +348,7 @@ class CameraControl(private val activity : AppCompatActivity, private val prefer
         return (number)
     }
 
-    override fun getCameraShutter(id: Int): ICameraShutter? { return (this) }
+    override fun getCameraShutter(id: Int): ICameraShutter { return (this) }
 
     private fun getClickKeyDownListener(id : Int) : CameraClickKeyDownListener
     {
index ad9a899..f991f8f 100644 (file)
@@ -29,9 +29,8 @@ import jp.osdn.gokigen.gokigenassets.preference.PreferenceAccessWrapper
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 
-class OmdsCameraControl(private val context: AppCompatActivity, private val vibrator: IVibrator, informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val number : Int = 0) : ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown, IDisplayInjector, IOmdsProtocolNotify
+class OmdsCameraControl(private val context: AppCompatActivity, private val vibrator: IVibrator, informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val number : Int = 0,  private val liveViewListener: CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify)) : ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown, IDisplayInjector, IOmdsProtocolNotify
 {
-    private val liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val statusChecker = OmdsCameraStatusWatcher()
     private val runModeControl = OmdsRunModeControl()
     private val zoomLensControl = OmdsZoomLensControl(statusChecker)
index d70e737..8ccb521 100644 (file)
@@ -33,10 +33,9 @@ import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 import jp.osdn.gokigen.gokigenassets.utils.communication.SimpleHttpClient
 
-class PanasonicCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, private val informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val cameraCoordinator: ICameraControlCoordinator, private val number: Int) : IPanasonicCameraHolder, IDisplayInjector,ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown
+class PanasonicCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, private val informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val cameraCoordinator: ICameraControlCoordinator, private val number: Int = 0, private val liveViewListener: CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify)) : IPanasonicCameraHolder, IDisplayInjector,ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown
 {
     private val cardSlotSelector = PanasonicCardSlotSelector()
-    private val liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val cameraConnection: PanasonicCameraConnection = PanasonicCameraConnection(context, provider, this, this, cardSlotSelector, cameraCoordinator, number)
     private val storeImage = StoreImage(context, liveViewListener)
 
index 11aaade..51b8360 100644 (file)
@@ -36,10 +36,9 @@ import jp.osdn.gokigen.gokigenassets.preference.PreferenceAccessWrapper
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 
-class PixproCameraControl(private val context: AppCompatActivity, private val vibrator: IVibrator, private val informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val number : Int = 0) : ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown, IPixproInternalInterfaces, IPixproCommunicationNotify, IDisplayInjector
+class PixproCameraControl(private val context: AppCompatActivity, private val vibrator: IVibrator, private val informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val number : Int = 0, private val liveViewListener: CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify)) : ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown, IPixproInternalInterfaces, IPixproCommunicationNotify, IDisplayInjector
 {
     private val statusChecker = PixproStatusChecker()
-    private val liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val cameraConnection = PixproCameraConnection(context, provider, this, statusChecker)
     private val pixproCameraParameter = PixproCamera()
     private val commandCommunicator = PixproCommandCommunicator(pixproCameraParameter, this, statusChecker)
index b8fd73a..09e937b 100644 (file)
@@ -30,12 +30,10 @@ import jp.osdn.gokigen.gokigenassets.preference.PreferenceAccessWrapper
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 
-class RicohPentaxCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, statusReceiver : ICameraStatusReceiver, private val number : Int = 0)  : ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IDisplayInjector, IUseGR2CommandNotify, IKeyDown
+class RicohPentaxCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, statusReceiver : ICameraStatusReceiver, private val number : Int = 0, private val liveViewListener : CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify))  : ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IDisplayInjector, IUseGR2CommandNotify, IKeyDown
 {
-
     //private final Activity activity;
     //private final ICameraStatusReceiver provider;
-    private var liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val gr2Connection = RicohGr2Connection(context, statusReceiver, this, this)
     private val buttonControl = RicohGr2CameraButtonControl()
     private val statusChecker = RicohGr2StatusChecker(500)
index f4bdffe..afbe0b8 100644 (file)
@@ -38,11 +38,10 @@ import org.json.JSONObject
 import kotlin.collections.ArrayList
 
 
-class SonyCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, private val informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val cameraCoordinator: ICameraControlCoordinator, private val number : Int = 0) : ISonyCameraHolder,
+class SonyCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, private val informationNotify : IInformationReceiver, private val preference: ICameraPreferenceProvider, provider: ICameraStatusReceiver, private val cameraCoordinator: ICameraControlCoordinator, private val number : Int = 0, private val liveViewListener :CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify)) : ISonyCameraHolder,
     IDisplayInjector, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICameraShutter, IKeyDown
 {
     private val sonyCameraStatus = SonyStatus(JSONObject())
-    private val liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val cameraConnection = SonyCameraConnection(context, provider, this, cameraCoordinator, number)
     private val storeImage = StoreImage(context, liveViewListener)
 
index a8424c1..0f75a62 100644 (file)
@@ -29,12 +29,11 @@ import jp.osdn.gokigen.gokigenassets.preference.PreferenceAccessWrapper
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 
-class ThetaCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, statusReceiver : ICameraStatusReceiver, private val number : Int = 0) : ILiveViewController,
+class ThetaCameraControl(private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider, statusReceiver : ICameraStatusReceiver, private val number : Int = 0, private val liveViewListener : CameraLiveViewListenerImpl = CameraLiveViewListenerImpl(context, informationNotify)) : ILiveViewController,
     ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IKeyDown
 {
     private val sessionIdHolder = ThetaSessionHolder()
     private val cameraConnection = ThetaCameraConnection(context, statusReceiver, sessionIdHolder, sessionIdHolder, this)
-    private var liveViewListener = CameraLiveViewListenerImpl(context, informationNotify)
     private val liveViewControl = ThetaLiveViewControl(liveViewListener)
     private var indicator : IMessageDrawer? = null
 
index b247832..adab7a2 100644 (file)
@@ -10,7 +10,6 @@ import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraControl
 import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatusReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
-import jp.osdn.gokigen.mangle.scene.CameraProvider
 import net.osdn.gokigen.objectdetection.a01f.R
 import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor
 import net.osdn.gokigen.objectdetection.a01f.tflite.ObjectDetectionModelReader
index 0eecf49..a321133 100644 (file)
@@ -1,4 +1,4 @@
-package jp.osdn.gokigen.mangle.scene
+package net.osdn.gokigen.objectdetection.a01f.liaison
 
 import androidx.appcompat.app.AppCompatActivity
 import jp.osdn.gokigen.gokigenassets.camera.preference.CameraPreference
@@ -8,6 +8,7 @@ import jp.osdn.gokigen.gokigenassets.camera.vendor.camerax.operation.CameraContr
 import jp.osdn.gokigen.gokigenassets.camera.console.ConsolePanelControl
 import jp.osdn.gokigen.gokigenassets.camera.example.ExamplePictureControl
 import jp.osdn.gokigen.gokigenassets.camera.interfaces.*
+import jp.osdn.gokigen.gokigenassets.camera.preference.CameraPreferenceKeySet
 import jp.osdn.gokigen.gokigenassets.camera.vendor.omds.OmdsCameraControl
 import jp.osdn.gokigen.gokigenassets.camera.vendor.CameraControlCoordinator
 import jp.osdn.gokigen.gokigenassets.camera.vendor.panasonic.wrapper.PanasonicCameraControl
@@ -25,15 +26,29 @@ import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companio
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_PIXPRO
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_SONY
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_THETA
+import jp.osdn.gokigen.gokigenassets.liveview.image.CameraLiveViewListenerImpl
 import jp.osdn.gokigen.gokigenassets.preference.PreferenceAccessWrapper
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
-import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.USE_ONLY_SINGLE_CAMERA_X
-import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.USE_ONLY_SINGLE_CAMERA_X_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_METHOD_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_METHOD_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION1_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION1_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION2_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION2_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION3_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION3_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION4_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION4_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION5_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_OPTION5_1_DEFAULT_VALUE
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_SEQUENCE_1
+import net.osdn.gokigen.objectdetection.a01f.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_CAMERA_SEQUENCE_1_DEFAULT_VALUE
 
 
 class CameraProvider(private val activity: AppCompatActivity, private val informationNotify: IInformationReceiver, private val vibrator : IVibrator, private val statusReceiver : ICameraStatusReceiver)
 {
+    private val liveViewListener = CameraLiveViewListenerImpl(activity, informationNotify)
     private val cameraCoordinator = CameraControlCoordinator(informationNotify)
     private var cameraXisCreated = false
     private lateinit var cameraXControl0: ICameraControl
@@ -47,14 +62,14 @@ class CameraProvider(private val activity: AppCompatActivity, private val inform
             return (when (connectionMethod) {
                 PREFERENCE_CAMERA_METHOD_NONE -> DummyCameraControl(number)
                 PREFERENCE_CAMERA_METHOD_CONSOLE -> prepareConsolePanelControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_EXAMPLE -> prepareExamplePictureControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_CAMERAX -> prepareCameraXControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_THETA -> prepareThetaCameraControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_PENTAX -> preparePentaxCameraControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_PANASONIC -> preparePanasonicCameraControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_SONY -> prepareSonyCameraControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_PIXPRO -> preparePixproCameraControl(cameraPreference, number)
-                PREFERENCE_CAMERA_METHOD_OMDS -> prepareOmdsCameraControl(cameraPreference, number)
+                PREFERENCE_CAMERA_METHOD_EXAMPLE -> prepareExamplePictureControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_CAMERAX -> prepareCameraXControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_THETA -> prepareThetaCameraControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_PENTAX -> preparePentaxCameraControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_PANASONIC -> preparePanasonicCameraControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_SONY -> prepareSonyCameraControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_PIXPRO -> preparePixproCameraControl(cameraPreference, number, liveViewListener)
+                PREFERENCE_CAMERA_METHOD_OMDS -> prepareOmdsCameraControl(cameraPreference, number, liveViewListener)
                 else -> DummyCameraControl(number)
             })
         }
@@ -69,7 +84,7 @@ class CameraProvider(private val activity: AppCompatActivity, private val inform
     {
         try
         {
-            return (prepareCameraXControl(setupCameraPreference0(PreferenceAccessWrapper(activity)), number))
+            return (prepareCameraXControl(setupCameraPreference0(PreferenceAccessWrapper(activity)), number, liveViewListener))
         }
         catch (e : Exception)
         {
@@ -93,39 +108,48 @@ class CameraProvider(private val activity: AppCompatActivity, private val inform
         return (cameraSequence)
     }
 
+
     private fun setupCameraPreference0(wrapper : PreferenceAccessWrapper) : ICameraPreferenceProvider
     {
-        return (CameraPreference(0, wrapper, PREFERENCE_CAMERA_METHOD_NONE))
+        val method  = wrapper.getString(PREFERENCE_CAMERA_METHOD_1, PREFERENCE_CAMERA_METHOD_1_DEFAULT_VALUE)
+        val sequence  = wrapper.getString(PREFERENCE_CAMERA_SEQUENCE_1, PREFERENCE_CAMERA_SEQUENCE_1_DEFAULT_VALUE)
+        val option1  = wrapper.getString(PREFERENCE_CAMERA_OPTION1_1, PREFERENCE_CAMERA_OPTION1_1_DEFAULT_VALUE)
+        val option2  = wrapper.getString(PREFERENCE_CAMERA_OPTION2_1, PREFERENCE_CAMERA_OPTION2_1_DEFAULT_VALUE)
+        val option3  = wrapper.getString(PREFERENCE_CAMERA_OPTION3_1, PREFERENCE_CAMERA_OPTION3_1_DEFAULT_VALUE)
+        val option4  = wrapper.getString(PREFERENCE_CAMERA_OPTION4_1, PREFERENCE_CAMERA_OPTION4_1_DEFAULT_VALUE)
+        val option5  = wrapper.getString(PREFERENCE_CAMERA_OPTION5_1, PREFERENCE_CAMERA_OPTION5_1_DEFAULT_VALUE)
+
+        return (CameraPreference(0, wrapper, method, false, sequence, option1, option2, option3, option4, option5, CameraPreferenceKeySet(PREFERENCE_CAMERA_OPTION1_1, PREFERENCE_CAMERA_OPTION2_1, PREFERENCE_CAMERA_OPTION3_1, PREFERENCE_CAMERA_OPTION4_1, PREFERENCE_CAMERA_OPTION5_1)))
     }
 
-    private fun prepareThetaCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun prepareThetaCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (ThetaCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number))
+        return (ThetaCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number, liveViewListener))
     }
 
-    private fun preparePentaxCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun preparePentaxCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (RicohPentaxCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number))
+        return (RicohPentaxCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number, liveViewListener))
     }
 
-    private fun preparePanasonicCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun preparePanasonicCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (PanasonicCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, cameraCoordinator, number))
+        return (PanasonicCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, cameraCoordinator, number, liveViewListener))
     }
 
-    private fun prepareSonyCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun prepareSonyCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (SonyCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, cameraCoordinator, number))
+        return (SonyCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, cameraCoordinator, number, liveViewListener))
     }
 
-    private fun preparePixproCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun preparePixproCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (PixproCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number))
+        return (PixproCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number, liveViewListener))
     }
 
-    private fun prepareOmdsCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun prepareOmdsCameraControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (OmdsCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number))
+        return (OmdsCameraControl(activity, vibrator, informationNotify, cameraPreference, statusReceiver, number, liveViewListener))
     }
 
     private fun prepareConsolePanelControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
@@ -133,18 +157,18 @@ class CameraProvider(private val activity: AppCompatActivity, private val inform
         return (ConsolePanelControl(activity, vibrator, informationNotify, cameraPreference, number))
     }
 
-    private fun prepareExamplePictureControl(cameraPreference : ICameraPreferenceProvider, number : Int) : ICameraControl
+    private fun prepareExamplePictureControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl) : ICameraControl
     {
-        return (ExamplePictureControl(activity, vibrator, informationNotify, cameraPreference, number))
+        return (ExamplePictureControl(activity, vibrator, informationNotify, cameraPreference, number, liveViewListener))
     }
 
-    private fun prepareCameraXControl(cameraPreference : ICameraPreferenceProvider, number : Int): ICameraControl
+    private fun prepareCameraXControl(cameraPreference : ICameraPreferenceProvider, number : Int, liveViewListener: CameraLiveViewListenerImpl): ICameraControl
     {
         if ((cameraXisCreated)&&(::cameraXControl0.isInitialized))
         {
             return (cameraXControl0)
         }
-        cameraXControl0 = CameraControl(activity, cameraPreference, vibrator, informationNotify, statusReceiver, number)
+        cameraXControl0 = CameraControl(activity, cameraPreference, vibrator, informationNotify, statusReceiver, number, liveViewListener)
         cameraXisCreated = true
         return (cameraXControl0)
     }
index 5b6a380..0a5d9a0 100644 (file)
@@ -62,7 +62,7 @@ class ObjectDetectionModelReader(private val contentResolver: ContentResolver, p
                 objectDetector = ObjectDetector.createFromBufferAndOptions(byteBuffer, options)
                 //objectDetector = ObjectDetector.createFromBufferAndOptions(ByteBuffer.wrap(data), options)
             }
-            Log.v(TAG, " ObjectDetector is Ready!")
+            Log.v(TAG, " ----- ObjectDetector is Ready! -----")
             return (true)
         }
         catch (e: Exception)
index 2a486a9..ea9e4d2 100644 (file)
@@ -2,6 +2,7 @@ package net.osdn.gokigen.objectdetection.a01f.ui.view
 
 import android.graphics.Color
 import android.util.Log
+import androidx.compose.foundation.gestures.detectTapGestures
 import androidx.compose.foundation.layout.*
 import androidx.compose.material.*
 import androidx.compose.runtime.*
@@ -9,6 +10,7 @@ import androidx.compose.runtime.livedata.observeAsState
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.ExperimentalComposeUiApi
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.input.pointer.pointerInput
 import androidx.compose.ui.input.pointer.pointerInteropFilter
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.viewinterop.AndroidView
@@ -114,6 +116,14 @@ fun LiveViewScreen(navController: NavHostController, cameraControl: ICameraContr
                     onTouchListener.onTouch(liveView0, it)
                 }
             }
+            .pointerInput(Unit) {
+                detectTapGestures(
+                    onLongPress = { cameraControl.onLongClickReceiver(0).onLongClick(null) /* Called on Long Press */ },
+                    //onPress = { /* Called when the gesture starts */ },
+                    //onDoubleTap = { /* Called on Double Tap */ },
+                    //onTap = { /* Called on Tap */ }
+                )
+            }
         )
     }
 }