Ability to delete reading history (#3871)
* Added ability to delete history for all manga * Fix review comments (cherry picked from commit 812368e332b56a3b8964e7c1247c9fbc18804516)
This commit is contained in:
parent
2772e4960e
commit
f6d3c38d03
@ -114,6 +114,16 @@ 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 {
|
||||
@ -402,6 +412,22 @@ 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()
|
||||
|
||||
@ -403,6 +403,10 @@
|
||||
<string name="pref_disable_battery_optimization_summary">Helps with background library updates and backups</string>
|
||||
<string name="battery_optimization_disabled">Battery optimization is already disabled</string>
|
||||
<string name="battery_optimization_setting_activity_not_found">Couldn\'t open device settings</string>
|
||||
<string name="clear_history_completed">History deleted</string>
|
||||
<string name="clear_history_confirmation">Are you sure? All history will be lost.</string>
|
||||
<string name="pref_clear_history">Clear history</string>
|
||||
<string name="pref_clear_history_summary">Delete reading history for all manga</string>
|
||||
|
||||
<!-- About section -->
|
||||
<string name="website">Website</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user