diff --git a/app/src/main/java/io/legado/app/api/controller/BookController.kt b/app/src/main/java/io/legado/app/api/controller/BookController.kt index 7634c65c9..62abec1be 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookController.kt @@ -10,11 +10,11 @@ import io.legado.app.data.entities.Book import io.legado.app.help.BookHelp import io.legado.app.help.ContentProcessor import io.legado.app.help.ImageLoader +import io.legado.app.model.ReadBook import io.legado.app.model.localBook.EpubFile import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.UmdFile import io.legado.app.model.webBook.WebBook -import io.legado.app.service.help.ReadBook import io.legado.app.ui.widget.image.CoverImageView import io.legado.app.utils.* import kotlinx.coroutines.runBlocking diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index 4a603f3db..318fb8a88 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -6,7 +6,7 @@ import io.legado.app.constant.AppPattern import io.legado.app.constant.BookType import io.legado.app.data.appDb import io.legado.app.help.AppConfig -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.utils.GSON import io.legado.app.utils.MD5Utils import io.legado.app.utils.fromJsonObject diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/model/ReadBook.kt similarity index 98% rename from app/src/main/java/io/legado/app/service/help/ReadBook.kt rename to app/src/main/java/io/legado/app/model/ReadBook.kt index 782292072..7f11c855d 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/model/ReadBook.kt @@ -1,4 +1,4 @@ -package io.legado.app.service.help +package io.legado.app.model import androidx.lifecycle.MutableLiveData import com.github.liuyueyi.quick.transfer.ChineseUtils @@ -10,6 +10,8 @@ import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.storage.BookWebDav import io.legado.app.model.webBook.WebBook import io.legado.app.service.BaseReadAloudService +import io.legado.app.service.help.CacheBook +import io.legado.app.service.help.ReadAloud import io.legado.app.ui.book.read.page.entities.TextChapter import io.legado.app.ui.book.read.page.entities.TextPage import io.legado.app.ui.book.read.page.provider.ChapterProvider @@ -44,7 +46,7 @@ object ReadBook { var readStartTime: Long = System.currentTimeMillis() fun resetData(book: Book) { - this.book = book + ReadBook.book = book readRecord.bookName = book.name readRecord.readTime = appDb.readRecordDao.getReadTime(book.name) ?: 0 durChapterIndex = book.durChapterIndex @@ -113,8 +115,8 @@ object ReadBook { } fun upMsg(msg: String?) { - if (this.msg != msg) { - this.msg = msg + if (ReadBook.msg != msg) { + ReadBook.msg = msg callBack?.upContent() } } diff --git a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt index a65095ad1..9e00499d2 100644 --- a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt @@ -8,11 +8,11 @@ import io.legado.app.constant.EventBus import io.legado.app.data.appDb import io.legado.app.help.AppConfig import io.legado.app.help.LifecycleHelp +import io.legado.app.model.ReadBook 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.service.help.ReadBook import io.legado.app.ui.book.audio.AudioPlayActivity import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.main.MainActivity diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index da1dcaaab..858385b06 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -21,8 +21,8 @@ import io.legado.app.constant.* import io.legado.app.help.IntentDataHelp import io.legado.app.help.IntentHelp import io.legado.app.help.MediaHelp +import io.legado.app.model.ReadBook import io.legado.app.receiver.MediaButtonReceiver -import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.page.entities.TextChapter import io.legado.app.utils.getPrefBoolean diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index 0c901b275..0e75eb04e 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -6,9 +6,9 @@ import io.legado.app.constant.EventBus import io.legado.app.help.AppConfig import io.legado.app.help.IntentHelp import io.legado.app.help.coroutine.Coroutine +import io.legado.app.model.ReadBook import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.service.help.ReadAloud -import io.legado.app.service.help.ReadBook import io.legado.app.utils.* import kotlinx.coroutines.ensureActive import kotlinx.coroutines.isActive diff --git a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt index 20f1a1573..ad6805432 100644 --- a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt @@ -9,7 +9,7 @@ import io.legado.app.constant.EventBus import io.legado.app.help.AppConfig import io.legado.app.help.IntentHelp import io.legado.app.help.MediaHelp -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.postEvent import io.legado.app.utils.toastOnUi diff --git a/app/src/main/java/io/legado/app/service/help/CacheBook.kt b/app/src/main/java/io/legado/app/service/help/CacheBook.kt index 520497c7e..8877852ef 100644 --- a/app/src/main/java/io/legado/app/service/help/CacheBook.kt +++ b/app/src/main/java/io/legado/app/service/help/CacheBook.kt @@ -5,6 +5,7 @@ import io.legado.app.R import io.legado.app.constant.IntentAction import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.model.ReadBook import io.legado.app.model.webBook.WebBook import io.legado.app.service.CacheBookService import io.legado.app.utils.msg diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index 1a4e7e481..4aae39c44 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -11,9 +11,9 @@ 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.help.BookHelp +import io.legado.app.model.ReadBook import io.legado.app.model.localBook.LocalBook import io.legado.app.model.webBook.WebBook -import io.legado.app.service.help.ReadBook import io.legado.app.utils.postEvent import io.legado.app.utils.toastOnUi import kotlinx.coroutines.Dispatchers.IO diff --git a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditViewModel.kt index 1265d9b4d..da9917acc 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.Book -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook class BookInfoEditViewModel(application: Application) : BaseViewModel(application) { var book: Book? = null diff --git a/app/src/main/java/io/legado/app/ui/book/login/SourceLoginDialog.kt b/app/src/main/java/io/legado/app/ui/book/login/SourceLoginDialog.kt index 69b92403c..c75060bff 100644 --- a/app/src/main/java/io/legado/app/ui/book/login/SourceLoginDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/login/SourceLoginDialog.kt @@ -9,9 +9,11 @@ import io.legado.app.R import io.legado.app.base.BaseDialogFragment import io.legado.app.data.entities.rule.LoginRule import io.legado.app.databinding.DialogLoginBinding +import io.legado.app.help.CacheManager import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.widget.text.EditText import io.legado.app.ui.widget.text.TextInputLayout +import io.legado.app.utils.GSON import io.legado.app.utils.applyTint import io.legado.app.utils.viewbindingdelegate.viewBinding @@ -30,6 +32,7 @@ class SourceLoginDialog : BaseDialogFragment() { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { binding.toolBar.setBackgroundColor(primaryColor) + val sourceUrl = arguments?.getString("sourceUrl") val loginRule = arguments?.getParcelable("loginRule") loginRule?.ui?.forEachIndexed { index, rowUi -> when (rowUi.type) { @@ -60,7 +63,7 @@ class SourceLoginDialog : BaseDialogFragment() { } } } - + CacheManager.put("login_$sourceUrl", GSON.toJson(loginData)) } } return@setOnMenuItemClickListener true diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 9739f8909..482db20d0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -29,10 +29,10 @@ import io.legado.app.help.storage.Backup import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.accentColor +import io.legado.app.model.ReadBook import io.legado.app.receiver.TimeBatteryReceiver import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud -import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.changesource.ChangeSourceDialog import io.legado.app.ui.book.info.BookInfoActivity import io.legado.app.ui.book.login.SourceLoginActivity diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index e057b6419..b01dc797e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -23,8 +23,8 @@ import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.backgroundColor +import io.legado.app.model.ReadBook import io.legado.app.service.help.CacheBook -import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.config.BgTextConfigDialog import io.legado.app.ui.book.read.config.ClickActionConfigDialog import io.legado.app.ui.book.read.config.PaddingConfigDialog diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 9395b8f1c..0e1c637e7 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -14,12 +14,12 @@ import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.help.ContentProcessor import io.legado.app.help.storage.BookWebDav +import io.legado.app.model.ReadBook import io.legado.app.model.localBook.LocalBook import io.legado.app.model.webBook.PreciseSearch import io.legado.app.model.webBook.WebBook import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud -import io.legado.app.service.help.ReadBook import io.legado.app.utils.msg import io.legado.app.utils.postEvent import io.legado.app.utils.toastOnUi diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 21c5804e2..179109c6c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -18,7 +18,7 @@ import io.legado.app.help.AppConfig import io.legado.app.help.LocalConfig import io.legado.app.help.ThemeConfig import io.legado.app.lib.theme.* -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.widget.seekbar.SeekBarChangeListener import io.legado.app.utils.* import splitties.views.onLongClick diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index d1fd5b0bb..aaded8fa1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -11,9 +11,9 @@ import io.legado.app.databinding.DialogReadAloudBinding import io.legado.app.help.AppConfig import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor +import io.legado.app.model.ReadBook import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud -import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.widget.seekbar.SeekBarChangeListener import io.legado.app.utils.ColorUtils diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 7f984491c..7737fdfc7 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -16,7 +16,7 @@ import io.legado.app.lib.dialogs.selector import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.widget.font.FontSelectDialog import io.legado.app.utils.ColorUtils diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index 67f16724a..350252e38 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -11,7 +11,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Bookmark import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.accentColor -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.entities.TextChar import io.legado.app.ui.book.read.page.entities.TextLine import io.legado.app.ui.book.read.page.entities.TextPage diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 85c37d61d..ea34c2a74 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -15,7 +15,7 @@ import io.legado.app.data.entities.Bookmark import io.legado.app.databinding.ViewBookPageBinding import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadTipConfig -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.entities.TextPage import io.legado.app.ui.book.read.page.provider.ChapterProvider import io.legado.app.ui.widget.BatteryView diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt index 966407094..828e43343 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt @@ -15,7 +15,7 @@ import android.widget.FrameLayout import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.accentColor -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.api.DataSource import io.legado.app.ui.book.read.page.delegate.* import io.legado.app.ui.book.read.page.entities.PageDirection diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/api/DataSource.kt b/app/src/main/java/io/legado/app/ui/book/read/page/api/DataSource.kt index bb7df2d66..236f737c1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/api/DataSource.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/api/DataSource.kt @@ -1,6 +1,6 @@ package io.legado.app.ui.book.read.page.api -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.entities.TextChapter interface DataSource { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index 6108710f7..ff1808269 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -4,7 +4,7 @@ import android.text.Layout import android.text.StaticLayout import io.legado.app.R import io.legado.app.help.ReadBookConfig -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.provider.ChapterProvider import splitties.init.appCtx import java.text.DecimalFormat diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextPageFactory.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextPageFactory.kt index f824f05bb..10d4b9ab4 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextPageFactory.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextPageFactory.kt @@ -1,6 +1,6 @@ package io.legado.app.ui.book.read.page.provider -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.api.DataSource import io.legado.app.ui.book.read.page.api.PageFactory import io.legado.app.ui.book.read.page.entities.TextPage diff --git a/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt b/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt index 7855856f4..5edde2004 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt @@ -8,7 +8,7 @@ import androidx.fragment.app.FragmentManager import io.legado.app.R import io.legado.app.base.BaseDialogFragment import io.legado.app.databinding.DialogPhotoViewBinding -import io.legado.app.service.help.ReadBook +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.page.provider.ImageProvider import io.legado.app.utils.viewbindingdelegate.viewBinding