Merge pull request #2276 from 821938089/little-fix

修复音频书返回时提示加书架
pull/2277/head
kunfei 2 years ago committed by GitHub
commit e2d2c392fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      app/src/main/java/io/legado/app/ui/book/audio/AudioPlayActivity.kt

@ -21,6 +21,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookSource
import io.legado.app.databinding.ActivityAudioPlayBinding
import io.legado.app.help.config.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.model.AudioPlay
import io.legado.app.model.BookCover
@ -226,13 +227,17 @@ class AudioPlayActivity :
override fun finish() {
AudioPlay.book?.let {
if (!AudioPlay.inBookshelf) {
alert(title = getString(R.string.add_to_shelf)) {
setMessage(getString(R.string.check_add_bookshelf, it.name))
okButton {
AudioPlay.inBookshelf = true
setResult(Activity.RESULT_OK)
if (!AppConfig.showAddToShelfAlert) {
viewModel.removeFromBookshelf { super.finish() }
} else {
alert(title = getString(R.string.add_to_shelf)) {
setMessage(getString(R.string.check_add_bookshelf, it.name))
okButton {
AudioPlay.inBookshelf = true
setResult(Activity.RESULT_OK)
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}
} else {
super.finish()

Loading…
Cancel
Save