Material Dialogs Eh Part 3
This commit is contained in:
parent
cb4fbb19ed
commit
7a010e3446
@ -642,16 +642,16 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDialog() = activity?.let {
|
private fun buildDialog() = activity?.let {
|
||||||
MaterialDialog.Builder(it)
|
MaterialDialog(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSyncProgressDialog() {
|
private fun showSyncProgressDialog() {
|
||||||
favSyncDialog?.dismiss()
|
favSyncDialog?.dismiss()
|
||||||
favSyncDialog = buildDialog()
|
favSyncDialog = buildDialog()
|
||||||
?.title("Favorites syncing")
|
?.title(text = "Favorites syncing")
|
||||||
?.cancelable(false)
|
?.cancelable(false)
|
||||||
?.progress(true, 0)
|
// ?.progress(true, 0)
|
||||||
?.show()
|
favSyncDialog?.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun takeSyncLocks() {
|
private fun takeSyncLocks() {
|
||||||
@ -675,47 +675,43 @@ class LibraryController(
|
|||||||
|
|
||||||
favSyncDialog?.dismiss()
|
favSyncDialog?.dismiss()
|
||||||
favSyncDialog = buildDialog()
|
favSyncDialog = buildDialog()
|
||||||
?.title("Favorites sync error")
|
?.title(text = "Favorites sync error")
|
||||||
?.content(status.message + " Sync will not start until the gallery is in only one category.")
|
?.message(text = status.message + " Sync will not start until the gallery is in only one category.")
|
||||||
?.cancelable(false)
|
?.cancelable(false)
|
||||||
?.positiveText("Show gallery")
|
?.positiveButton(text = "Show gallery") {
|
||||||
?.onPositive { _, _ ->
|
|
||||||
openManga(status.manga)
|
openManga(status.manga)
|
||||||
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
||||||
}
|
}
|
||||||
?.negativeText("Ok")
|
?.negativeButton(android.R.string.ok) {
|
||||||
?.onNegative { _, _ ->
|
|
||||||
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
||||||
}
|
}
|
||||||
?.show()
|
favSyncDialog?.show()
|
||||||
}
|
}
|
||||||
is FavoritesSyncStatus.Error -> {
|
is FavoritesSyncStatus.Error -> {
|
||||||
releaseSyncLocks()
|
releaseSyncLocks()
|
||||||
|
|
||||||
favSyncDialog?.dismiss()
|
favSyncDialog?.dismiss()
|
||||||
favSyncDialog = buildDialog()
|
favSyncDialog = buildDialog()
|
||||||
?.title("Favorites sync error")
|
?.title(text = "Favorites sync error")
|
||||||
?.content("An error occurred during the sync process: ${status.message}")
|
?.message(text = "An error occurred during the sync process: ${status.message}")
|
||||||
?.cancelable(false)
|
?.cancelable(false)
|
||||||
?.positiveText("Ok")
|
?.positiveButton(android.R.string.ok) {
|
||||||
?.onPositive { _, _ ->
|
|
||||||
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
||||||
}
|
}
|
||||||
?.show()
|
favSyncDialog?.show()
|
||||||
}
|
}
|
||||||
is FavoritesSyncStatus.CompleteWithErrors -> {
|
is FavoritesSyncStatus.CompleteWithErrors -> {
|
||||||
releaseSyncLocks()
|
releaseSyncLocks()
|
||||||
|
|
||||||
favSyncDialog?.dismiss()
|
favSyncDialog?.dismiss()
|
||||||
favSyncDialog = buildDialog()
|
favSyncDialog = buildDialog()
|
||||||
?.title("Favorites sync complete with errors")
|
?.title(text = "Favorites sync complete with errors")
|
||||||
?.content("Errors occurred during the sync process that were ignored:\n${status.message}")
|
?.message(text = "Errors occurred during the sync process that were ignored:\n${status.message}")
|
||||||
?.cancelable(false)
|
?.cancelable(false)
|
||||||
?.positiveText("Ok")
|
?.positiveButton(android.R.string.ok) {
|
||||||
?.onPositive { _, _ ->
|
|
||||||
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
presenter.favoritesSync.status.onNext(FavoritesSyncStatus.Idle())
|
||||||
}
|
}
|
||||||
?.show()
|
favSyncDialog?.show()
|
||||||
}
|
}
|
||||||
is FavoritesSyncStatus.Processing,
|
is FavoritesSyncStatus.Processing,
|
||||||
is FavoritesSyncStatus.Initializing -> {
|
is FavoritesSyncStatus.Initializing -> {
|
||||||
@ -726,7 +722,7 @@ class LibraryController(
|
|||||||
&& oldSyncStatus !is FavoritesSyncStatus.Processing))
|
&& oldSyncStatus !is FavoritesSyncStatus.Processing))
|
||||||
showSyncProgressDialog()
|
showSyncProgressDialog()
|
||||||
|
|
||||||
favSyncDialog?.setContent(status.message)
|
favSyncDialog?.message(text = status.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oldSyncStatus = status
|
oldSyncStatus = status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user