mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
优化
This commit is contained in:
parent
6534947b7e
commit
93a08627ec
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user