From e1e64971dc6bb9ecc65ad2c65aa2cefbfebbe0b2 Mon Sep 17 00:00:00 2001 From: Kyle Corry Date: Sat, 27 Apr 2024 13:16:01 -0400 Subject: [PATCH] Add guide for mirror camera --- .../tools/mirror/MirrorCameraToolRegistration.kt | 13 ++++++++++++- .../tools/mirror/ui/ToolMirrorCameraFragment.kt | 6 +++++- app/src/main/res/raw/guide_tool_mirror_camera.md | 6 ++++++ guides/en-US/guide_tool_mirror_camera.txt | 6 ++++++ site/guides.js | 1 + 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/raw/guide_tool_mirror_camera.md create mode 100644 guides/en-US/guide_tool_mirror_camera.txt diff --git a/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/MirrorCameraToolRegistration.kt b/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/MirrorCameraToolRegistration.kt index 7091ff03a..d9b387174 100644 --- a/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/MirrorCameraToolRegistration.kt +++ b/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/MirrorCameraToolRegistration.kt @@ -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 { @@ -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 + ) + ) ) } } \ No newline at end of file diff --git a/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/ui/ToolMirrorCameraFragment.kt b/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/ui/ToolMirrorCameraFragment.kt index 43a0ebb74..8429f7ef5 100644 --- a/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/ui/ToolMirrorCameraFragment.kt +++ b/app/src/main/java/com/kylecorry/trail_sense/tools/mirror/ui/ToolMirrorCameraFragment.kt @@ -44,7 +44,11 @@ class ToolMirrorCameraFragment : BoundFragment( private fun startCamera() { requestCamera { if (it) { - binding.camera.start(readFrames = false, preferBackCamera = false) + binding.camera.start( + readFrames = false, + preferBackCamera = false, + shouldStabilizePreview = false + ) } else { alertNoCameraPermission() } diff --git a/app/src/main/res/raw/guide_tool_mirror_camera.md b/app/src/main/res/raw/guide_tool_mirror_camera.md new file mode 100644 index 000000000..267a2ef5c --- /dev/null +++ b/app/src/main/res/raw/guide_tool_mirror_camera.md @@ -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. \ No newline at end of file diff --git a/guides/en-US/guide_tool_mirror_camera.txt b/guides/en-US/guide_tool_mirror_camera.txt new file mode 100644 index 000000000..267a2ef5c --- /dev/null +++ b/guides/en-US/guide_tool_mirror_camera.txt @@ -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. \ No newline at end of file diff --git a/site/guides.js b/site/guides.js index 94390701a..ae75de0a0 100644 --- a/site/guides.js +++ b/site/guides.js @@ -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",