Move clear history from advanced settings to history screen menu (closes #4613)

This commit is contained in:
arkon
2021-03-13 16:09:12 -05:00
parent fddd8ce305
commit b6b78994d8
4 changed files with 49 additions and 32 deletions
@@ -110,16 +110,6 @@ class SettingsAdvancedController : SettingsController() {
ctrl.showDialog(router)
}
}
preference {
titleRes = R.string.pref_clear_history
summaryRes = R.string.pref_clear_history_summary
onClick {
val ctrl = ClearHistoryDialogController()
ctrl.targetController = this@SettingsAdvancedController
ctrl.showDialog(router)
}
}
}
preferenceCategory {
@@ -197,22 +187,6 @@ class SettingsAdvancedController : SettingsController() {
}
}
class ClearHistoryDialogController : DialogController() {
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog(activity!!)
.message(R.string.clear_history_confirmation)
.positiveButton(android.R.string.ok) {
(targetController as? SettingsAdvancedController)?.clearHistory()
}
.negativeButton(android.R.string.cancel)
}
}
private fun clearHistory() {
db.deleteHistory().executeAsBlocking()
activity?.toast(R.string.clear_history_completed)
}
private fun clearDatabase() {
db.deleteMangasNotInLibrary().executeAsBlocking()
db.deleteHistoryNoLastRead().executeAsBlocking()