优化
This commit is contained in:
@@ -55,7 +55,8 @@ data class HttpTTS(
|
|||||||
loginUrl = doc.readString("$.loginUrl"),
|
loginUrl = doc.readString("$.loginUrl"),
|
||||||
loginUi = if (loginUi is List<*>) GSON.toJson(loginUi) else loginUi?.toString(),
|
loginUi = if (loginUi is List<*>) GSON.toJson(loginUi) else loginUi?.toString(),
|
||||||
header = doc.readString("$.header"),
|
header = doc.readString("$.header"),
|
||||||
loginCheckJs = doc.readString("$.loginCheckJs")
|
loginCheckJs = doc.readString("$.loginCheckJs"),
|
||||||
|
lastUpdateTime = doc.readLong("$.lastUpdateTime") ?: System.currentTimeMillis()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package io.legado.app.help.glide.progress
|
package io.legado.app.help.glide.progress
|
||||||
|
|
||||||
typealias OnProgressListener = ((isComplete: Boolean, percentage: Int, bytesRead: Long, totalBytes: Long) -> Unit)?
|
typealias OnProgressListener = (isComplete: Boolean, percentage: Int, bytesRead: Long, totalBytes: Long) -> Unit
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ object ProgressManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addListener(url: String, listener: OnProgressListener) {
|
fun addListener(url: String, listener: OnProgressListener) {
|
||||||
if (url.isNotEmpty() && listener != null) {
|
if (url.isNotEmpty()) {
|
||||||
val url = getUrlNoOption(url)
|
val url = getUrlNoOption(url)
|
||||||
listenersMap[url] = listener
|
listenersMap[url] = listener
|
||||||
listener.invoke(false, 1, 0, 0)
|
listener.invoke(false, 1, 0, 0)
|
||||||
@@ -42,7 +42,7 @@ object ProgressManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getProgressListener(url: String): OnProgressListener {
|
fun getProgressListener(url: String): OnProgressListener? {
|
||||||
return if (url.isEmpty() || listenersMap.isEmpty()) {
|
return if (url.isEmpty() || listenersMap.isEmpty()) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
@@ -53,7 +53,7 @@ object ProgressManager {
|
|||||||
private fun getUrlNoOption(url: String): String {
|
private fun getUrlNoOption(url: String): String {
|
||||||
val urlMatcher = AnalyzeUrl.paramPattern.matcher(url)
|
val urlMatcher = AnalyzeUrl.paramPattern.matcher(url)
|
||||||
return if (urlMatcher.find()) {
|
return if (urlMatcher.find()) {
|
||||||
url.substring(0, urlMatcher.start())
|
url.take(urlMatcher.start())
|
||||||
} else {
|
} else {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user