Skip to content

Commit

Permalink
Set focus distance to max on celestial navigation
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Corry <[email protected]>
  • Loading branch information
kylecorry31 committed Dec 13, 2024
1 parent bfa496e commit 7e5f187
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CameraView(context: Context, attrs: AttributeSet?) : FrameLayout(context,
private var zoom: Float = -1f
private var isCapturing = false
private var exposureCompensation = 0f
private var focus: Float? = null

var passThroughTouchEvents = false

Expand Down Expand Up @@ -200,13 +201,19 @@ class CameraView(context: Context, attrs: AttributeSet?) : FrameLayout(context,
camera?.setExposure(mapped)
}

fun setFocus(value: Float?) {
focus = value
camera?.setFocusDistancePercentage(value)
}

@SuppressLint("UnsafeOptInUsageError")
private fun onCameraUpdate(): Boolean {
if (zoom == -1f) {
setZoomRatio(1f)
}
setZoom(zoom)
setExposureCompensation(exposureCompensation)
setFocus(focus)
camera?.setTorch(isTorchOn)
if (captureListener == null && imageListener == null) {
camera?.image?.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class CelestialNavigationFragment : BoundFragment<FragmentCelestialNavigationBin
binding.camera.setScaleType(PreviewView.ScaleType.FILL_CENTER)
binding.camera.setShowTorch(false)
binding.camera.setExposureCompensation(1f)
binding.camera.setFocus(1f)
binding.arView.bind(binding.camera)
binding.arView.backgroundFillColor = Color.TRANSPARENT
binding.arView.decimalPlaces = 2
Expand Down

0 comments on commit 7e5f187

Please sign in to comment.