mirror of
https://github.com/gedoor/legado.git
synced 2024-07-04 23:36:56 +08:00
Compare commits
12 Commits
2e0588c234
...
89d77a5930
Author | SHA1 | Date | |
---|---|---|---|
|
89d77a5930 | ||
|
0337e465de | ||
|
5acfe9be68 | ||
|
e081b4b470 | ||
|
2f2ba9a751 | ||
|
c53e789762 | ||
|
2e757ee105 | ||
|
17416e06f6 | ||
|
916adb7f8e | ||
|
1ba9ce009e | ||
|
697fd03cc1 | ||
|
9130452f06 |
|
@ -27,6 +27,15 @@ open class BaseViewModel(application: Application) : AndroidViewModel(applicatio
|
||||||
return Coroutine.async(scope, context, start, executeContext, block)
|
return Coroutine.async(scope, context, start, executeContext, block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun <T> executeLazy(
|
||||||
|
scope: CoroutineScope = viewModelScope,
|
||||||
|
context: CoroutineContext = Dispatchers.IO,
|
||||||
|
executeContext: CoroutineContext = Dispatchers.Main,
|
||||||
|
block: suspend CoroutineScope.() -> T
|
||||||
|
): Coroutine<T> {
|
||||||
|
return Coroutine.async(scope, context, CoroutineStart.LAZY, executeContext, block)
|
||||||
|
}
|
||||||
|
|
||||||
fun <R> submit(
|
fun <R> submit(
|
||||||
scope: CoroutineScope = viewModelScope,
|
scope: CoroutineScope = viewModelScope,
|
||||||
context: CoroutineContext = Dispatchers.IO,
|
context: CoroutineContext = Dispatchers.IO,
|
||||||
|
|
|
@ -81,6 +81,10 @@ class PermissionActivity : AppCompatActivity() {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
||||||
intent.setData(Uri.parse("package:$packageName"))
|
intent.setData(Uri.parse("package:$packageName"))
|
||||||
|
intent.setClassName(
|
||||||
|
"com.android.settings",
|
||||||
|
"com.android.settings.fuelgauge.RequestIgnoreBatteryOptimizations"
|
||||||
|
)
|
||||||
settingActivityResult.launch(intent)
|
settingActivityResult.launch(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ abstract class BaseReadAloudService : BaseService(),
|
||||||
}
|
}
|
||||||
nowSpeak = textChapter.getParagraphNum(readAloudNumber + 1, readAloudByPage) - 1
|
nowSpeak = textChapter.getParagraphNum(readAloudNumber + 1, readAloudByPage) - 1
|
||||||
if (!readAloudByPage && startPos == 0 && !toLast) {
|
if (!readAloudByPage && startPos == 0 && !toLast) {
|
||||||
pos = page.lines.first().chapterPosition -
|
pos = page.chapterPosition -
|
||||||
textChapter.paragraphs[nowSpeak].chapterPosition
|
textChapter.paragraphs[nowSpeak].chapterPosition
|
||||||
}
|
}
|
||||||
if (toLast) {
|
if (toLast) {
|
||||||
|
@ -226,7 +226,7 @@ abstract class BaseReadAloudService : BaseService(),
|
||||||
readAloudNumber = textChapter.getLastParagraphPosition()
|
readAloudNumber = textChapter.getLastParagraphPosition()
|
||||||
nowSpeak = contentList.lastIndex
|
nowSpeak = contentList.lastIndex
|
||||||
if (page.paragraphs.size == 1) {
|
if (page.paragraphs.size == 1) {
|
||||||
pos = page.lines.first().chapterPosition -
|
pos = page.chapterPosition -
|
||||||
textChapter.paragraphs[nowSpeak].chapterPosition
|
textChapter.paragraphs[nowSpeak].chapterPosition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.net.wifi.WifiManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.BaseService
|
import io.legado.app.base.BaseService
|
||||||
import io.legado.app.constant.AppConst
|
import io.legado.app.constant.AppConst
|
||||||
|
@ -23,6 +22,7 @@ import io.legado.app.utils.postEvent
|
||||||
import io.legado.app.utils.printOnDebug
|
import io.legado.app.utils.printOnDebug
|
||||||
import io.legado.app.utils.sendToClip
|
import io.legado.app.utils.sendToClip
|
||||||
import io.legado.app.utils.servicePendingIntent
|
import io.legado.app.utils.servicePendingIntent
|
||||||
|
import io.legado.app.utils.startForegroundServiceCompat
|
||||||
import io.legado.app.utils.startService
|
import io.legado.app.utils.startService
|
||||||
import io.legado.app.utils.stopService
|
import io.legado.app.utils.stopService
|
||||||
import io.legado.app.utils.toastOnUi
|
import io.legado.app.utils.toastOnUi
|
||||||
|
@ -45,7 +45,7 @@ class WebService : BaseService() {
|
||||||
|
|
||||||
fun startForeground(context: Context) {
|
fun startForeground(context: Context) {
|
||||||
val intent = Intent(context, WebService::class.java)
|
val intent = Intent(context, WebService::class.java)
|
||||||
ContextCompat.startForegroundService(context, intent)
|
context.startForegroundServiceCompat(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stop(context: Context) {
|
fun stop(context: Context) {
|
||||||
|
@ -94,7 +94,13 @@ class WebService : BaseService() {
|
||||||
val addressList = NetworkUtils.getLocalIPAddress()
|
val addressList = NetworkUtils.getLocalIPAddress()
|
||||||
notificationList.clear()
|
notificationList.clear()
|
||||||
if (addressList.any()) {
|
if (addressList.any()) {
|
||||||
notificationList.addAll(addressList.map { address -> getString(R.string.http_ip, address.hostAddress, getPort()) })
|
notificationList.addAll(addressList.map { address ->
|
||||||
|
getString(
|
||||||
|
R.string.http_ip,
|
||||||
|
address.hostAddress,
|
||||||
|
getPort()
|
||||||
|
)
|
||||||
|
})
|
||||||
hostAddress = notificationList.first()
|
hostAddress = notificationList.first()
|
||||||
} else {
|
} else {
|
||||||
hostAddress = getString(R.string.network_connection_unavailable)
|
hostAddress = getString(R.string.network_connection_unavailable)
|
||||||
|
@ -154,7 +160,13 @@ class WebService : BaseService() {
|
||||||
httpServer?.start()
|
httpServer?.start()
|
||||||
webSocketServer?.start(1000 * 30) // 通信超时设置
|
webSocketServer?.start(1000 * 30) // 通信超时设置
|
||||||
notificationList.clear()
|
notificationList.clear()
|
||||||
notificationList.addAll(addressList.map { address -> getString(R.string.http_ip, address.hostAddress, getPort()) })
|
notificationList.addAll(addressList.map { address ->
|
||||||
|
getString(
|
||||||
|
R.string.http_ip,
|
||||||
|
address.hostAddress,
|
||||||
|
getPort()
|
||||||
|
)
|
||||||
|
})
|
||||||
hostAddress = notificationList.first()
|
hostAddress = notificationList.first()
|
||||||
isRun = true
|
isRun = true
|
||||||
postEvent(EventBus.WEB_SERVICE, hostAddress)
|
postEvent(EventBus.WEB_SERVICE, hostAddress)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.databinding.DialogEditTextBinding
|
import io.legado.app.databinding.DialogEditTextBinding
|
||||||
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.lib.dialogs.alert
|
||||||
|
@ -22,7 +23,14 @@ import io.legado.app.lib.theme.backgroundColor
|
||||||
import io.legado.app.ui.book.import.BaseImportBookActivity
|
import io.legado.app.ui.book.import.BaseImportBookActivity
|
||||||
import io.legado.app.ui.file.HandleFileContract
|
import io.legado.app.ui.file.HandleFileContract
|
||||||
import io.legado.app.ui.widget.SelectActionBar
|
import io.legado.app.ui.widget.SelectActionBar
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.ArchiveUtils
|
||||||
|
import io.legado.app.utils.FileDoc
|
||||||
|
import io.legado.app.utils.gone
|
||||||
|
import io.legado.app.utils.isContentScheme
|
||||||
|
import io.legado.app.utils.isUri
|
||||||
|
import io.legado.app.utils.launch
|
||||||
|
import io.legado.app.utils.putPrefInt
|
||||||
|
import io.legado.app.utils.visible
|
||||||
import kotlinx.coroutines.Dispatchers.IO
|
import kotlinx.coroutines.Dispatchers.IO
|
||||||
import kotlinx.coroutines.Dispatchers.Main
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
@ -175,6 +183,7 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
||||||
selectFolder.launch()
|
selectFolder.launch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> initRootPath(rootUri.path!!)
|
else -> initRootPath(rootUri.path!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +300,9 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
||||||
|
|
||||||
override fun startRead(fileDoc: FileDoc) {
|
override fun startRead(fileDoc: FileDoc) {
|
||||||
if (!ArchiveUtils.isArchive(fileDoc.name)) {
|
if (!ArchiveUtils.isArchive(fileDoc.name)) {
|
||||||
startReadBook(fileDoc.toString())
|
appDb.bookDao.getBookByFileName(fileDoc.name)?.let {
|
||||||
|
startReadBook(it.bookUrl)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
onArchiveFileClick(fileDoc)
|
onArchiveFileClick(fileDoc)
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,11 @@ class RemoteBookActivity : BaseImportBookActivity<RemoteBookViewModel>(),
|
||||||
|
|
||||||
private fun upPath() {
|
private fun upPath() {
|
||||||
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
|
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
|
||||||
var path = "books" + File.separator
|
var path = if (viewModel.isDefaultWebdav) {
|
||||||
|
"books" + File.separator
|
||||||
|
} else {
|
||||||
|
File.separator
|
||||||
|
}
|
||||||
viewModel.dirList.forEach {
|
viewModel.dirList.forEach {
|
||||||
path = path + it.filename + File.separator
|
path = path + it.filename + File.separator
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,14 +90,17 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
||||||
}.flowOn(Dispatchers.IO)
|
}.flowOn(Dispatchers.IO)
|
||||||
|
|
||||||
private var remoteBookWebDav: RemoteBookWebDav? = null
|
private var remoteBookWebDav: RemoteBookWebDav? = null
|
||||||
|
var isDefaultWebdav = false
|
||||||
|
|
||||||
fun initData(onSuccess: () -> Unit) {
|
fun initData(onSuccess: () -> Unit) {
|
||||||
execute {
|
execute {
|
||||||
|
isDefaultWebdav = false
|
||||||
appDb.serverDao.get(AppConfig.remoteServerId)?.getWebDavConfig()?.let {
|
appDb.serverDao.get(AppConfig.remoteServerId)?.getWebDavConfig()?.let {
|
||||||
val authorization = Authorization(it)
|
val authorization = Authorization(it)
|
||||||
remoteBookWebDav = RemoteBookWebDav(it.url, authorization, AppConfig.remoteServerId)
|
remoteBookWebDav = RemoteBookWebDav(it.url, authorization, AppConfig.remoteServerId)
|
||||||
return@execute
|
return@execute
|
||||||
}
|
}
|
||||||
|
isDefaultWebdav = true
|
||||||
remoteBookWebDav = AppWebDav.defaultBookWebDav
|
remoteBookWebDav = AppWebDav.defaultBookWebDav
|
||||||
?: throw NoStackTraceException("webDav没有配置")
|
?: throw NoStackTraceException("webDav没有配置")
|
||||||
}.onError {
|
}.onError {
|
||||||
|
@ -108,7 +111,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadRemoteBookList(path: String?, loadCallback: (loading: Boolean) -> Unit) {
|
fun loadRemoteBookList(path: String?, loadCallback: (loading: Boolean) -> Unit) {
|
||||||
execute {
|
executeLazy {
|
||||||
val bookWebDav = remoteBookWebDav
|
val bookWebDav = remoteBookWebDav
|
||||||
?: throw NoStackTraceException("没有配置webDav")
|
?: throw NoStackTraceException("没有配置webDav")
|
||||||
dataCallback?.clear()
|
dataCallback?.clear()
|
||||||
|
@ -122,7 +125,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
||||||
loadCallback.invoke(true)
|
loadCallback.invoke(true)
|
||||||
}.onFinally {
|
}.onFinally {
|
||||||
loadCallback.invoke(false)
|
loadCallback.invoke(false)
|
||||||
}
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addToBookshelf(remoteBooks: HashSet<RemoteBook>, finally: () -> Unit) {
|
fun addToBookshelf(remoteBooks: HashSet<RemoteBook>, finally: () -> Unit) {
|
||||||
|
|
|
@ -278,7 +278,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||||
if (textPos.compare(selectEnd) <= 0) {
|
if (textPos.compare(selectEnd) <= 0) {
|
||||||
selectStart.upData(pos = textPos)
|
selectStart.upData(pos = textPos)
|
||||||
upSelectedStart(
|
upSelectedStart(
|
||||||
if (textPos.columnIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end,
|
if (textPos.columnIndex < textLine.columns.size) textColumn.start else textColumn.end,
|
||||||
textLine.lineBottom + relativeOffset,
|
textLine.lineBottom + relativeOffset,
|
||||||
textLine.lineTop + relativeOffset
|
textLine.lineTop + relativeOffset
|
||||||
)
|
)
|
||||||
|
@ -318,7 +318,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||||
selectEndMoveIndex(selectStart)
|
selectEndMoveIndex(selectStart)
|
||||||
selectStart.upData(textPos)
|
selectStart.upData(textPos)
|
||||||
upSelectedStart(
|
upSelectedStart(
|
||||||
if (textPos.columnIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end,
|
if (textPos.columnIndex < textLine.columns.size) textColumn.start else textColumn.end,
|
||||||
textLine.lineBottom + relativeOffset,
|
textLine.lineBottom + relativeOffset,
|
||||||
textLine.lineTop + relativeOffset
|
textLine.lineTop + relativeOffset
|
||||||
)
|
)
|
||||||
|
@ -498,7 +498,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||||
val textLine = relativePage(relativePagePos).getLine(lineIndex)
|
val textLine = relativePage(relativePagePos).getLine(lineIndex)
|
||||||
val textColumn = textLine.getColumn(charIndex)
|
val textColumn = textLine.getColumn(charIndex)
|
||||||
upSelectedStart(
|
upSelectedStart(
|
||||||
if (charIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end,
|
if (charIndex < textLine.columns.size) textColumn.start else textColumn.end,
|
||||||
textLine.lineBottom + relativeOffset(relativePagePos),
|
textLine.lineBottom + relativeOffset(relativePagePos),
|
||||||
textLine.lineTop + relativeOffset(relativePagePos)
|
textLine.lineTop + relativeOffset(relativePagePos)
|
||||||
)
|
)
|
||||||
|
@ -534,7 +534,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun upSelectChars() {
|
private fun upSelectChars() {
|
||||||
if (!selectStart.isSelected() || !selectEnd.isSelected()) {
|
if (!selectStart.isSelected() && !selectEnd.isSelected()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val last = if (callBack.isScroll) 2 else 0
|
val last = if (callBack.isScroll) 2 else 0
|
||||||
|
@ -621,7 +621,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||||
if (column is TextColumn) {
|
if (column is TextColumn) {
|
||||||
when {
|
when {
|
||||||
compareStart == 0 -> {
|
compareStart == 0 -> {
|
||||||
if (textPos.columnIndex < textLine.columns.lastIndex) {
|
if (textPos.columnIndex < textLine.columns.size) {
|
||||||
builder.append(column.charData)
|
builder.append(column.charData)
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -154,8 +154,8 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
|
||||||
*/
|
*/
|
||||||
private fun calcNextPageOffset(): Int {
|
private fun calcNextPageOffset(): Int {
|
||||||
val visibleHeight = ChapterProvider.visibleHeight
|
val visibleHeight = ChapterProvider.visibleHeight
|
||||||
val book = ReadBook.book!!
|
val book = ReadBook.book
|
||||||
if (book.isImage) {
|
if (book == null || book.isImage) {
|
||||||
return -visibleHeight
|
return -visibleHeight
|
||||||
}
|
}
|
||||||
val visiblePage = readView.getCurVisiblePage()
|
val visiblePage = readView.getCurVisiblePage()
|
||||||
|
@ -170,8 +170,8 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
|
||||||
|
|
||||||
private fun calcPrevPageOffset(): Int {
|
private fun calcPrevPageOffset(): Int {
|
||||||
val visibleHeight = ChapterProvider.visibleHeight
|
val visibleHeight = ChapterProvider.visibleHeight
|
||||||
val book = ReadBook.book!!
|
val book = ReadBook.book
|
||||||
if (book.isImage) {
|
if (book == null || book.isImage) {
|
||||||
return visibleHeight
|
return visibleHeight
|
||||||
}
|
}
|
||||||
val visiblePage = readView.getCurVisiblePage()
|
val visiblePage = readView.getCurVisiblePage()
|
||||||
|
|
|
@ -112,7 +112,7 @@ data class TextChapter(
|
||||||
*/
|
*/
|
||||||
fun getReadLength(pageIndex: Int): Int {
|
fun getReadLength(pageIndex: Int): Int {
|
||||||
if (pageIndex < 0) return 0
|
if (pageIndex < 0) return 0
|
||||||
return pages[min(pageIndex, lastIndex)].lines.first().chapterPosition
|
return pages[min(pageIndex, lastIndex)].chapterPosition
|
||||||
/*
|
/*
|
||||||
var length = 0
|
var length = 0
|
||||||
val maxIndex = min(pageIndex, pages.size)
|
val maxIndex = min(pageIndex, pages.size)
|
||||||
|
@ -224,14 +224,13 @@ data class TextChapter(
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
val bIndex = pages.fastBinarySearchBy(charIndex, 0, pageSize) {
|
val bIndex = pages.fastBinarySearchBy(charIndex, 0, pageSize) {
|
||||||
it.lines.first().chapterPosition
|
it.chapterPosition
|
||||||
}
|
}
|
||||||
val index = abs(bIndex + 1) - 1
|
val index = abs(bIndex + 1) - 1
|
||||||
// 判断是否已经排版到 charIndex ,没有则返回 -1
|
// 判断是否已经排版到 charIndex ,没有则返回 -1
|
||||||
if (!isCompleted && index == pageSize - 1) {
|
if (!isCompleted && index == pageSize - 1) {
|
||||||
val page = pages[index]
|
val page = pages[index]
|
||||||
val line = page.lines.first()
|
val pageEndPos = page.chapterPosition + page.charSize
|
||||||
val pageEndPos = line.chapterPosition + page.charSize
|
|
||||||
if (charIndex > pageEndPos) {
|
if (charIndex > pageEndPos) {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ data class TextPage(
|
||||||
val lines: List<TextLine> get() = textLines
|
val lines: List<TextLine> get() = textLines
|
||||||
val lineSize: Int get() = textLines.size
|
val lineSize: Int get() = textLines.size
|
||||||
val charSize: Int get() = text.length.coerceAtLeast(1)
|
val charSize: Int get() = text.length.coerceAtLeast(1)
|
||||||
|
val chapterPosition: Int get() = textLines.first().chapterPosition
|
||||||
val searchResult = hashSetOf<TextColumn>()
|
val searchResult = hashSetOf<TextColumn>()
|
||||||
var isMsgPage: Boolean = false
|
var isMsgPage: Boolean = false
|
||||||
var canvasRecorder = CanvasRecorderFactory.create(true)
|
var canvasRecorder = CanvasRecorderFactory.create(true)
|
||||||
|
|
|
@ -177,7 +177,7 @@ class TextChapterLayout(
|
||||||
val contents = bookContent.textList
|
val contents = bookContent.textList
|
||||||
var absStartX = paddingLeft
|
var absStartX = paddingLeft
|
||||||
var durY = 0f
|
var durY = 0f
|
||||||
if (ReadBookConfig.titleMode != 2 || bookChapter.isVolume) {
|
if (ReadBookConfig.titleMode != 2 || bookChapter.isVolume || contents.isEmpty()) {
|
||||||
//标题非隐藏
|
//标题非隐藏
|
||||||
displayTitle.splitNotBlank("\n").forEach { text ->
|
displayTitle.splitNotBlank("\n").forEach { text ->
|
||||||
setTypeText(
|
setTypeText(
|
||||||
|
|
|
@ -106,11 +106,13 @@ public class PackageDocumentReader extends PackageDocumentBase {
|
||||||
NodeList originItemElements = manifestElement
|
NodeList originItemElements = manifestElement
|
||||||
.getElementsByTagNameNS(NAMESPACE_OPF, OPFTags.item);
|
.getElementsByTagNameNS(NAMESPACE_OPF, OPFTags.item);
|
||||||
for (int i = 0; i < originItemElements.getLength(); i++) {
|
for (int i = 0; i < originItemElements.getLength(); i++) {
|
||||||
Element itemElement = (Element) originItemElements.item(i);
|
Element itemElement = (Element) originItemElements.item(i).cloneNode(false);
|
||||||
fixedElements.add(itemElement);
|
|
||||||
String href = DOMUtil.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
|
String href = DOMUtil.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
|
||||||
|
String resolvedHref = packagePath.resolve(href).toString();
|
||||||
|
itemElement.setAttribute("href", resolvedHref);
|
||||||
|
fixedElements.add(itemElement);
|
||||||
try {
|
try {
|
||||||
href = URLDecoder.decode(packagePath.resolve(href).toString(), Constants.CHARACTER_ENCODING);
|
href = URLDecoder.decode(resolvedHref, Constants.CHARACTER_ENCODING);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
Log.e(TAG, e.getMessage());
|
Log.e(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -177,7 +179,7 @@ public class PackageDocumentReader extends PackageDocumentBase {
|
||||||
.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
|
.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
href = URLDecoder.decode(packagePath.resolve(href).toString(), Constants.CHARACTER_ENCODING);
|
href = URLDecoder.decode(href, Constants.CHARACTER_ENCODING);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
Log.e(TAG, e.getMessage());
|
Log.e(TAG, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"sass": "^1.62.1",
|
"sass": "^1.62.1",
|
||||||
"unplugin-auto-import": "^0.17.5",
|
"unplugin-auto-import": "^0.17.5",
|
||||||
"unplugin-icons": "^0.18.5",
|
"unplugin-icons": "^0.18.5",
|
||||||
"unplugin-vue-components": "^0.26.0",
|
"unplugin-vue-components": "^0.27.0",
|
||||||
"vite": "^5.1.3"
|
"vite": "^5.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user