From 09bbad40eda5619e8d34be2ab7d22b47f591efcb Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 28 Jan 2020 22:39:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/info/BookInfoActivity.kt | 4 ++-- .../main/java/io/legado/app/ui/book/search/SearchActivity.kt | 4 ++-- app/src/main/java/io/legado/app/utils/FileUtils.kt | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index fb689519c..57839f1c9 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -98,8 +98,8 @@ class BookInfoActivity : return super.onCompatOptionsItemSelected(item) } - override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean { - menu?.findItem(R.id.menu_can_update)?.isChecked = + override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { + menu.findItem(R.id.menu_can_update)?.isChecked = viewModel.bookData.value?.canUpdate ?: true return super.onMenuOpened(featureId, menu) } 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 ae44ddaad..fb250fb46 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 @@ -76,7 +76,7 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se !getPrefBoolean(PreferKey.precisionSearch) ) precisionSearchMenuItem?.isChecked = getPrefBoolean(PreferKey.precisionSearch) - search_view.query.toString().trim()?.let { + search_view.query?.toString()?.trim()?.let { search_view.setQuery(it, true) } } @@ -88,7 +88,7 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se } else { putPrefString("searchGroup", item.title.toString()) } - search_view.query.toString().trim()?.let { + search_view.query?.toString()?.trim()?.let { search_view.setQuery(it, true) } } diff --git a/app/src/main/java/io/legado/app/utils/FileUtils.kt b/app/src/main/java/io/legado/app/utils/FileUtils.kt index 9ebd26ea0..c6061acb6 100644 --- a/app/src/main/java/io/legado/app/utils/FileUtils.kt +++ b/app/src/main/java/io/legado/app/utils/FileUtils.kt @@ -86,6 +86,7 @@ object FileUtils { val type = split[0] if ("primary".equals(type, ignoreCase = true)) { + @Suppress("DEPRECATION") return Environment.getExternalStorageDirectory().toString() + "/" + split[1] } @@ -135,7 +136,7 @@ object FileUtils { private fun getDataColumn( context: Context, uri: Uri, selection: String?, - selectionArgs: kotlin.Array? + selectionArgs: Array? ): String? { val column = "_data"