Add update library menu item

This commit is contained in:
arkon
2020-03-29 16:43:00 -04:00
parent 441e2a69d8
commit 859e9ca653
6 changed files with 56 additions and 8 deletions
@@ -96,10 +96,10 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
// Double the distance required to trigger sync
swipe_refresh.setDistanceToTriggerSync((2 * 64 * resources.displayMetrics.density).toInt())
swipe_refresh.setOnRefreshListener {
if (!LibraryUpdateService.isRunning(context)) {
LibraryUpdateService.start(context, category)
if (LibraryUpdateService.start(context, category)) {
context.toast(R.string.updating_category)
}
// It can be a very long operation, so we disable swipe refresh and show a toast.
swipe_refresh.isRefreshing = false
}
@@ -362,7 +362,11 @@ class LibraryController(
R.id.action_search -> expandActionViewFromInteraction = true
R.id.action_filter -> showSettingsSheet()
R.id.action_update_library -> {
activity?.let { LibraryUpdateService.start(it) }
activity?.let {
if (LibraryUpdateService.start(it)) {
it.toast(R.string.updating_library)
}
}
}
}