pull/1072/head
gedoor 3 years ago
parent d194c366f6
commit 673dd4b692
  1. 2
      app/src/main/AndroidManifest.xml
  2. 1
      app/src/main/java/io/legado/app/constant/EventBus.kt
  3. 2
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt
  4. 3
      app/src/main/java/io/legado/app/service/AudioPlayService.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/audio/AudioPlayActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/audio/AudioPlayViewModel.kt
  7. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  8. 7
      app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt
  9. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt
  10. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt
  11. 2
      app/src/main/res/layout/activity_audio_play.xml

@ -169,7 +169,7 @@
android:launchMode="singleTask" />
<!-- 音频播放界面 -->
<activity
android:name=".ui.audio.AudioPlayActivity"
android:name="io.legado.app.ui.book.audio.AudioPlayActivity"
android:launchMode="singleTask" />
<!-- 授权界面 -->
<activity

@ -4,6 +4,7 @@ object EventBus {
const val MEDIA_BUTTON = "mediaButton"
const val RECREATE = "RECREATE"
const val UP_BOOK = "upBookToc"
const val BOOKSHELF_REFRESH = "bookshelfRefresh"
const val ALOUD_STATE = "aloud_state"
const val TTS_PROGRESS = "ttsStart"
const val TTS_DS = "ttsDs"

@ -12,7 +12,7 @@ import io.legado.app.service.AudioPlayService
import io.legado.app.service.BaseReadAloudService
import io.legado.app.service.help.AudioPlay
import io.legado.app.service.help.ReadAloud
import io.legado.app.ui.audio.AudioPlayActivity
import io.legado.app.ui.book.audio.AudioPlayActivity
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.main.MainActivity
import io.legado.app.utils.postEvent

@ -6,7 +6,6 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.BitmapFactory
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.media.MediaPlayer
import android.net.Uri
@ -30,7 +29,7 @@ import io.legado.app.help.MediaHelp
import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.receiver.MediaButtonReceiver
import io.legado.app.service.help.AudioPlay
import io.legado.app.ui.audio.AudioPlayActivity
import io.legado.app.ui.book.audio.AudioPlayActivity
import io.legado.app.utils.postEvent
import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.Dispatchers.Main

@ -1,4 +1,4 @@
package io.legado.app.ui.audio
package io.legado.app.ui.book.audio
import android.app.Activity
import android.graphics.drawable.Drawable

@ -1,4 +1,4 @@
package io.legado.app.ui.audio
package io.legado.app.ui.book.audio
import android.app.Application
import android.content.Intent

@ -27,7 +27,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.ui.audio.AudioPlayActivity
import io.legado.app.ui.book.audio.AudioPlayActivity
import io.legado.app.ui.book.changecover.ChangeCoverDialog
import io.legado.app.ui.book.changesource.ChangeSourceDialog
import io.legado.app.ui.book.group.GroupSelectDialog

@ -85,17 +85,22 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
DialogBookshelfConfigBinding.inflate(layoutInflater)
.apply {
spGroupStyle.setSelection(AppConfig.bookGroupStyle)
swShowUnread.isChecked = AppConfig.showUnread
rgLayout.checkByIndex(bookshelfLayout)
rgSort.checkByIndex(bookshelfSort)
}
customView { alertBinding.root }
okButton {
alertBinding.apply {
var changed = false
if (AppConfig.bookGroupStyle != spGroupStyle.selectedItemPosition) {
AppConfig.bookGroupStyle = spGroupStyle.selectedItemPosition
postEvent(EventBus.NOTIFY_MAIN, false)
}
if (AppConfig.showUnread != swShowUnread.isChecked) {
AppConfig.showUnread = swShowUnread.isChecked
postEvent(EventBus.BOOKSHELF_REFRESH, "")
}
var changed = false
if (bookshelfLayout != rgLayout.getCheckedIndex()) {
putPrefInt(PreferKey.bookshelfLayout, rgLayout.getCheckedIndex())
changed = true

@ -20,7 +20,7 @@ import io.legado.app.databinding.FragmentBooksBinding
import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.audio.AudioPlayActivity
import io.legado.app.ui.book.audio.AudioPlayActivity
import io.legado.app.ui.book.info.BookInfoActivity
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.main.MainViewModel
@ -168,5 +168,8 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
observeEvent<String>(EventBus.UP_BOOK) {
booksAdapter.notification(it)
}
observeEvent<String>(EventBus.BOOKSHELF_REFRESH) {
booksAdapter.notifyDataSetChanged()
}
}
}

@ -22,7 +22,7 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.audio.AudioPlayActivity
import io.legado.app.ui.book.audio.AudioPlayActivity
import io.legado.app.ui.book.info.BookInfoActivity
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.book.search.SearchActivity
@ -231,5 +231,8 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
observeEvent<String>(EventBus.UP_BOOK) {
booksAdapter.notification(it)
}
observeEvent<String>(EventBus.BOOKSHELF_REFRESH) {
booksAdapter.notifyDataSetChanged()
}
}
}

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context=".ui.audio.AudioPlayActivity">
tools:context=".ui.book.audio.AudioPlayActivity">
<ImageView
android:id="@+id/iv_bg"

Loading…
Cancel
Save