diff --git a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt index 85965050c..9f13a4f39 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookSourceDao.kt @@ -35,6 +35,12 @@ interface BookSourceDao { @Query("update book_sources set enabled = 0 where bookSourceUrl = :sourceUrl") fun disableSection(sourceUrl: String) + @Query("update book_sources set enabledExplore = 1 where bookSourceUrl = :sourceUrl") + fun enableSectionExplore(sourceUrl: String) + + @Query("update book_sources set enabledExplore = 0 where bookSourceUrl = :sourceUrl") + fun disableSectionExplore(sourceUrl: String) + @Query("delete from book_sources where bookSourceUrl = :sourceUrl") fun delSection(sourceUrl: String) diff --git a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt index f47bcd8da..29696be30 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt @@ -69,7 +69,7 @@ object BookChapterList { } } } - SourceDebug.printLog(bookSource.bookSourceUrl, "≡目录总页数:${nextUrlList.size}") + SourceDebug.printLog(bookSource.bookSourceUrl, "◇目录总页数:${nextUrlList.size}") } else if (chapterData.nextUrl.size > 1) { val chapterDataList = arrayListOf>() for (item in chapterData.nextUrl) { @@ -145,7 +145,7 @@ object BookChapterList { } SourceDebug.printLog( bookSource.bookSourceUrl, - "└" + TextUtils.join(",\n", nextUrlList), + "└" + TextUtils.join(",\n", nextUrlList), printLog ) } diff --git a/app/src/main/java/io/legado/app/model/webbook/BookContent.kt b/app/src/main/java/io/legado/app/model/webbook/BookContent.kt index 49ce90783..33f06fc93 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookContent.kt @@ -62,7 +62,7 @@ object BookContent { content.append(contentData.content) } } - SourceDebug.printLog(bookSource.bookSourceUrl, "≡本章总页数:${nextUrlList.size}") + SourceDebug.printLog(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}") } else if (contentData.nextUrl.size > 1) { val contentDataList = arrayListOf>() for (item in contentData.nextUrl) { @@ -95,11 +95,12 @@ object BookContent { } } if (content.isNotEmpty()) { + SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取章节名称") + SourceDebug.printLog(bookSource.bookSourceUrl, "└${bookChapter.title}") + SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取正文内容") if (!content[0].toString().startsWith(bookChapter.title)) { content - .insert(0, "\n") - .insert(0, "\n》正文内容:") - .insert(0, "》章节名称:${bookChapter.title}") + .insert(0, "└\n") } } return content.toString() @@ -123,7 +124,7 @@ object BookContent { analyzeRule.getStringList(nextUrlRule, true)?.let { nextUrlList.addAll(it) } - SourceDebug.printLog(bookSource.bookSourceUrl, "└" + nextUrlList.joinToString(","), printLog) + SourceDebug.printLog(bookSource.bookSourceUrl, "└" + nextUrlList.joinToString(","), printLog) } val content = analyzeRule.getString(contentRule.content ?: "")?.htmlFormat() ?: "" return ContentData(content, nextUrlList) diff --git a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt index 26f749f01..1fd916380 100644 --- a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt +++ b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt @@ -65,15 +65,16 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { val book = Book() book.origin = webBook.sourceUrl book.bookUrl = key - printLog(webBook.sourceUrl, "︾开始访问:$key") + printLog(webBook.sourceUrl, "⇒开始访问:$key") infoDebug(book) } else { - printLog(webBook.sourceUrl, "︾开始搜索关键字:$key") + printLog(webBook.sourceUrl, "⇒开始搜索关键字:$key") searchDebug(key) } } private fun searchDebug(key: String) { + printLog(debugSource, "︾开始解析搜索页") val search = webBook.searchBook(key, 1) .onSuccess { searchBooks -> searchBooks?.let { @@ -93,7 +94,7 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { } private fun infoDebug(book: Book) { - printLog(debugSource, "︾开始获取详情页") + printLog(debugSource, "︾开始解析详情页") val info = webBook.getBookInfo(book) .onSuccess { printLog(debugSource, "︽详情页解析完成") @@ -107,7 +108,7 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { } private fun tocDebug(book: Book) { - printLog(debugSource, "︾开始获取目录页") + printLog(debugSource, "︾开始解析目录页") val chapterList = webBook.getChapterList(book) .onSuccess { chapterList -> chapterList?.let { @@ -128,12 +129,13 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { } private fun contentDebug(book: Book, bookChapter: BookChapter, nextChapterUrl: String?) { - printLog(debugSource, "︾开始获取正文") + printLog(debugSource, "︾开始解析正文页") val content = webBook.getContent(book, bookChapter, nextChapterUrl) .onSuccess { content -> content?.let { printLog(debugSource, it, state = 1000) } + printLog(debugSource, "︽正文页解析完成") } .onError { printLog(debugSource, it.localizedMessage, state = -1) diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index 093c5a9ec..623de1157 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -13,7 +13,7 @@ import io.legado.app.utils.toast class AboutFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.about) - findPreference("version")?.summary = App.INSTANCE.versionName + findPreference("check_update")?.summary = getString(R.string.version) + " " + App.INSTANCE.versionName } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -23,8 +23,11 @@ class AboutFragment : PreferenceFragmentCompat() { override fun onPreferenceTreeClick(preference: Preference?): Boolean { when (preference?.key) { + "check_update" -> openIntent(Intent.ACTION_VIEW, getString(R.string.latest_release_url)) "mail" -> openIntent(Intent.ACTION_SENDTO, "mailto:kunfei.ge@gmail.com") "git" -> openIntent(Intent.ACTION_VIEW, getString(R.string.this_github_url)) + "home_page" -> openIntent(Intent.ACTION_VIEW, getString(R.string.home_page_url)) + "share_app" -> shareText("App Share",getString(R.string.app_share_description)) } return super.onPreferenceTreeClick(preference) } @@ -37,6 +40,16 @@ class AboutFragment : PreferenceFragmentCompat() { } catch (e: Exception) { toast(R.string.can_not_open) } + } + private fun shareText(title: String, text: String) { + try { + val textIntent = Intent(Intent.ACTION_SEND) + textIntent.setType("text/plain") + textIntent.putExtra(Intent.EXTRA_TEXT, text) + startActivity(Intent.createChooser(textIntent, title)) + } catch (e: Exception) { + toast(R.string.can_not_share) + } } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 20661274d..dd46e26bc 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -86,6 +86,8 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity R.id.menu_revert_selection -> adapter.revertSelection() R.id.menu_enable_selection -> viewModel.enableSelection(adapter.getSelectionIds()) R.id.menu_disable_selection -> viewModel.disableSelection(adapter.getSelectionIds()) + R.id.menu_enable_explore -> viewModel.enableSelectExplore(adapter.getSelectionIds()) + R.id.menu_disable_explore -> viewModel.disableSelectExplore(adapter.getSelectionIds()) R.id.menu_del_selection -> viewModel.delSelection(adapter.getSelectionIds()) R.id.menu_check_source -> startService(Pair("data", adapter.getSelectionIds())) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index 4c36f0d59..6e1c98db2 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt @@ -56,6 +56,22 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) } } + fun enableSelectExplore(ids: LinkedHashSet) { + execute { + ids.forEach { + App.db.bookSourceDao().enableSectionExplore(it) + } + } + } + + fun disableSelectExplore(ids: LinkedHashSet) { + execute { + ids.forEach { + App.db.bookSourceDao().disableSectionExplore(it) + } + } + } + fun delSelection(ids: LinkedHashSet) { execute { ids.forEach { diff --git a/app/src/main/res/menu/book_source.xml b/app/src/main/res/menu/book_source.xml index 1aa312bc4..3aacc98b3 100644 --- a/app/src/main/res/menu/book_source.xml +++ b/app/src/main/res/menu/book_source.xml @@ -32,6 +32,16 @@ android:title="@string/disable_selection" app:showAsAction="never" /> + + + + https://github.com/gedoor/legado https://gedoor.github.io/MyBookshelf/disclaimer.html https://gedoor.github.io/MyBookshelf/ - https://github.com/gedoor/MyBookshelf/releases/latest - https://api.github.com/repos/gedoor/MyBookshelf/releases/latest + https://github.com/gedoor/legado/releases/latest + https://api.github.com/repos/gedoor/legado/releases/latest diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 802e3ae8a..3dfb8f088 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -83,6 +83,9 @@ \u3000\u3000这是一款开源的阅读软件,你可以fork我们的代码自己编译APK。欢迎提交代码帮助改善应用。\n\u3000\u3000公众号[开源阅读软件]! + + 阅读3.0下载地址:\nhttps://play.google.com/store/apps/details?id=io.legado.app + Version %s 自动刷新 打开软件时自动更新书籍 @@ -138,6 +141,7 @@ 评分 发送邮件 无法打开 + 分享失败 无章节 添加网址 添加书籍网址 @@ -361,7 +365,7 @@ 发现地址规则(url) 书籍列表规则(bookList) 书名规则(name) - 书籍url规则(bookUrl) + 详情页url规则(bookUrl) 作者规则(author) 分类规则(kind) 简介规则(intro) @@ -412,7 +416,7 @@ 数据解析失败 - header + 请求头(header) 调试源 二维码导入 扫描二维码 @@ -482,7 +486,7 @@ 发现 详情 目录 - 内容 + 正文 E-Ink 模式 去除动画,优化电纸书使用体验 @@ -523,6 +527,8 @@ 添加分组 新建替换 分组 + 启用发现 + 禁用发现 启用所选 禁用所选 TTS diff --git a/app/src/main/res/xml/about.xml b/app/src/main/res/xml/about.xml index 620859558..0391f9d86 100644 --- a/app/src/main/res/xml/about.xml +++ b/app/src/main/res/xml/about.xml @@ -9,8 +9,8 @@ app:iconSpaceReserved="false" /> - - + +