feat: 优化代码

pull/192/head
kunfei 5 years ago
parent 4f3d71100c
commit 8ddda38c75
  1. 3
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt
  2. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt

@ -16,7 +16,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.jetbrains.anko.toast
import java.io.File
import java.net.URLEncoder
class BookSourceViewModel(application: Application) : BaseViewModel(application) {
@ -228,7 +227,7 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application)
}
private fun importSourceUrl(url: String): Int {
HttpHelper.simpleGet(url)?.let { body ->
HttpHelper.simpleGet(url, "UTF-8")?.let { body ->
val bookSources = mutableListOf<BookSource>()
val items: List<Map<String, Any>> = jsonPath.parse(body).read("$")
for (item in items) {

@ -204,7 +204,7 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application)
}
private fun importSourceUrl(url: String): Int {
HttpHelper.simpleGet(url)?.let { body ->
HttpHelper.simpleGet(url, "UTF-8")?.let { body ->
val sources = mutableListOf<RssSource>()
val items: List<Map<String, Any>> = jsonPath.parse(body).read("$")
for (item in items) {

Loading…
Cancel
Save