Skip to content

Commit

Permalink
Add guide for mirror camera
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Apr 27, 2024
1 parent 7ca42fa commit e1e6497
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package com.kylecorry.trail_sense.tools.mirror
import android.content.Context
import com.kylecorry.andromeda.camera.Camera
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.volume.SystemVolumeAction
import com.kylecorry.trail_sense.tools.tools.infrastructure.Tool
import com.kylecorry.trail_sense.tools.tools.infrastructure.ToolCategory
import com.kylecorry.trail_sense.tools.tools.infrastructure.ToolRegistration
import com.kylecorry.trail_sense.tools.tools.infrastructure.ToolVolumeAction
import com.kylecorry.trail_sense.tools.tools.infrastructure.ToolVolumeActionPriority
import com.kylecorry.trail_sense.tools.tools.infrastructure.Tools

object MirrorCameraToolRegistration : ToolRegistration {
Expand All @@ -16,7 +19,15 @@ object MirrorCameraToolRegistration : ToolRegistration {
R.drawable.ic_mirror_camera,
R.id.mirrorCameraFragment,
ToolCategory.Other,
isAvailable = { Camera.hasFrontCamera(it) }
guideId = R.raw.guide_tool_mirror_camera,
isAvailable = { Camera.hasFrontCamera(it) },
volumeActions = listOf(
ToolVolumeAction(
ToolVolumeActionPriority.Normal,
{ _, isOpen -> isOpen },
::SystemVolumeAction
)
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class ToolMirrorCameraFragment : BoundFragment<FragmentToolMirrorCameraBinding>(
private fun startCamera() {
requestCamera {
if (it) {
binding.camera.start(readFrames = false, preferBackCamera = false)
binding.camera.start(
readFrames = false,
preferBackCamera = false,
shouldStabilizePreview = false
)
} else {
alertNoCameraPermission()
}
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/raw/guide_tool_mirror_camera.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Mirror Camera tool can be used as a mirror for yourself, for example if you got something in your eye.

## Camera
A front camera preview is displayed with white bars around it (to provide light in dark environments). The preview shows a mirror image.

You can zoom by pinching the screen or by using the slider.
6 changes: 6 additions & 0 deletions guides/en-US/guide_tool_mirror_camera.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Mirror Camera tool can be used as a mirror for yourself, for example if you got something in your eye.

## Camera
A front camera preview is displayed with white bars around it (to provide light in dark environments). The preview shows a mirror image.

You can zoom by pinching the screen or by using the slider.
1 change: 1 addition & 0 deletions site/guides.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const guides = [
"tool_light_meter",
"tool_lightning_strike_distance",
"tool_metal_detector",
"tool_mirror_camera",
"tool_navigation",
"tool_notes",
"tool_packing_lists",
Expand Down

0 comments on commit e1e6497

Please sign in to comment.