feat: 优化代码

pull/182/head
kunfei 5 years ago
parent ac19392725
commit 06fcfc94b6
  1. 2
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 14
      app/src/main/java/io/legado/app/data/entities/RssSource.kt

@ -169,7 +169,7 @@ data class BookSource(
} }
} }
val b = a.split("(&&|\n)+".toRegex()) val b = a.split("(&&|\n)+".toRegex())
b.map { c -> b.forEach { c ->
val d = c.split("::") val d = c.split("::")
if (d.size > 1) if (d.size > 1)
exploreKinds.add(ExploreKind(d[0], d[1])) exploreKinds.add(ExploreKind(d[0], d[1]))

@ -100,4 +100,18 @@ data class RssSource(
return a == b || (a.isNullOrEmpty() && b.isNullOrEmpty()) return a == b || (a.isNullOrEmpty() && b.isNullOrEmpty())
} }
fun sortUrls(): LinkedHashMap<String, String> {
val sortMap = linkedMapOf<String, String>()
val sortUrl = sortUrl
if (sortUrl.isNullOrEmpty()) {
sortMap["default"] = sourceUrl
} else {
sortUrl.split("(&&|\n)+".toRegex()).forEach { c ->
val d = c.split("::")
if (d.size > 1)
sortMap[d[0]] = d[1]
}
}
return sortMap
}
} }
Loading…
Cancel
Save