From e0f4cf4688b9c3685a4bc9719f5cd2f21a4d3335 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 6 May 2017 13:12:06 +0200 Subject: [PATCH] add a setting for Focus before Capture --- .../com/simplemobiletools/camera/Config.kt | 4 ++++ .../com/simplemobiletools/camera/Constants.kt | 1 + .../camera/activities/SettingsActivity.kt | 9 +++++++++ app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 16 files changed, 46 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt b/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt index fe08cce8..57840634 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt @@ -30,6 +30,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SOUND, true) set(enabled) = prefs.edit().putBoolean(SOUND, enabled).apply() + var focusBeforeCapture: Boolean + get() = prefs.getBoolean(FOCUS_BEFORE_CAPTURE, true) + set(focus) = prefs.edit().putBoolean(FOCUS_BEFORE_CAPTURE, focus).apply() + var lastUsedCamera: Int get() = prefs.getInt(LAST_USED_CAMERA, Camera.CameraInfo.CAMERA_FACING_BACK) set(cameraId) = prefs.edit().putInt(LAST_USED_CAMERA, cameraId).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/camera/Constants.kt index 7b7f118c..1997451b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/Constants.kt @@ -8,6 +8,7 @@ val ORIENT_LANDSCAPE_RIGHT = 2 val SAVE_PHOTOS = "save_photos" val SHOW_PREVIEW = "show_preview" val SOUND = "sound" +val FOCUS_BEFORE_CAPTURE = "focus_before_capture" val LAST_USED_CAMERA = "last_used_camera" val FLASHLIGHT_STATE = "flashlight_state" val BACK_PHOTO_RESOLUTION_INDEX = "back_photo_resolution_index" diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index de33d262..f1023a03 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -27,6 +27,7 @@ class SettingsActivity : SimpleActivity() { setupSavePhotosFolder() setupShowPreview() setupSound() + setupFocusBeforeCapture() updateTextColors(settings_holder) } @@ -81,4 +82,12 @@ class SettingsActivity : SimpleActivity() { config.isSoundEnabled = settings_sound.isChecked } } + + private fun setupFocusBeforeCapture() { + settings_focus_before_capture.isChecked = config.focusBeforeCapture + settings_focus_before_capture_holder.setOnClickListener { + settings_focus_before_capture.toggle() + config.focusBeforeCapture = settings_focus_before_capture.isChecked + } + } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 9e1387f7..1e8b107c 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -104,5 +104,25 @@ android:text="@string/shutter_sound"/> + + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f8128aea..11e63ae9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 13c00bac..59cfa273 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a343213d..144cd570 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 66a9015a..6e43300f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 582883c0..f0cc5b7a 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 52c48a96..e3bda64b 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index bef4490f..7af48dce 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -25,6 +25,7 @@ Camera aan de voorkant resoluties Foto Video + Focus before capture diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 01676c4b..9f27a0de 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -24,6 +24,7 @@ Resoluções da câmera frontal Foto Vídeo + Focus before capture diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4744b517..403eda18 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -24,6 +24,7 @@ Resoluções da câmara frontal Foto Vídeo + Focus before capture diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index c1512b35..56bc36c7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -24,6 +24,7 @@ Разрешения фронтальной камеры Фото Видео + Focus before capture diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 2f85c558..37110788 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c01dcb66..99e4541b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -24,6 +24,7 @@ Front camera resolutions Photo Video + Focus before capture