@@ -54,6 +54,17 @@ class Settings( private val activity: Activity) {
5454 val MACRO_NUMBER_OF_PHOTOS_OPTIONS = arrayOf(3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 )
5555
5656 val FLASH_MODES = arrayOf(" OFF" , " ON" , " Torch" )
57+
58+ val WB_MODES = arrayOf(
59+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_AUTO ,
60+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_INCANDESCENT ,
61+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_FLUORESCENT ,
62+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_WARM_FLUORESCENT ,
63+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_DAYLIGHT ,
64+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_CLOUDY_DAYLIGHT ,
65+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_TWILIGHT ,
66+ android.hardware.camera2.CaptureResult .CONTROL_AWB_MODE_SHADE
67+ )
5768 }
5869
5970 var saveUri: String = " "
@@ -80,6 +91,7 @@ class Settings( private val activity: Activity) {
8091 var flashMode: Int = FLASH_MODE_OFF
8192 var enableHapticFeedback = true
8293 var useLocation = true
94+ var whiteBalance = 0
8395
8496 init {
8597 loadProperties()
@@ -172,4 +184,10 @@ class Settings( private val activity: Activity) {
172184
173185 return array[index]
174186 }
187+
188+ fun getWBMode (availableModes : IntArray ): Int {
189+ val whiteBalance = this .whiteBalance;
190+ val mode = if (whiteBalance < WB_MODES .size) WB_MODES [whiteBalance] else WB_MODES [0 ]
191+ return if (availableModes.contains(mode)) mode else WB_MODES [0 ]
192+ }
175193}
0 commit comments