Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion app/src/main/java/app/grapheneos/camera/CamConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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 = ""
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -1286,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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/low_light_boost.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">

<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M16.954,8.66l2.12,-2.12 1.415,1.414 -2.13,2.12zM17.9,14c-0.5,-2.85 -2.95,-5 -5.9,-5s-5.45,2.15 -5.9,5h11.8zM2,16h20v4L2,20zM11,4h2v3h-2zM3.54,7.925L4.954,6.51l2.122,2.122 -1.415,1.415z"/>

</vector>
59 changes: 59 additions & 0 deletions app/src/main/res/layout/more_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,65 @@

</LinearLayout>

<LinearLayout
android:id="@+id/low_light_boost_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingHorizontal="16dp"
android:paddingBottom="10dp"
android:visibility="gone">

<ImageView
android:id="@+id/low_light_boost_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/low_light_boost"
android:paddingStart="4dp"
android:paddingEnd="8dp"
android:src="@drawable/low_light_boost" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:id="@+id/low_light_boost_setting_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:paddingBottom="2dp"
android:text="@string/low_light_boost"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />

<TextView
android:id="@+id/low_light_boost_setting_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:text="@string/low_light_boost_description"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />

</LinearLayout>

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/low_light_boost_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="0dp" />

</LinearLayout>

</LinearLayout>

<LinearLayout
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,6 @@

<string name="video_audio_recording_muted">The video\'s audio recording has been muted</string>
<string name="video_audio_recording_unmuted">The video\'s audio recording has been unmuted</string>
<string name="low_light_boost">Low Light Boost</string>
<string name="low_light_boost_description">Activates low light boost whenever available and required for better pictures in darker environment</string>
</resources>
8 changes: 8 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3041,6 +3041,14 @@
<sha512 value="44fbb461d2e7d505915d94fd06d48660482aaf75f136862ff7567ec3dc868a84e645785b45710c2045ffe6087f86585b917703e25892d1c68093537dbab5a665" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jspecify" name="jspecify" version="1.0.0">
<artifact name="jspecify-1.0.0.jar">
<sha512 value="efded31ef5b342f09422935076e599789076431e93a746685c0607e7de5592719ba6aacde0be670b3f064d1e85630d58d5bce6b34aed2a288fdb34f745efb7bc" origin="Generated by Gradle"/>
</artifact>
<artifact name="jspecify-1.0.0.module">
<sha512 value="02669b1c62e0c6988dd812b89201acbe6dad796f3573d6e626d2f56d2194896e198bf3998f0618019b722c7b0c93f013528bff1118f835154f2bd61c17e67b77" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-coroutines-core-jvm" version="1.8.1">
<artifact name="kotlinx-coroutines-core-jvm-1.8.1.jar">
<sha512 value="75438ba95e596280363f60007fc4586e3341c679b628c3ec7f393f8d44acf44ea74f4399de27dce40cd2c5bc6394f47cfb6949f777a32867f9b967a83af6b52f" origin="Generated by Gradle"/>
Expand Down