From 7ca42fa80893a12e50362167df5bd7c9d6b5fd1d Mon Sep 17 00:00:00 2001 From: Kyle Corry Date: Sat, 27 Apr 2024 13:09:55 -0400 Subject: [PATCH] Add new icon for mirror camera --- .../trail_sense/tools/mirror/MirrorCameraToolRegistration.kt | 2 +- .../trail_sense/tools/mirror/ui/ToolMirrorCameraFragment.kt | 5 ++++- app/src/main/res/drawable/ic_mirror_camera.xml | 1 + app/src/main/res/layout/fragment_tool_mirror_camera.xml | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_mirror_camera.xml 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 357a349ba..7091ff03a 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 @@ -13,7 +13,7 @@ object MirrorCameraToolRegistration : ToolRegistration { return Tool( Tools.MIRROR_CAMERA, context.getString(R.string.mirror_camera), - R.drawable.ic_camera, // TODO: Get an icon + R.drawable.ic_mirror_camera, R.id.mirrorCameraFragment, ToolCategory.Other, isAvailable = { Camera.hasFrontCamera(it) } 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 1ca1d8472..43a0ebb74 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 @@ -1,10 +1,13 @@ package com.kylecorry.trail_sense.tools.mirror.ui +import android.graphics.Color import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.camera.view.PreviewView +import com.kylecorry.andromeda.core.system.Screen +import com.kylecorry.andromeda.core.ui.Colors.withAlpha import com.kylecorry.andromeda.fragments.BoundFragment import com.kylecorry.andromeda.torch.ScreenTorch import com.kylecorry.trail_sense.databinding.FragmentToolMirrorCameraBinding @@ -22,7 +25,7 @@ class ToolMirrorCameraFragment : BoundFragment( override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - binding.camera.setScaleType(PreviewView.ScaleType.FILL_CENTER) + binding.camera.setScaleType(PreviewView.ScaleType.FIT_CENTER) binding.camera.setShowTorch(false) } diff --git a/app/src/main/res/drawable/ic_mirror_camera.xml b/app/src/main/res/drawable/ic_mirror_camera.xml new file mode 100644 index 000000000..61db3bccb --- /dev/null +++ b/app/src/main/res/drawable/ic_mirror_camera.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_tool_mirror_camera.xml b/app/src/main/res/layout/fragment_tool_mirror_camera.xml index dc1bfabf7..3201d64a5 100644 --- a/app/src/main/res/layout/fragment_tool_mirror_camera.xml +++ b/app/src/main/res/layout/fragment_tool_mirror_camera.xml @@ -9,6 +9,7 @@ android:id="@+id/camera" android:layout_width="0dp" android:layout_height="0dp" + android:keepScreenOn="true" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHeight_percent="0.8"