优化
This commit is contained in:
@@ -227,24 +227,26 @@ class AudioPlayActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun finish() {
|
override fun finish() {
|
||||||
AudioPlay.book?.let {
|
val book = AudioPlay.book ?: return super.finish()
|
||||||
if (!AudioPlay.inBookshelf) {
|
|
||||||
if (!AppConfig.showAddToShelfAlert) {
|
if (AudioPlay.inBookshelf) {
|
||||||
viewModel.removeFromBookshelf { super.finish() }
|
return super.finish()
|
||||||
} else {
|
}
|
||||||
alert(title = getString(R.string.add_to_bookshelf)) {
|
|
||||||
setMessage(getString(R.string.check_add_bookshelf, it.name))
|
if (!AppConfig.showAddToShelfAlert) {
|
||||||
okButton {
|
viewModel.removeFromBookshelf { super.finish() }
|
||||||
AudioPlay.inBookshelf = true
|
} else {
|
||||||
setResult(Activity.RESULT_OK)
|
alert(title = getString(R.string.add_to_bookshelf)) {
|
||||||
}
|
setMessage(getString(R.string.check_add_bookshelf, book.name))
|
||||||
noButton { viewModel.removeFromBookshelf { super.finish() } }
|
okButton {
|
||||||
}
|
AudioPlay.book?.removeType(BookType.notShelf)
|
||||||
|
AudioPlay.book?.save()
|
||||||
|
AudioPlay.inBookshelf = true
|
||||||
|
setResult(Activity.RESULT_OK)
|
||||||
}
|
}
|
||||||
} else {
|
noButton { viewModel.removeFromBookshelf { super.finish() } }
|
||||||
super.finish()
|
|
||||||
}
|
}
|
||||||
} ?: super.finish()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user