mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
7cee9414ae
commit
ecdc955f81
@ -276,7 +276,8 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
appDb.bookSourceDao.flowSearch(searchKey)
|
||||
}
|
||||
}.conflate().map { data ->
|
||||
if (sortAscending) when (sort) {
|
||||
if (sortAscending) {
|
||||
when (sort) {
|
||||
Sort.Weight -> data.sortedBy { it.weight }
|
||||
Sort.Name -> data.sortedWith { o1, o2 ->
|
||||
o1.bookSourceName.cnCompare(o2.bookSourceName)
|
||||
@ -295,7 +296,8 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
|
||||
else -> data
|
||||
}
|
||||
else when (sort) {
|
||||
} else {
|
||||
when (sort) {
|
||||
Sort.Weight -> data.sortedByDescending { it.weight }
|
||||
Sort.Name -> data.sortedWith { o1, o2 ->
|
||||
o2.bookSourceName.cnCompare(o1.bookSourceName)
|
||||
@ -314,6 +316,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
|
||||
else -> data.reversed()
|
||||
}
|
||||
}
|
||||
}.catch {
|
||||
AppLog.put("书源界面更新书源出错", it)
|
||||
}.conflate().collect { data ->
|
||||
@ -653,11 +656,19 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
}
|
||||
|
||||
override fun toTop(bookSource: BookSourcePart) {
|
||||
if (sortAscending) {
|
||||
viewModel.topSource(bookSource)
|
||||
} else {
|
||||
viewModel.bottomSource(bookSource)
|
||||
}
|
||||
}
|
||||
|
||||
override fun toBottom(bookSource: BookSourcePart) {
|
||||
if (sortAscending) {
|
||||
viewModel.bottomSource(bookSource)
|
||||
} else {
|
||||
viewModel.topSource(bookSource)
|
||||
}
|
||||
}
|
||||
|
||||
override fun searchBook(bookSource: BookSourcePart) {
|
||||
|
@ -39,11 +39,6 @@ object RhinoClassShutter : ClassShutter {
|
||||
private val protectedClasses by lazy {
|
||||
hashSetOf(
|
||||
"dalvik.system",
|
||||
"java.lang.Class",
|
||||
"java.lang.ClassLoader",
|
||||
"java.net.URLClassLoader",
|
||||
"cn.hutool.core.lang.JarClassLoader",
|
||||
"org.mozilla.javascript.DefiningClassLoader",
|
||||
"java.lang.Runtime",
|
||||
"java.io.File",
|
||||
"java.security.AccessController",
|
||||
|
Loading…
Reference in New Issue
Block a user