图片相对地址转绝对地址

pull/885/head^2
gedoor 4 years ago
parent 5a333fdf02
commit d3f158e206
  1. 23
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@ -95,7 +95,8 @@ object ChapterProvider {
val sb = StringBuffer() val sb = StringBuffer()
val matcher = AppPattern.imgPattern.matcher(text) val matcher = AppPattern.imgPattern.matcher(text)
while (matcher.find()) { while (matcher.find()) {
matcher.group(1)?.let { src -> matcher.group(1)?.let { it ->
val src = NetworkUtils.getAbsoluteURL(bookChapter.url, it)
srcList.add(src) srcList.add(src)
ImageProvider.getImage(book, bookChapter.index, src) ImageProvider.getImage(book, bookChapter.index, src)
matcher.appendReplacement(sb, srcReplaceChar) matcher.appendReplacement(sb, srcReplaceChar)
@ -117,16 +118,12 @@ object ChapterProvider {
if (text.isNotBlank()) { if (text.isNotBlank()) {
val matcher = AppPattern.imgPattern.matcher(text) val matcher = AppPattern.imgPattern.matcher(text)
if (matcher.find()) { if (matcher.find()) {
matcher.group(1)?.let { mt -> matcher.group(1)?.let { it ->
if (!book.isEpub()) { if (!book.isEpub()) {
val src = NetworkUtils.getAbsoluteURL(bookChapter.url, mt) val src = NetworkUtils.getAbsoluteURL(bookChapter.url, it)
durY = setTypeImage( durY = setTypeImage(
book, book, bookChapter, src,
bookChapter, durY, textPages, book.getImageStyle()
src,
durY,
textPages,
book.getImageStyle()
) )
} }
} }
@ -135,12 +132,8 @@ object ChapterProvider {
val textPaint = if (isTitle) titlePaint else contentPaint val textPaint = if (isTitle) titlePaint else contentPaint
if (!(isTitle && ReadBookConfig.titleMode == 2)) { if (!(isTitle && ReadBookConfig.titleMode == 2)) {
durY = setTypeText( durY = setTypeText(
text, text, durY, textPages,
durY, stringBuilder, isTitle, textPaint
textPages,
stringBuilder,
isTitle,
textPaint
) )
} }
} }

Loading…
Cancel
Save