add a setting for Focus before Capture

This commit is contained in:
tibbi 2017-05-06 13:12:06 +02:00
parent 14f30ffb6f
commit e0f4cf4688
16 changed files with 46 additions and 0 deletions

View File

@ -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()

View File

@ -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"

View File

@ -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
}
}
}

View File

@ -104,5 +104,25 @@
android:text="@string/shutter_sound"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_focus_before_capture_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_focus_before_capture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/focus_before_capture"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -25,6 +25,7 @@
<string name="front_camera">Camera aan de voorkant resoluties</string>
<string name="photo">Foto</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Resoluções da câmera frontal</string>
<string name="photo">Foto</string>
<string name="video">Vídeo</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Resoluções da câmara frontal</string>
<string name="photo">Foto</string>
<string name="video">Vídeo</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Разрешения фронтальной камеры</string>
<string name="photo">Фото</string>
<string name="video">Видео</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -24,6 +24,7 @@
<string name="front_camera">Front camera resolutions</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->