adding a setting for increasing volume gradually

This commit is contained in:
tibbi 2018-07-06 23:27:54 +02:00
parent 8d611535f0
commit 12d9aecc28
4 changed files with 37 additions and 0 deletions

View file

@ -34,6 +34,7 @@ class SettingsActivity : SimpleActivity() {
setupSnoozeTime()
setupVibrate()
setupTimerMaxReminder()
setupIncreaseVolumeGradually()
setupUseTextShadow()
setupCustomizeWidgetColors()
updateTextColors(settings_holder)
@ -152,6 +153,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupIncreaseVolumeGradually() {
settings_increase_volume_gradually.isChecked = config.increaseVolumeGradually
settings_increase_volume_gradually_holder.setOnClickListener {
settings_increase_volume_gradually.toggle()
config.increaseVolumeGradually = settings_increase_volume_gradually.isChecked
}
}
private fun setupUseTextShadow() {
settings_use_text_shadow.isChecked = config.useTextShadow
settings_use_text_shadow_holder.setOnClickListener {

View file

@ -50,4 +50,8 @@ class Config(context: Context) : BaseConfig(context) {
var useTextShadow: Boolean
get() = prefs.getBoolean(USE_TEXT_SHADOW, true)
set(useTextShadow) = prefs.edit().putBoolean(USE_TEXT_SHADOW, useTextShadow).apply()
var increaseVolumeGradually: Boolean
get() = prefs.getBoolean(INCREASE_VOLUME_GRADUALLY, true)
set(increaseVolumeGradually) = prefs.edit().putBoolean(INCREASE_VOLUME_GRADUALLY, increaseVolumeGradually).apply()
}

View file

@ -14,6 +14,7 @@ const val TIMER_SOUND_TITLE = "timer_sound_title"
const val TIMER_MAX_REMINDER_SECS = "timer_max_reminder_secs"
const val ALARM_MAX_REMINDER_SECS = "alarm_max_reminder_secs"
const val USE_TEXT_SHADOW = "use_text_shadow"
const val INCREASE_VOLUME_GRADUALLY = "increase_volume_gradually"
const val TABS_COUNT = 4
const val EDITED_TIME_ZONE_SEPARATOR = ":"

View file

@ -242,6 +242,29 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_increase_volume_gradually_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_increase_volume_gradually"
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/increase_volume_gradually"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_use_same_snooze_holder"
android:layout_width="match_parent"