This commit is contained in:
Horis 2024-09-04 21:27:55 +08:00
parent 6534947b7e
commit 93a08627ec

View File

@ -227,24 +227,26 @@ class AudioPlayActivity :
}
override fun finish() {
AudioPlay.book?.let {
if (!AudioPlay.inBookshelf) {
if (!AppConfig.showAddToShelfAlert) {
viewModel.removeFromBookshelf { super.finish() }
} else {
alert(title = getString(R.string.add_to_bookshelf)) {
setMessage(getString(R.string.check_add_bookshelf, it.name))
okButton {
AudioPlay.inBookshelf = true
setResult(Activity.RESULT_OK)
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}
val book = AudioPlay.book ?: return super.finish()
if (AudioPlay.inBookshelf) {
return super.finish()
}
if (!AppConfig.showAddToShelfAlert) {
viewModel.removeFromBookshelf { super.finish() }
} else {
alert(title = getString(R.string.add_to_bookshelf)) {
setMessage(getString(R.string.check_add_bookshelf, book.name))
okButton {
AudioPlay.book?.removeType(BookType.notShelf)
AudioPlay.book?.save()
AudioPlay.inBookshelf = true
setResult(Activity.RESULT_OK)
}
} else {
super.finish()
noButton { viewModel.removeFromBookshelf { super.finish() } }
}
} ?: super.finish()
}
}
override fun onDestroy() {