Merge pull request #670 from azisuazusa/664_pull_to_refresh

#664 pull to refresh feature
This commit is contained in:
Tibor Kaputa 2018-10-23 18:41:06 +02:00 committed by GitHub
commit b3db967632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -92,6 +92,10 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
refreshCalDAVCalendars(false)
}
swipe_refresh_layout.setOnRefreshListener {
refreshCalDAVCalendars(false)
}
if (!checkViewIntents()) {
return
}
@ -129,6 +133,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
search_placeholder_2.setTextColor(config.textColor)
calendar_fab.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor)
search_holder.background = ColorDrawable(config.backgroundColor)
swipe_refresh_layout.isEnabled = config.caldavSync
}
override fun onPause() {
@ -368,6 +373,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
if (showCalDAVRefreshToast) {
toast(R.string.refreshing_complete)
}
swipe_refresh_layout.isRefreshing = false
}
}, CALDAV_SYNC_DELAY)
}

View File

@ -6,10 +6,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragments_holder"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragments_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.simplemobiletools.commons.views.MyFloatingActionButton
android:id="@+id/calendar_fab"