From 3dac37aa38ae9cf5db900c421c1f8a2b7d96186c Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 24 Apr 2025 16:34:32 +0530 Subject: [PATCH 1/7] Add low light boost icon (as image resource) --- app/src/main/res/drawable/low_light_boost.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/src/main/res/drawable/low_light_boost.xml diff --git a/app/src/main/res/drawable/low_light_boost.xml b/app/src/main/res/drawable/low_light_boost.xml new file mode 100644 index 00000000..6309884d --- /dev/null +++ b/app/src/main/res/drawable/low_light_boost.xml @@ -0,0 +1,12 @@ + + + + + From 3f8fd3a351dfc47bb4eea6b8ed343188b3841782 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 24 Apr 2025 19:03:23 +0530 Subject: [PATCH 2/7] Add UI for low light boost setting --- app/src/main/res/layout/more_settings.xml | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/app/src/main/res/layout/more_settings.xml b/app/src/main/res/layout/more_settings.xml index c3b8117f..6882e2f8 100644 --- a/app/src/main/res/layout/more_settings.xml +++ b/app/src/main/res/layout/more_settings.xml @@ -165,6 +165,65 @@ + + + + + + + + + + + + + + + + Date: Thu, 24 Apr 2025 19:06:05 +0530 Subject: [PATCH 3/7] Add string resources (for low light boost setting) --- app/src/main/res/values/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9aa6ae1e..a35af1fe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -193,4 +193,6 @@ The video\'s audio recording has been muted The video\'s audio recording has been unmuted + Low Light Boost + Activates low light boost whenever available and required for better pictures in darker environment From 98af40a2f14c80b8ef1f63aa90aca73f540d8bf9 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 24 Apr 2025 19:11:49 +0530 Subject: [PATCH 4/7] Add code to save low light boost preference --- .../java/app/grapheneos/camera/CamConfig.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt index dd08dd91..736b08a7 100644 --- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt +++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt @@ -114,6 +114,8 @@ class CamConfig(private val mActivity: MainActivity) { const val ENABLE_ZSL = "enable_zsl" + const val LOW_LIGHT_BOOST = "low_light_boost" + // const val IMAGE_FILE_FORMAT = "image_quality" // const val VIDEO_FILE_FORMAT = "video_quality" } @@ -159,6 +161,8 @@ class CamConfig(private val mActivity: MainActivity) { const val ENABLE_ZSL = false + const val LOW_LIGHT_BOOST = true + // const val IMAGE_FILE_FORMAT = "" // const val VIDEO_FILE_FORMAT = "" } @@ -558,6 +562,19 @@ class CamConfig(private val mActivity: MainActivity) { editor.apply() } + var lowLightBoost: Boolean + get() { + return commonPref.getBoolean( + SettingValues.Key.LOW_LIGHT_BOOST, + SettingValues.Default.LOW_LIGHT_BOOST + ) + } + set(value) { + val editor = commonPref.edit() + editor.putBoolean(SettingValues.Key.LOW_LIGHT_BOOST, value) + editor.apply() + } + val isZslSupported : Boolean by lazy { camera!!.cameraInfo.isZslSupported } From 0f78e5049d47b8a10d7f7a276dad3b037afb892e Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 24 Apr 2025 19:13:04 +0530 Subject: [PATCH 5/7] Make low light boost setting functional --- .../camera/ui/activities/MoreSettings.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt b/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt index 18b228fb..3bc6fd4f 100644 --- a/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt +++ b/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.graphics.Color import android.graphics.Rect +import android.os.Build import android.os.Bundle import android.view.KeyEvent import android.view.MotionEvent @@ -236,6 +237,22 @@ open class MoreSettings : AppCompatActivity(), TextView.OnEditorActionListener { } } + // Setting only for Android 15 and above + val lowLightBoostSetting = binding.lowLightBoostSetting + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { + lowLightBoostSetting.visibility = View.VISIBLE + + val lowLightToggle = binding.lowLightBoostToggle + lowLightToggle.isChecked = camConfig.lowLightBoost + lowLightToggle.setOnClickListener { + camConfig.lowLightBoost = !camConfig.lowLightBoost + } + + lowLightBoostSetting.setOnClickListener { + lowLightToggle.performClick() + } + } + if (!showStorageSettings) { binding.storageLocationSettings.visibility = View.GONE } From b7d3568ef393a74d7fd5a3d5f5bb863a3aa785e6 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Thu, 24 Apr 2025 19:13:25 +0530 Subject: [PATCH 6/7] Implement low light boost functionality --- app/src/main/java/app/grapheneos/camera/CamConfig.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt index 736b08a7..9a85028f 100644 --- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt +++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt @@ -1303,7 +1303,13 @@ class CamConfig(private val mActivity: MainActivity) { loadTabs() - camera?.cameraInfo?.zoomState?.observe(mActivity) { + val cameraInfo = camera!!.cameraInfo + + if (cameraInfo.isLowLightBoostSupported && lowLightBoost) { + camera!!.cameraControl.enableLowLightBoostAsync(lowLightBoost) + } + + cameraInfo.zoomState?.observe(mActivity) { if (it.linearZoom != 0f || it.zoomRatio != 1f) { mActivity.zoomBar.updateThumb() } From 75c077f44f61602df520300a50e08086bd600fe5 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Fri, 25 Apr 2025 12:35:07 +0530 Subject: [PATCH 7/7] Add verification metadata --- gradle/verification-metadata.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 8e62752d..f2713009 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -3041,6 +3041,14 @@ + + + + + + + +