mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e904c8a48a
2
.github/ISSUE_TEMPLATE/01-bugReport.yml
vendored
2
.github/ISSUE_TEMPLATE/01-bugReport.yml
vendored
@ -9,7 +9,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: 搜索现有issues,不存在相似或相关的issue / No similar or related issues
|
- label: 搜索现有issues,不存在相似或相关的issue / No similar or related issues
|
||||||
required: true
|
required: true
|
||||||
- label: 最新[测试版](https://kunfei.lanzoui.com/b0f810h4b)依然存在此问题 / Latest beta app does not work
|
- label: 最新[测试版](https://github.com/gedoor/legado/actions/workflows/test.yml)依然存在此问题 / Latest beta app does not work
|
||||||
required: true
|
required: true
|
||||||
- label: 此问题和Xposed、Lsposed、Magisk、手机主题、浏览器插件等无关 / Make sure your machine is not touched by hook frameworks, plugins etc
|
- label: 此问题和Xposed、Lsposed、Magisk、手机主题、浏览器插件等无关 / Make sure your machine is not touched by hook frameworks, plugins etc
|
||||||
required: true
|
required: true
|
||||||
|
@ -134,16 +134,6 @@ class EpubFile(var book: Book) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getContent(chapter: BookChapter): String? {
|
private fun getContent(chapter: BookChapter): String? {
|
||||||
/**
|
|
||||||
* <image width="1038" height="670" xlink:href="..."/>
|
|
||||||
* ...titlepage.xhtml
|
|
||||||
* 大多数epub文件的封面页都会带有cover,可以一定程度上解决封面读取问题
|
|
||||||
*/
|
|
||||||
if (chapter.url.contains("titlepage.xhtml") ||
|
|
||||||
chapter.url.contains("cover")
|
|
||||||
) {
|
|
||||||
return "<img src=\"cover.jpeg\" />"
|
|
||||||
}
|
|
||||||
/*获取当前章节文本*/
|
/*获取当前章节文本*/
|
||||||
val contents = epubBookContents ?: return null
|
val contents = epubBookContents ?: return null
|
||||||
val nextChapterFirstResourceHref = chapter.getVariable("nextUrl").substringBeforeLast("#")
|
val nextChapterFirstResourceHref = chapter.getVariable("nextUrl").substringBeforeLast("#")
|
||||||
@ -201,6 +191,17 @@ class EpubFile(var book: Book) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getBody(res: Resource, startFragmentId: String?, endFragmentId: String?): Element {
|
private fun getBody(res: Resource, startFragmentId: String?, endFragmentId: String?): Element {
|
||||||
|
/**
|
||||||
|
* <image width="1038" height="670" xlink:href="..."/>
|
||||||
|
* ...titlepage.xhtml
|
||||||
|
* 大多数epub文件的封面页都会带有cover,可以一定程度上解决封面读取问题
|
||||||
|
*/
|
||||||
|
if (res.href.contains("titlepage.xhtml") ||
|
||||||
|
res.href.contains("cover")
|
||||||
|
) {
|
||||||
|
return Jsoup.parseBodyFragment("<img src=\"cover.jpeg\" />")
|
||||||
|
}
|
||||||
|
|
||||||
// Jsoup可能会修复不规范的xhtml文件 解析处理后再获取
|
// Jsoup可能会修复不规范的xhtml文件 解析处理后再获取
|
||||||
var bodyElement = Jsoup.parse(String(res.data, mCharset)).body()
|
var bodyElement = Jsoup.parse(String(res.data, mCharset)).body()
|
||||||
bodyElement.children().run {
|
bodyElement.children().run {
|
||||||
|
@ -14,6 +14,7 @@ import io.legado.app.base.adapter.ItemViewHolder
|
|||||||
import io.legado.app.data.entities.SearchBook
|
import io.legado.app.data.entities.SearchBook
|
||||||
import io.legado.app.databinding.ItemChangeSourceBinding
|
import io.legado.app.databinding.ItemChangeSourceBinding
|
||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
|
import io.legado.app.lib.dialogs.alert
|
||||||
import io.legado.app.utils.getCompatColor
|
import io.legado.app.utils.getCompatColor
|
||||||
import io.legado.app.utils.gone
|
import io.legado.app.utils.gone
|
||||||
import io.legado.app.utils.invisible
|
import io.legado.app.utils.invisible
|
||||||
@ -82,8 +83,14 @@ class ChangeBookSourceAdapter(
|
|||||||
if (score > 0) {
|
if (score > 0) {
|
||||||
binding.ivBad.gone()
|
binding.ivBad.gone()
|
||||||
binding.ivGood.visible()
|
binding.ivGood.visible()
|
||||||
DrawableCompat.setTint(binding.ivGood.drawable, appCtx.getCompatColor(R.color.md_red_A200))
|
DrawableCompat.setTint(
|
||||||
DrawableCompat.setTint(binding.ivBad.drawable, appCtx.getCompatColor(R.color.md_blue_100))
|
binding.ivGood.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_red_A200)
|
||||||
|
)
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
binding.ivBad.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_blue_100)
|
||||||
|
)
|
||||||
} else if (score < 0) {
|
} else if (score < 0) {
|
||||||
binding.ivGood.gone()
|
binding.ivGood.gone()
|
||||||
binding.ivBad.visible()
|
binding.ivBad.visible()
|
||||||
@ -125,13 +132,19 @@ class ChangeBookSourceAdapter(
|
|||||||
override fun registerListener(holder: ItemViewHolder, binding: ItemChangeSourceBinding) {
|
override fun registerListener(holder: ItemViewHolder, binding: ItemChangeSourceBinding) {
|
||||||
binding.ivGood.setOnClickListener {
|
binding.ivGood.setOnClickListener {
|
||||||
if (binding.ivBad.isVisible) {
|
if (binding.ivBad.isVisible) {
|
||||||
DrawableCompat.setTint(binding.ivGood.drawable, appCtx.getCompatColor(R.color.md_red_A200))
|
DrawableCompat.setTint(
|
||||||
|
binding.ivGood.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_red_A200)
|
||||||
|
)
|
||||||
binding.ivBad.gone()
|
binding.ivBad.gone()
|
||||||
getItem(holder.layoutPosition)?.let {
|
getItem(holder.layoutPosition)?.let {
|
||||||
callBack.setBookScore(it, 1)
|
callBack.setBookScore(it, 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DrawableCompat.setTint(binding.ivGood.drawable, appCtx.getCompatColor(R.color.md_red_100))
|
DrawableCompat.setTint(
|
||||||
|
binding.ivGood.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_red_100)
|
||||||
|
)
|
||||||
binding.ivBad.visible()
|
binding.ivBad.visible()
|
||||||
getItem(holder.layoutPosition)?.let {
|
getItem(holder.layoutPosition)?.let {
|
||||||
callBack.setBookScore(it, 0)
|
callBack.setBookScore(it, 0)
|
||||||
@ -140,13 +153,19 @@ class ChangeBookSourceAdapter(
|
|||||||
}
|
}
|
||||||
binding.ivBad.setOnClickListener {
|
binding.ivBad.setOnClickListener {
|
||||||
if (binding.ivGood.isVisible) {
|
if (binding.ivGood.isVisible) {
|
||||||
DrawableCompat.setTint(binding.ivBad.drawable, appCtx.getCompatColor(R.color.md_blue_A200))
|
DrawableCompat.setTint(
|
||||||
|
binding.ivBad.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_blue_A200)
|
||||||
|
)
|
||||||
binding.ivGood.gone()
|
binding.ivGood.gone()
|
||||||
getItem(holder.layoutPosition)?.let {
|
getItem(holder.layoutPosition)?.let {
|
||||||
callBack.setBookScore(it, -1)
|
callBack.setBookScore(it, -1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DrawableCompat.setTint(binding.ivBad.drawable, appCtx.getCompatColor(R.color.md_blue_100))
|
DrawableCompat.setTint(
|
||||||
|
binding.ivBad.drawable,
|
||||||
|
appCtx.getCompatColor(R.color.md_blue_100)
|
||||||
|
)
|
||||||
binding.ivGood.visible()
|
binding.ivGood.visible()
|
||||||
getItem(holder.layoutPosition)?.let {
|
getItem(holder.layoutPosition)?.let {
|
||||||
callBack.setBookScore(it, 0)
|
callBack.setBookScore(it, 0)
|
||||||
@ -174,18 +193,26 @@ class ChangeBookSourceAdapter(
|
|||||||
R.id.menu_top_source -> {
|
R.id.menu_top_source -> {
|
||||||
callBack.topSource(searchBook)
|
callBack.topSource(searchBook)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_bottom_source -> {
|
R.id.menu_bottom_source -> {
|
||||||
callBack.bottomSource(searchBook)
|
callBack.bottomSource(searchBook)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_edit_source -> {
|
R.id.menu_edit_source -> {
|
||||||
callBack.editSource(searchBook)
|
callBack.editSource(searchBook)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_disable_source -> {
|
R.id.menu_disable_source -> {
|
||||||
callBack.disableSource(searchBook)
|
callBack.disableSource(searchBook)
|
||||||
}
|
}
|
||||||
R.id.menu_delete_source -> {
|
|
||||||
callBack.deleteSource(searchBook)
|
R.id.menu_delete_source -> context.alert(R.string.draw) {
|
||||||
updateItems(0, itemCount, listOf<Int>())
|
setMessage(context.getString(R.string.sure_del) + "\n" + searchBook.originName)
|
||||||
|
noButton()
|
||||||
|
yesButton {
|
||||||
|
callBack.deleteSource(searchBook)
|
||||||
|
updateItems(0, itemCount, listOf<Int>())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<item>@string/screen_portrait</item>
|
<item>@string/screen_portrait</item>
|
||||||
<item>@string/screen_landscape</item>
|
<item>@string/screen_landscape</item>
|
||||||
<item>@string/screen_sensor</item>
|
<item>@string/screen_sensor</item>
|
||||||
<item>反向竖屏</item>
|
<item>@string/screen_portrait_reversed</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="icon_names">
|
<string-array name="icon_names">
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<item>@string/screen_portrait</item>
|
<item>@string/screen_portrait</item>
|
||||||
<item>@string/screen_landscape</item>
|
<item>@string/screen_landscape</item>
|
||||||
<item>@string/screen_sensor</item>
|
<item>@string/screen_sensor</item>
|
||||||
<item>反向竖屏</item>
|
<item>@string/screen_portrait_reversed</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="icon_names">
|
<string-array name="icon_names">
|
||||||
|
@ -77,15 +77,15 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="double_page_title">
|
<string-array name="double_page_title">
|
||||||
<item>全局单页</item>
|
<item>Single page</item>
|
||||||
<item>全局双页</item>
|
<item>Double page</item>
|
||||||
<item>横屏双页</item>
|
<item>Double page in landscape</item>
|
||||||
<item>平板/横屏双页</item>
|
<item>Double page on tablet or landscape</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="progress_bar_behavior_title">
|
<string-array name="progress_bar_behavior_title">
|
||||||
<item>调整本章页数</item>
|
<item>Adjust of chapter page</item>
|
||||||
<item>调整章节位置</item>
|
<item>Adjust of chapter index</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="icon_names" tools:ignore="Typos">
|
<string-array name="icon_names" tools:ignore="Typos">
|
||||||
|
@ -905,7 +905,7 @@
|
|||||||
<string name="disable_source">disable source</string>
|
<string name="disable_source">disable source</string>
|
||||||
<string name="delete_source">delete source</string>
|
<string name="delete_source">delete source</string>
|
||||||
<string name="chapter_pay">pay</string>
|
<string name="chapter_pay">pay</string>
|
||||||
<string name="double_page_horizontal">Flat/Landscape Dual Page</string>
|
<string name="double_page_horizontal">Tablet/Landscape Dual Page</string>
|
||||||
<string name="open_in_browser">open in browser</string>
|
<string name="open_in_browser">open in browser</string>
|
||||||
<string name="copy_url">copy url</string>
|
<string name="copy_url">copy url</string>
|
||||||
<string name="open_fun">open function</string>
|
<string name="open_fun">open function</string>
|
||||||
|
@ -136,18 +136,18 @@ public class NCXDocumentV3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<TOCReference> doToc(Node n, EpubBook book) {
|
private static List<TOCReference> doToc(Node n, EpubBook book) {
|
||||||
List<TOCReference> result = new ArrayList<>();
|
|
||||||
|
|
||||||
if (n == null || n.getNodeType() != Document.ELEMENT_NODE) {
|
if (n == null || n.getNodeType() != Document.ELEMENT_NODE) {
|
||||||
return result;
|
return new ArrayList<>();
|
||||||
} else {
|
|
||||||
Element el = (Element) n;
|
|
||||||
NodeList nodeList = el.getElementsByTagName(XHTMLTgs.li);
|
|
||||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
|
||||||
result.add(readTOCReference((Element) nodeList.item(i), book));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
Element el = (Element) n;
|
||||||
|
Node node = el.getElementsByTagName(XHTMLTgs.ol).item(0);
|
||||||
|
|
||||||
|
if (node == null || node.getNodeType() != Document.ELEMENT_NODE) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return readTOCReferences(node.getChildNodes(), book);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user