From f8bda2deda87ce087b1d3e463705aba5b1d71985 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 21:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AD=E6=96=87=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/search/SearchActivity.kt | 14 +++++++------- .../ui/book/source/manage/BookSourceActivity.kt | 10 +++++----- .../legado/app/ui/main/explore/ExploreFragment.kt | 11 ++++++----- .../app/ui/rss/source/manage/RssSourceActivity.kt | 11 +++++------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index 122b9e541..dbabfd209 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -30,7 +30,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.startActivity -import java.text.Collator class SearchActivity : VMBaseActivity(), @@ -245,13 +244,14 @@ class SearchActivity : VMBaseActivity + o1.cnCompare(o2) + }.map { + item = menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) + if (it == selectedGroup) { + item?.isChecked = true } + } menu?.setGroupCheckable(R.id.source_group, true, true) } diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 71d3e4ce4..d82af267a 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -44,7 +44,6 @@ import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.toast import java.io.File -import java.text.Collator class BookSourceActivity : VMBaseActivity(), PopupMenu.OnMenuItemClickListener, @@ -342,10 +341,11 @@ class BookSourceActivity : VMBaseActivity + o1.cnCompare(o2) + }.map { + groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) + } } @SuppressLint("InflateParams") diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt index bc5e4e76b..0967a106e 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt @@ -22,11 +22,11 @@ import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.book.explore.ExploreShowActivity import io.legado.app.ui.book.source.edit.BookSourceEditActivity +import io.legado.app.utils.cnCompare import io.legado.app.utils.getViewModel import io.legado.app.utils.splitNotBlank import io.legado.app.utils.startActivity import io.legado.app.utils.viewbindingdelegate.viewBinding -import java.text.Collator /** * 发现界面 @@ -126,10 +126,11 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_explo private fun upGroupsMenu() { groupsMenu?.let { subMenu -> subMenu.removeGroup(R.id.menu_group_text) - groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE)) - .forEach { - subMenu.add(R.id.menu_group_text, Menu.NONE, Menu.NONE, it) - } + groups.sortedWith { o1, o2 -> + o1.cnCompare(o2) + }.forEach { + subMenu.add(R.id.menu_group_text, Menu.NONE, Menu.NONE, it) + } } } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index 93430ee75..8e3c4f78b 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -40,8 +40,6 @@ import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.toast import java.io.File -import java.text.Collator -import java.util.* class RssSourceActivity : VMBaseActivity(), @@ -197,10 +195,11 @@ class RssSourceActivity : VMBaseActivity + o1.cnCompare(o2) + }.map { + groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) + } } private fun initLiveDataSource(key: String? = null) {