adding a setting item for toggling sos button visibility
This commit is contained in:
parent
72dba0fa85
commit
1e20314694
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -167,6 +167,29 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_sos_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/normal_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/normal_margin"
|
||||
android:paddingBottom="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_sos"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_sos"
|
||||
app:switchPadding="@dimen/medium_margin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_force_portrait_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue