add an option to use volume buttons as shutter

This commit is contained in:
tibbi 2017-05-07 12:22:27 +02:00
parent d59577512f
commit 62ab418c86
16 changed files with 46 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(FOCUS_BEFORE_CAPTURE, true)
set(focus) = prefs.edit().putBoolean(FOCUS_BEFORE_CAPTURE, focus).apply()
var volumeButtonsAsShutter: Boolean
get() = prefs.getBoolean(VOLUME_BUTTONS_AS_SHUTTER, false)
set(volumeButtonsAsShutter) = prefs.edit().putBoolean(VOLUME_BUTTONS_AS_SHUTTER, volumeButtonsAsShutter).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

@ -9,6 +9,7 @@ val SAVE_PHOTOS = "save_photos"
val SHOW_PREVIEW = "show_preview"
val SOUND = "sound"
val FOCUS_BEFORE_CAPTURE = "focus_before_capture"
val VOLUME_BUTTONS_AS_SHUTTER = "volume_buttons_as_shutter"
val LAST_USED_CAMERA = "last_used_camera"
val FLASHLIGHT_STATE = "flashlight_state"
val BACK_PHOTO_RESOLUTION_INDEX = "back_photo_resolution_index"

View File

@ -28,6 +28,7 @@ class SettingsActivity : SimpleActivity() {
setupShowPreview()
setupSound()
setupFocusBeforeCapture()
setupVolumeButtonsAsShutter()
updateTextColors(settings_holder)
}
@ -90,4 +91,12 @@ class SettingsActivity : SimpleActivity() {
config.focusBeforeCapture = settings_focus_before_capture.isChecked
}
}
private fun setupVolumeButtonsAsShutter() {
settings_volume_buttons_as_shutter.isChecked = config.volumeButtonsAsShutter
settings_volume_buttons_as_shutter_holder.setOnClickListener {
settings_volume_buttons_as_shutter.toggle()
config.volumeButtonsAsShutter = settings_volume_buttons_as_shutter.isChecked
}
}
}

View File

@ -124,5 +124,25 @@
android:text="@string/focus_before_capture"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_volume_buttons_as_shutter_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_volume_buttons_as_shutter"
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/volume_buttons_as_shutter"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

View File

@ -25,6 +25,7 @@
<string name="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Vor der Aufnahme fokussieren</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Messa a fuoco prima della cattura</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">キャプチャ前に再度焦点を合わせる</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -26,6 +26,7 @@
<string name="photo">Foto</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Foto</string>
<string name="video">Vídeo</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Foto</string>
<string name="video">Vídeo</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Фото</string>
<string name="video">Видео</string>
<string name="focus_before_capture">Перефокусировка перед захватом</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Fokusera om innan bildtagning</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</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="photo">Photo</string>
<string name="video">Video</string>
<string name="focus_before_capture">Focus before capture</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->