Merge pull request #58 from trubitsyn/master

Fix #57
This commit is contained in:
Tibor Kaputa 2017-06-14 20:24:39 +02:00 committed by GitHub
commit c8e4f411a4
17 changed files with 47 additions and 1 deletions

View File

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

@ -10,6 +10,7 @@ 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 TURN_FLASH_OFF_AT_STARTUP = "turn_flash_off_at_startup"
val LAST_USED_CAMERA = "last_used_camera"
val FLASHLIGHT_STATE = "flashlight_state"
val BACK_PHOTO_RESOLUTION_INDEX = "back_photo_resolution_index"

View File

@ -155,7 +155,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
mIsInPhotoMode = true
mTimerHandler = Handler()
mFadeHandler = Handler()
mFlashlightState = config.flashlightState
mFlashlightState = if (config.turnFlashOffAtStartup) FLASH_OFF else config.flashlightState
setupPreviewImage(true)
}

View File

@ -29,6 +29,7 @@ class SettingsActivity : SimpleActivity() {
setupSound()
setupFocusBeforeCapture()
setupVolumeButtonsAsShutter()
setupTurnFlashOffAtStartup()
updateTextColors(settings_holder)
}
@ -99,4 +100,12 @@ class SettingsActivity : SimpleActivity() {
config.volumeButtonsAsShutter = settings_volume_buttons_as_shutter.isChecked
}
}
private fun setupTurnFlashOffAtStartup() {
settings_turn_flash_off_at_startup.isChecked = config.turnFlashOffAtStartup
settings_turn_flash_off_at_startup_holder.setOnClickListener {
settings_turn_flash_off_at_startup.toggle()
config.turnFlashOffAtStartup = settings_turn_flash_off_at_startup.isChecked
}
}
}

View File

@ -144,5 +144,25 @@
android:text="@string/volume_buttons_as_shutter"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_turn_flash_off_at_startup_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_turn_flash_off_at_startup"
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/turn_flash_off_at_startup"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<string name="video">Vídeo</string>
<string name="focus_before_capture">Enfocar antes de la captura</string>
<string name="volume_buttons_as_shutter">Utilizar los botones de volumen como obturador</string>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<string name="video">Video</string>
<string name="focus_before_capture">キャプチャ前に再度焦点を合わせる</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</string>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -28,6 +28,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<string name="video">Vídeo</string>
<string name="focus_before_capture">Focar antes de capturar</string>
<string name="volume_buttons_as_shutter">Usar botões de volume como obturador</string>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<string name="video">Видео</string>
<string name="focus_before_capture">Перефокусировка перед захватом</string>
<string name="volume_buttons_as_shutter">Use volume buttons as shutter</string>
<string name="turn_flash_off_at_startup">Выключать вспышку при запуске</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -27,6 +27,7 @@
<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>
<string name="turn_flash_off_at_startup">Turn flash off at startup</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->