OSDN Git Service

状態パネルの接続名称をPreferenceと整合をとる。
authorMRSa <mrsa@myad.jp>
Sat, 24 Jul 2021 02:56:49 +0000 (11:56 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 24 Jul 2021 02:56:49 +0000 (11:56 +0900)
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/console/ConsolePanelControl.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/panasonic/status/CameraStatusConvert.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/ricohpentax/status/RicohGr2StatusHolder.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/theta/status/ThetaCameraStatusWatcher.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/constants/IApplicationConstantConvert.kt

index caadfa2..58c9f34 100644 (file)
@@ -26,6 +26,8 @@ import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatus.Companion.S
 import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatus.Companion.TAKE_MODE
 import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatus.Companion.WHITE_BALANCE
 import jp.osdn.gokigen.gokigenassets.camera.theta.status.ICaptureModeReceiver
+import jp.osdn.gokigen.gokigenassets.constants.IApplicationConstantConvert.Companion.ID_PREFERENCE_ARRAY_CAMERA_METHOD
+import jp.osdn.gokigen.gokigenassets.constants.IApplicationConstantConvert.Companion.ID_PREFERENCE_ARRAY_CAMERA_METHOD_VALUE
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_CAMERAX
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_PANASONIC
 import jp.osdn.gokigen.gokigenassets.constants.ICameraConnectionMethods.Companion.PREFERENCE_CAMERA_METHOD_PENTAX
@@ -35,7 +37,7 @@ import jp.osdn.gokigen.gokigenassets.liveview.focusframe.IAutoFocusFrameDisplay
 import jp.osdn.gokigen.gokigenassets.scene.IInformationReceiver
 import jp.osdn.gokigen.gokigenassets.scene.IVibrator
 
-class ConsolePanelControl (context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider) : IDisplayInjector,
+class ConsolePanelControl (private val context: AppCompatActivity, private val vibrator : IVibrator, informationNotify: IInformationReceiver, private val preference: ICameraPreferenceProvider) : IDisplayInjector,
     ILiveViewController, ICameraControl, View.OnClickListener, View.OnLongClickListener, ICaptureModeReceiver, ICameraShutter, IKeyDown, IAnotherDrawer, View.OnTouchListener, ICameraStatus, IDetectPositionReceiver
 {
     private val gestureListener = ConsolePanelGestureListener(this)
@@ -283,12 +285,10 @@ class ConsolePanelControl (context: AppCompatActivity, private val vibrator : IV
                 drawShutterSpeed(canvas, currentCameraStatus)
                 drawAperture(canvas, currentCameraStatus)
                 drawExpRev(canvas, currentCameraStatus)
-
                 drawCaptureMode(canvas, currentCameraStatus)
                 drawIsoSensitivity(canvas, currentCameraStatus)
                 drawWhiteBalance(canvas, currentCameraStatus)
                 drawMeteringMode(canvas, currentCameraStatus)
-
                 drawPictureEffect(canvas, currentCameraStatus)
 
                 drawBatteryLevel(canvas, currentCameraStatus)
@@ -456,15 +456,36 @@ class ConsolePanelControl (context: AppCompatActivity, private val vibrator : IV
         try
         {
             //  area : bottom-left
+            var methodName = ""
             val rect = RectF(canvasWidth * 0.0f, canvasHeight * 8.0f, canvasWidth * 1.0f,canvasHeight * 9.0f)
+            val method = currentCameraControl?.getConnectionMethod()
+            if (method != null)
+            {
+                methodName = getConnectionMethodName(method)
+            }
+            drawString(canvas, rect, "$currentCameraControlId : $methodName", Color.WHITE)
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+        }
+    }
 
-            val msg = "$currentCameraControlId : ${currentCameraControl?.getConnectionMethod()}"
-            drawString(canvas, rect, msg, Color.WHITE)
+    private fun getConnectionMethodName(method : String) : String
+    {
+        try
+        {
+            val index = context.resources.getStringArray(ID_PREFERENCE_ARRAY_CAMERA_METHOD_VALUE).indexOf(method)
+            if (index >= 0)
+            {
+                return (context.resources.getStringArray(ID_PREFERENCE_ARRAY_CAMERA_METHOD)[index])
+            }
         }
         catch (e : Exception)
         {
             e.printStackTrace()
         }
+        return (method)
     }
 
     private fun drawBatteryLevel(canvas: Canvas, currentCameraStatus : ICameraStatus)
index 3d69c01..1e4e25e 100644 (file)
@@ -491,13 +491,13 @@ class CameraStatusConvert(private val statusHolder: CameraStatusHolder) : ICamer
         var color = Color.WHITE
         try
         {
-            if (currentBattery < 50)
+            if (currentBattery < 30)
             {
-                color = Color.YELLOW
+                color = Color.RED
             }
-            else if (currentBattery < 30)
+            else if (currentBattery < 50)
             {
-                color = Color.RED
+                color = Color.YELLOW
             }
         }
         catch (e : Exception)
index 27ffe32..934a9fa 100644 (file)
@@ -179,13 +179,13 @@ class RicohGr2StatusHolder(private val notifier: ICameraStatusUpdateNotify?)
         try
         {
             val percentage = latestResultObject?.getString("battery")?.toInt() ?: 100
-           if (percentage < 50)
+           if (percentage < 30)
            {
-               color = Color.YELLOW
+               color = Color.RED
            }
-           else if (percentage < 30)
+           else if (percentage < 50)
            {
-               color = Color.RED
+               color = Color.YELLOW
            }
         }
         catch (e : Exception)
index a4573e7..42f97f4 100644 (file)
@@ -585,13 +585,13 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
             if (currentBatteryLevel >= 0.0f)
             {
                 val percentage = kotlin.math.ceil(currentBatteryLevel * 100.0).toInt()
-                if (percentage < 50)
+                if (percentage < 30)
                 {
-                    color = Color.YELLOW
+                    color = Color.RED
                 }
-                else if (percentage < 30)
+                else if (percentage < 50)
                 {
-                    color = Color.RED
+                    color = Color.YELLOW
                 }
             }
         }
@@ -601,7 +601,4 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
         }
         return (color)
     }
-
-
-
 }
index 0e1da73..e84f155 100644 (file)
@@ -47,8 +47,6 @@ import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.P
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.PREFERENCE_SAVE_LOCAL_LOCATION_DEFAULT_VALUE
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.SHOW_GRID
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.SHOW_GRID_DEFAULT_VALUE
-import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.SHOW_GRID_STATUS
-import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.SHOW_GRID_STATUS_DEFAULT_VALUE
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.USE_GR2_SPECIAL_COMMAND
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.USE_SELF_TIMER
 import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor.Companion.USE_SELF_TIMER_DEFAULT_VALUE