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
2 changed files with 16 additions and 3 deletions

View File

@@ -92,6 +92,10 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
refreshCalDAVCalendars(false) refreshCalDAVCalendars(false)
} }
swipe_refresh_layout.setOnRefreshListener {
refreshCalDAVCalendars(false)
}
if (!checkViewIntents()) { if (!checkViewIntents()) {
return return
} }
@@ -129,6 +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
} }
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)
} }

View File

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