#664 disable pull to refresh when user not synced

This commit is contained in:
AzisuAzusa 2018-10-23 19:01:52 +07:00
parent 7037649784
commit 44da1202cc
1 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
if (config.caldavSync) { if (config.caldavSync) {
refreshCalDAVCalendars(false) refreshCalDAVCalendars(false)
swipe_refresh_layout.setOnRefreshListener { refreshCalDAVCalendars(false) }
} }
if (!checkViewIntents()) { if (!checkViewIntents()) {
@ -129,6 +130,10 @@ 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.run {
isEnabled = config.caldavSync
}
} }
override fun onPause() { override fun onPause() {
@ -368,6 +373,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
if (showCalDAVRefreshToast) { if (showCalDAVRefreshToast) {
toast(R.string.refreshing_complete) toast(R.string.refreshing_complete)
} }
swipe_refresh_layout.isRefreshing = false
} }
}, CALDAV_SYNC_DELAY) }, CALDAV_SYNC_DELAY)
} }