mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-28 17:39:32 +01:00
make pull-to-refresh for caldav calendars optional, disabled by default
This commit is contained in:
parent
c983014198
commit
e4453a4e33
@ -133,7 +133,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||||||
search_placeholder_2.setTextColor(config.textColor)
|
search_placeholder_2.setTextColor(config.textColor)
|
||||||
calendar_fab.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor)
|
calendar_fab.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor)
|
||||||
search_holder.background = ColorDrawable(config.backgroundColor)
|
search_holder.background = ColorDrawable(config.backgroundColor)
|
||||||
swipe_refresh_layout.isEnabled = config.caldavSync
|
swipe_refresh_layout.isEnabled = config.caldavSync && config.pullToRefresh
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -38,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setContentView(R.layout.activity_settings)
|
setContentView(R.layout.activity_settings)
|
||||||
res = resources
|
res = resources
|
||||||
mStoredPrimaryColor = config.primaryColor
|
mStoredPrimaryColor = config.primaryColor
|
||||||
setupCaldavSync()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -63,6 +62,9 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupUseSameSnooze()
|
setupUseSameSnooze()
|
||||||
setupLoopReminders()
|
setupLoopReminders()
|
||||||
setupSnoozeTime()
|
setupSnoozeTime()
|
||||||
|
setupCaldavSync()
|
||||||
|
setupManageSyncedCalendars()
|
||||||
|
setupPullToRefresh()
|
||||||
setupDefaultReminder()
|
setupDefaultReminder()
|
||||||
setupDefaultReminder1()
|
setupDefaultReminder1()
|
||||||
setupDefaultReminder2()
|
setupDefaultReminder2()
|
||||||
@ -163,7 +165,18 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupPullToRefresh() {
|
||||||
|
settings_caldav_pull_to_refresh_holder.beVisibleIf(config.caldavSync)
|
||||||
|
settings_caldav_pull_to_refresh.isChecked = config.pullToRefresh
|
||||||
|
settings_caldav_pull_to_refresh_holder.setOnClickListener {
|
||||||
|
settings_caldav_pull_to_refresh.toggle()
|
||||||
|
config.pullToRefresh = settings_caldav_pull_to_refresh.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupManageSyncedCalendars() {
|
||||||
settings_manage_synced_calendars_holder.beVisibleIf(config.caldavSync)
|
settings_manage_synced_calendars_holder.beVisibleIf(config.caldavSync)
|
||||||
settings_manage_synced_calendars_holder.setOnClickListener {
|
settings_manage_synced_calendars_holder.setOnClickListener {
|
||||||
showCalendarPicker()
|
showCalendarPicker()
|
||||||
@ -177,6 +190,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
settings_caldav_sync.isChecked = false
|
settings_caldav_sync.isChecked = false
|
||||||
config.caldavSync = false
|
config.caldavSync = false
|
||||||
settings_manage_synced_calendars_holder.beGone()
|
settings_manage_synced_calendars_holder.beGone()
|
||||||
|
settings_caldav_pull_to_refresh_holder.beGone()
|
||||||
config.getSyncedCalendarIdsAsList().forEach {
|
config.getSyncedCalendarIdsAsList().forEach {
|
||||||
CalDAVHandler(applicationContext).deleteCalDAVCalendarEvents(it.toLong())
|
CalDAVHandler(applicationContext).deleteCalDAVCalendarEvents(it.toLong())
|
||||||
}
|
}
|
||||||
@ -194,6 +208,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
settings_manage_synced_calendars_holder.beVisibleIf(newCalendarIds.isNotEmpty())
|
settings_manage_synced_calendars_holder.beVisibleIf(newCalendarIds.isNotEmpty())
|
||||||
|
settings_caldav_pull_to_refresh_holder.beVisibleIf(newCalendarIds.isNotEmpty())
|
||||||
settings_caldav_sync.isChecked = newCalendarIds.isNotEmpty()
|
settings_caldav_sync.isChecked = newCalendarIds.isNotEmpty()
|
||||||
config.caldavSync = newCalendarIds.isNotEmpty()
|
config.caldavSync = newCalendarIds.isNotEmpty()
|
||||||
if (settings_caldav_sync.isChecked) {
|
if (settings_caldav_sync.isChecked) {
|
||||||
|
@ -162,4 +162,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
var defaultReminder3: Int
|
var defaultReminder3: Int
|
||||||
get() = prefs.getInt(DEFAULT_REMINDER_3, REMINDER_OFF)
|
get() = prefs.getInt(DEFAULT_REMINDER_3, REMINDER_OFF)
|
||||||
set(defaultReminder3) = prefs.edit().putInt(DEFAULT_REMINDER_3, defaultReminder3).apply()
|
set(defaultReminder3) = prefs.edit().putInt(DEFAULT_REMINDER_3, defaultReminder3).apply()
|
||||||
|
|
||||||
|
var pullToRefresh: Boolean
|
||||||
|
get() = prefs.getBoolean(PULL_TO_REFRESH, false)
|
||||||
|
set(pullToRefresh) = prefs.edit().putBoolean(PULL_TO_REFRESH, pullToRefresh).apply()
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ const val USE_PREVIOUS_EVENT_REMINDERS = "use_previous_event_reminders"
|
|||||||
const val DEFAULT_REMINDER_1 = "default_reminder_1"
|
const val DEFAULT_REMINDER_1 = "default_reminder_1"
|
||||||
const val DEFAULT_REMINDER_2 = "default_reminder_2"
|
const val DEFAULT_REMINDER_2 = "default_reminder_2"
|
||||||
const val DEFAULT_REMINDER_3 = "default_reminder_3"
|
const val DEFAULT_REMINDER_3 = "default_reminder_3"
|
||||||
|
const val PULL_TO_REFRESH = "pull_to_refresh"
|
||||||
|
|
||||||
// repeat_rule for monthly and yearly repetition
|
// repeat_rule for monthly and yearly repetition
|
||||||
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)
|
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)
|
||||||
|
@ -529,6 +529,29 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_caldav_pull_to_refresh_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_caldav_pull_to_refresh"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
|
android:text="@string/enable_pull_to_refresh"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_manage_synced_calendars_holder"
|
android:id="@+id/settings_manage_synced_calendars_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user