diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt index 8bfb91d..c2fd547 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt @@ -28,6 +28,7 @@ class SettingsActivity : SimpleActivity() { setupTurnFlashlightOn() setupBrightDisplay() setupStroboscope() + setupSOS() setupForcePortrait() updateTextColors(settings_holder) } @@ -88,6 +89,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupSOS() { + settings_sos.isChecked = config.sos + settings_sos_holder.setOnClickListener { + settings_sos.toggle() + config.sos = settings_sos.isChecked + } + } + private fun setupForcePortrait() { settings_force_portrait.isChecked = config.forcePortraitMode settings_force_portrait_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Config.kt index 112bf3e..e52fcd0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Config.kt @@ -17,6 +17,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(STROBOSCOPE, true) set(stroboscope) = prefs.edit().putBoolean(STROBOSCOPE, stroboscope).apply() + var sos: Boolean + get() = prefs.getBoolean(SOS, true) + set(sos) = prefs.edit().putBoolean(SOS, sos).apply() + var turnFlashlightOn: Boolean get() = prefs.getBoolean(TURN_FLASHLIGHT_ON, false) set(turnFlashlightOn) = prefs.edit().putBoolean(TURN_FLASHLIGHT_ON, turnFlashlightOn).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Constants.kt index a567d74..e954a73 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/Constants.kt @@ -10,3 +10,4 @@ const val TOGGLE_WIDGET_UI = "toggle_widget_ui" const val STROBOSCOPE_FREQUENCY = "stroboscope_frequency" const val STROBOSCOPE_PROGRESS = "stroboscope_progress" const val FORCE_PORTRAIT_MODE = "force_portrait_mode" +const val SOS = "sos" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index b579bb9..db6ad24 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -167,6 +167,29 @@ + + + + + +