From 492641a0221c4e799d9dec5ccf9bf43edb53c9bf Mon Sep 17 00:00:00 2001 From: david082321 <7046617+david082321@users.noreply.github.com> Date: Wed, 16 Dec 2020 02:30:21 +0800 Subject: [PATCH 1/7] Update strings.xml --- app/src/main/res/values-zh-rTW/strings.xml | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 844c81fbd..d8d6bc7d3 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -362,8 +362,8 @@ 完結書籍 本機書籍 狀態欄顏色透明 - 沉浸式导航栏 - 导航栏颜色透明 + 沉浸式導航欄 + 導航欄顏色透明 放入書架 繼續閱讀 封面地址 @@ -405,7 +405,7 @@ 書籍URL正則(bookUrlPattern) 預處理規則(bookInfoInit) 目錄URL規則(tocUrl) - 允许修改书名作者(canReName) + 允許修改書名作者(canReName) 目錄下一頁規則(nextTocUrl) 目錄列表規則(chapterList) 章節名稱規則(ChapterName) @@ -715,7 +715,7 @@ 該書已在下載列表 點擊打開 關注[legado-top]點擊廣告支持我 - 微信贊賞碼 + 微信讚賞碼 支付寶 支付寶紅包搜尋碼 537954522 點擊複製 @@ -758,8 +758,8 @@ 匯入 匯出 儲存主題配置 - 儲存白天主題配置以供調用和分享 - 儲存夜間主題配置以供調用和分享 + 儲存白天主題配置以供呼叫和分享 + 儲存夜間主題配置以供呼叫和分享 主題列表 使用儲存主題,匯入,分享主題 切換預設主題 @@ -768,30 +768,30 @@ 全文搜尋 關注公眾號[开源阅读]獲取訂閱源! 目前沒有發現源,關注公眾號[开源阅读]添加包含發現的書源! - 将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开. - 主题名称 - 自动清除过期搜索数据 - 超过一天的搜索数据 + 將焦點放到輸入框按下物理按鍵會自動輸入鍵值,多個按鍵會自動用英文逗號隔開. + 主題名稱 + 自動清除過期搜尋資料 + 超過一天的搜尋資料 重新分段 - 样式名称: - 点击右上角文件夹图标,选择文件夹 - 智能扫描 - 拷贝URL - 没有书籍 + 樣式名稱: + 點擊右上角資料夾圖示,選擇資料夾 + 智慧掃描 + 複製URL + 沒有書籍 保留原名 - 点击区域设置 - 关闭 - 下一页 - 上一页 - 无操作 - 正文标题 - 显示/隐藏 - 页眉页脚 - 规则订阅 - 添加大佬们提供的规则导入地址\n添加后点击可导入规则 - 拉取云端进度 - 当前进度超过云端进度,是否同步? - 同步阅读进度 - 进入退出阅读界面时同步阅读进度 + 點擊區域設定 + 關閉 + 下一頁 + 上一頁 + 無操作 + 正文標題 + 顯示/隱藏 + 頁首頁尾 + 規則訂閱 + 添加大佬們提供的規則匯入地址\n添加後點擊可匯入規則 + 拉取雲端進度 + 目前進度超過雲端進度,是否同步? + 同步閱讀進度 + 進入退出閱讀介面時同步閱讀進度 From 87f2aed7db4d3f1d1bb3282b34dcc447c4be4285 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 08:08:47 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B9=A6=E6=BA=90?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E9=97=AA=E9=80=80bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/base/adapter/SimpleRecyclerAdapter.kt | 58 +------------------ .../app/ui/book/local/ImportBookAdapter.kt | 4 +- .../searchContent/SearchContentAdapter.kt | 4 +- .../source/debug/BookSourceDebugAdapter.kt | 4 +- .../rss/source/debug/RssSourceDebugAdapter.kt | 4 +- 5 files changed, 9 insertions(+), 65 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt b/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt index d6a206656..f8c5e7e85 100644 --- a/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt +++ b/app/src/main/java/io/legado/app/base/adapter/SimpleRecyclerAdapter.kt @@ -35,7 +35,7 @@ abstract class SimpleRecyclerAdapter(protected val conte object : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: ITEM, newItem: ITEM): Boolean { - return oldItem == newItem + return false } override fun areContentsTheSame(oldItem: ITEM, newItem: ITEM): Boolean { @@ -70,57 +70,6 @@ abstract class SimpleRecyclerAdapter(protected val conte } } - fun addItem(item: ITEM) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - list.add(item) - asyncListDiffer.submitList(list) - } - } - - fun addItems(position: Int, newItems: List) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - list.addAll(position, newItems) - asyncListDiffer.submitList(list) - } - } - - fun addItems(newItems: List) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - list.addAll(newItems) - asyncListDiffer.submitList(list) - } - } - - fun removeItem(position: Int) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - if (list.removeAt(position) != null) { - asyncListDiffer.submitList(list) - } - } - } - - fun removeItem(item: ITEM) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - if (list.remove(item)) { - asyncListDiffer.submitList(list) - } - } - } - - fun removeItems(items: List) { - synchronized(lock) { - val list = ArrayList(asyncListDiffer.currentList) - if (list.removeAll(items)) { - asyncListDiffer.submitList(list) - } - } - } - fun swapItem(srcPosition: Int, targetPosition: Int) { synchronized(lock) { val list = ArrayList(getItems()) @@ -158,11 +107,6 @@ abstract class SimpleRecyclerAdapter(protected val conte } } - fun clearItems() = - synchronized(lock) { - asyncListDiffer.submitList(arrayListOf()) - } - fun isEmpty() = asyncListDiffer.currentList.isEmpty() fun isNotEmpty() = asyncListDiffer.currentList.isNotEmpty() diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt index 269125da4..417bf96aa 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt @@ -4,8 +4,8 @@ import android.content.Context import android.net.Uri import android.view.ViewGroup import io.legado.app.R +import io.legado.app.base.adapter.CommonRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder -import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.constant.AppConst import io.legado.app.databinding.ItemImportBookBinding import io.legado.app.utils.* @@ -13,7 +13,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick class ImportBookAdapter(context: Context, val callBack: CallBack) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { var selectedUris = hashSetOf() var checkableCount = 0 private var bookFileNames = arrayListOf() diff --git a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt index 6164c2938..b8bca39b7 100644 --- a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentAdapter.kt @@ -3,8 +3,8 @@ package io.legado.app.ui.book.searchContent import android.content.Context import android.view.ViewGroup import io.legado.app.R +import io.legado.app.base.adapter.CommonRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder -import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.databinding.ItemSearchListBinding import io.legado.app.lib.theme.accentColor import io.legado.app.utils.getCompatColor @@ -12,7 +12,7 @@ import io.legado.app.utils.hexString import org.jetbrains.anko.sdk27.listeners.onClick class SearchContentAdapter(context: Context, val callback: Callback) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { val cacheFileNames = hashSetOf() val textColor = context.getCompatColor(R.color.primaryText).hexString.substring(2) diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugAdapter.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugAdapter.kt index 31194f03e..c91c336eb 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugAdapter.kt @@ -4,12 +4,12 @@ import android.content.Context import android.view.View import android.view.ViewGroup import io.legado.app.R +import io.legado.app.base.adapter.CommonRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder -import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.databinding.ItemLogBinding class BookSourceDebugAdapter(context: Context) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemLogBinding { return ItemLogBinding.inflate(inflater, parent, false) diff --git a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugAdapter.kt index 3371d2ef6..bb14033b7 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugAdapter.kt @@ -4,12 +4,12 @@ import android.content.Context import android.view.View import android.view.ViewGroup import io.legado.app.R +import io.legado.app.base.adapter.CommonRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder -import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.databinding.ItemLogBinding class RssSourceDebugAdapter(context: Context) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemLogBinding { return ItemLogBinding.inflate(inflater, parent, false) From 4e5b2540ae0053ce1354f55f083f070d16ebc967 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 08:09:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt index d8b448c1f..042468ad5 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/BookAdapter.kt @@ -2,14 +2,14 @@ package io.legado.app.ui.book.search import android.content.Context import android.view.ViewGroup +import io.legado.app.base.adapter.CommonRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder -import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.Book import io.legado.app.databinding.ItemFilletTextBinding import org.jetbrains.anko.sdk27.listeners.onClick class BookAdapter(context: Context, val callBack: CallBack) : - SimpleRecyclerAdapter(context) { + CommonRecyclerAdapter(context) { override fun getViewBinding(parent: ViewGroup): ItemFilletTextBinding { return ItemFilletTextBinding.inflate(inflater, parent, false) From bbeeb90c24765c6b7dcae1bf0bdfca25e65c9fce Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 08:20:46 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/http/AjaxWebView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt b/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt index 3c9f0c8b6..731e8ec9d 100644 --- a/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt +++ b/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt @@ -170,7 +170,7 @@ class AjaxWebView { return@evaluateJavascript } if (retry > 30) { - handler.obtainMessage(MSG_ERROR, Exception("time out")) + handler.obtainMessage(MSG_ERROR, Exception("js执行超时")) .sendToTarget() handler.removeCallbacks(this) return@evaluateJavascript From 1cee5a5cf5f10e4555b4f3b96ce1ced69705a19c Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 08:39:17 +0800 Subject: [PATCH 5/7] update updateLog.md --- app/src/main/assets/updateLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index a6fc52323..b1b192255 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,9 @@ * 关注合作公众号 **[小说拾遗]** 获取好看的小说。 * 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。 +**2020/12/16** +* 修复上版本因更新组件引起的一些bug + **2020/12/15** * 修复一些引起崩溃的bug * 修复搜书和换源可能什么分组都没有的bug From b0f9a3981d0472d907a4e8dcc9e71fb761c5af83 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 09:13:17 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/changecover/ChangeCoverDialog.kt | 3 --- .../io/legado/app/ui/book/changesource/ChangeSourceDialog.kt | 3 --- .../legado/app/ui/book/changesource/ChangeSourceViewModel.kt | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt index c842e0fae..c7a5130d4 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt @@ -7,7 +7,6 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.Toolbar import androidx.fragment.app.FragmentManager -import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.GridLayoutManager import io.legado.app.R import io.legado.app.base.BaseDialogFragment @@ -93,9 +92,7 @@ class ChangeCoverDialog : BaseDialogFragment(), binding.toolBar.menu.applyTint(requireContext(), Theme.getTheme()) }) viewModel.searchBooksLiveData.observe(viewLifecycleOwner, { - val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it)) adapter.setItems(it) - diffResult.dispatchUpdatesTo(adapter) }) } diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index ef0d4661f..1c5071173 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -5,7 +5,6 @@ import android.view.* import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.Toolbar import androidx.fragment.app.FragmentManager -import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import io.legado.app.App @@ -145,9 +144,7 @@ class ChangeSourceDialog : BaseDialogFragment(), binding.toolBar.menu.applyTint(requireContext()) }) viewModel.searchBooksLiveData.observe(viewLifecycleOwner, { - val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it)) adapter.setItems(it) - diffResult.dispatchUpdatesTo(adapter) }) App.db.bookSourceDao.liveGroupEnabled().observe(this, { groups.clear() diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt index f52ad89d5..e4d3e3c17 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt @@ -102,7 +102,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio private fun startSearch() { execute { bookSourceList.clear() - if (searchGroup.isNullOrBlank()) { + if (searchGroup.isBlank()) { bookSourceList.addAll(App.db.bookSourceDao.allEnabled) } else { bookSourceList.addAll(App.db.bookSourceDao.getEnabledByGroup(searchGroup)) From ffd33083629dd8712d11245a25751a35f1654477 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 09:26:02 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/changecover/CoverAdapter.kt | 14 ++++++++++++++ .../ui/book/changesource/ChangeSourceAdapter.kt | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt index 1a062b4ce..6132ca3dd 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt @@ -2,6 +2,7 @@ package io.legado.app.ui.book.changecover import android.content.Context import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.SearchBook @@ -11,6 +12,19 @@ import org.jetbrains.anko.sdk27.listeners.onClick class CoverAdapter(context: Context, val callBack: CallBack) : SimpleRecyclerAdapter(context) { + override val diffItemCallback: DiffUtil.ItemCallback + get() = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { + return oldItem.bookUrl == newItem.bookUrl + } + + override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { + return oldItem.originName == newItem.originName + && oldItem.coverUrl == newItem.coverUrl + } + + } + override fun getViewBinding(parent: ViewGroup): ItemCoverBinding { return ItemCoverBinding.inflate(inflater, parent, false) } diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt index e3b96fe45..48a9dfcc1 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt @@ -5,6 +5,7 @@ import android.os.Bundle import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.PopupMenu +import androidx.recyclerview.widget.DiffUtil import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter @@ -19,6 +20,19 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick class ChangeSourceAdapter(context: Context, val callBack: CallBack) : SimpleRecyclerAdapter(context) { + override val diffItemCallback: DiffUtil.ItemCallback + get() = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { + return oldItem.bookUrl == newItem.bookUrl + } + + override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { + return oldItem.originName == newItem.originName + && oldItem.getDisplayLastChapterTitle() == newItem.getDisplayLastChapterTitle() + } + + } + override fun getViewBinding(parent: ViewGroup): ItemChangeSourceBinding { return ItemChangeSourceBinding.inflate(inflater, parent, false) }