adding a setting item for toggling time zone changing

This commit is contained in:
tibbi 2019-12-09 23:18:33 +01:00
parent b89796868f
commit 0c88eacd6c
4 changed files with 38 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class SettingsActivity : SimpleActivity() {
setupCustomizeWidgetColors()
setupViewToOpenFromListWidget()
setupDimEvents()
setupAllowChangingTimeZones()
updateTextColors(settings_holder)
checkPrimaryColor()
setupSectionColors()
@ -565,6 +566,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupAllowChangingTimeZones() {
settings_allow_changing_time_zones.isChecked = config.allowChangingTimeZones
settings_allow_changing_time_zones_holder.setOnClickListener {
settings_allow_changing_time_zones.toggle()
config.allowChangingTimeZones = settings_allow_changing_time_zones.isChecked
}
}
private fun setupDefaultStartTime() {
updateDefaultStartTimeText()
settings_default_start_time_holder.setOnClickListener {
@ -679,6 +688,7 @@ class SettingsActivity : SimpleActivity() {
put(SHOW_GRID, config.showGrid)
put(LOOP_REMINDERS, config.loopReminders)
put(DIM_PAST_EVENTS, config.dimPastEvents)
put(ALLOW_CHANGING_TIME_ZONES, config.allowChangingTimeZones)
put(USE_PREVIOUS_EVENT_REMINDERS, config.usePreviousEventReminders)
put(DEFAULT_REMINDER_1, config.defaultReminder1)
put(DEFAULT_REMINDER_2, config.defaultReminder2)
@ -764,6 +774,7 @@ class SettingsActivity : SimpleActivity() {
SHOW_GRID -> config.showGrid = value.toBoolean()
LOOP_REMINDERS -> config.loopReminders = value.toBoolean()
DIM_PAST_EVENTS -> config.dimPastEvents = value.toBoolean()
ALLOW_CHANGING_TIME_ZONES -> config.allowChangingTimeZones = value.toBoolean()
USE_PREVIOUS_EVENT_REMINDERS -> config.usePreviousEventReminders = value.toBoolean()
DEFAULT_REMINDER_1 -> config.defaultReminder1 = value.toInt()
DEFAULT_REMINDER_2 -> config.defaultReminder2 = value.toInt()

View File

@ -185,4 +185,8 @@ class Config(context: Context) : BaseConfig(context) {
var defaultEventTypeId: Long
get() = prefs.getLong(DEFAULT_EVENT_TYPE_ID, -1L)
set(defaultEventTypeId) = prefs.edit().putLong(DEFAULT_EVENT_TYPE_ID, defaultEventTypeId).apply()
var allowChangingTimeZones: Boolean
get() = prefs.getBoolean(ALLOW_CHANGING_TIME_ZONES, false)
set(allowChangingTimeZones) = prefs.edit().putBoolean(ALLOW_CHANGING_TIME_ZONES, allowChangingTimeZones).apply()
}

View File

@ -73,6 +73,7 @@ const val LAST_VIBRATE_ON_REMINDER = "last_vibrate_on_reminder"
const val DEFAULT_START_TIME = "default_start_time"
const val DEFAULT_DURATION = "default_duration"
const val DEFAULT_EVENT_TYPE_ID = "default_event_type_id"
const val ALLOW_CHANGING_TIME_ZONES = "allow_changing_time_zones"
// repeat_rule for monthly and yearly repetition
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)

View File

@ -960,6 +960,28 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_allow_changing_time_zones_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_allow_changing_time_zones"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/allow_changing_time_zones"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_delete_all_events_holder"
android:layout_width="match_parent"