Horis 1 год назад
Родитель
Сommit
4eeebdffc5

+ 6 - 3
app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt

@@ -27,7 +27,8 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
 import kotlin.coroutines.resume
 import kotlin.coroutines.resume
 import kotlin.coroutines.suspendCoroutine
 import kotlin.coroutines.suspendCoroutine
 
 
-abstract class BaseImportBookActivity<VM : ViewModel> : VMBaseActivity<ActivityImportBookBinding, VM>() {
+abstract class BaseImportBookActivity<VM : ViewModel> :
+    VMBaseActivity<ActivityImportBookBinding, VM>() {
 
 
     final override val binding by viewBinding(ActivityImportBookBinding::inflate)
     final override val binding by viewBinding(ActivityImportBookBinding::inflate)
 
 
@@ -52,8 +53,10 @@ abstract class BaseImportBookActivity<VM : ViewModel> : VMBaseActivity<ActivityI
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 3
app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageActivity.kt

@@ -6,7 +6,6 @@ import android.view.Menu
 import android.view.MenuItem
 import android.view.MenuItem
 import android.view.MotionEvent
 import android.view.MotionEvent
 import android.widget.CheckBox
 import android.widget.CheckBox
-import android.widget.EditText
 import android.widget.LinearLayout
 import android.widget.LinearLayout
 import androidx.activity.viewModels
 import androidx.activity.viewModels
 import androidx.appcompat.widget.PopupMenu
 import androidx.appcompat.widget.PopupMenu
@@ -124,8 +123,10 @@ class BookshelfManageActivity :
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 2
app/src/main/java/io/legado/app/ui/book/searchContent/SearchContentActivity.kt

@@ -105,8 +105,10 @@ class SearchContentActivity :
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 2
app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@@ -163,8 +163,10 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 2
app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@@ -119,8 +119,10 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 2
app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt

@@ -131,8 +131,10 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }

+ 17 - 3
app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@@ -121,8 +121,10 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
         if (ev.action == MotionEvent.ACTION_DOWN) {
         if (ev.action == MotionEvent.ACTION_DOWN) {
             currentFocus?.let {
             currentFocus?.let {
                 if (it.shouldHideSoftInput(ev)) {
                 if (it.shouldHideSoftInput(ev)) {
-                    it.clearFocus()
-                    it.hideSoftInput()
+                    it.post {
+                        it.clearFocus()
+                        it.hideSoftInput()
+                    }
                 }
                 }
             }
             }
         }
         }
@@ -147,6 +149,7 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
                 mode = HandleFileContract.FILE
                 mode = HandleFileContract.FILE
                 allowExtensions = arrayOf("txt", "json")
                 allowExtensions = arrayOf("txt", "json")
             }
             }
+
             R.id.menu_import_onLine -> showImportDialog()
             R.id.menu_import_onLine -> showImportDialog()
             R.id.menu_import_qr -> qrCodeResult.launch()
             R.id.menu_import_qr -> qrCodeResult.launch()
             R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>()
             R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>()
@@ -154,15 +157,19 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
             R.id.menu_enabled_group -> {
             R.id.menu_enabled_group -> {
                 searchView.setQuery(getString(R.string.enabled), true)
                 searchView.setQuery(getString(R.string.enabled), true)
             }
             }
+
             R.id.menu_disabled_group -> {
             R.id.menu_disabled_group -> {
                 searchView.setQuery(getString(R.string.disabled), true)
                 searchView.setQuery(getString(R.string.disabled), true)
             }
             }
+
             R.id.menu_group_login -> {
             R.id.menu_group_login -> {
                 searchView.setQuery(getString(R.string.need_login), true)
                 searchView.setQuery(getString(R.string.need_login), true)
             }
             }
+
             R.id.menu_group_null -> {
             R.id.menu_group_null -> {
                 searchView.setQuery(getString(R.string.no_group), true)
                 searchView.setQuery(getString(R.string.no_group), true)
             }
             }
+
             R.id.menu_help -> showHelp("SourceMRssHelp")
             R.id.menu_help -> showHelp("SourceMRssHelp")
             else -> if (item.groupId == R.id.source_group) {
             else -> if (item.groupId == R.id.source_group) {
                 searchView.setQuery("group:${item.title}", true)
                 searchView.setQuery("group:${item.title}", true)
@@ -182,13 +189,16 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
             R.id.menu_export_selection -> viewModel.saveToFile(adapter.selection) { file ->
             R.id.menu_export_selection -> viewModel.saveToFile(adapter.selection) { file ->
                 exportResult.launch {
                 exportResult.launch {
                     mode = HandleFileContract.EXPORT
                     mode = HandleFileContract.EXPORT
-                    fileData = HandleFileContract.FileData("exportRssSource.json", file, "application/json")
+                    fileData = HandleFileContract.FileData(
+                        "exportRssSource.json", file, "application/json"
+                    )
                 }
                 }
             }
             }
 
 
             R.id.menu_share_source -> viewModel.saveToFile(adapter.selection) {
             R.id.menu_share_source -> viewModel.saveToFile(adapter.selection) {
                 share(it)
                 share(it)
             }
             }
+
             R.id.menu_check_selected_interval -> adapter.checkSelectedInterval()
             R.id.menu_check_selected_interval -> adapter.checkSelectedInterval()
         }
         }
         return true
         return true
@@ -330,16 +340,20 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
                 searchKey == getString(R.string.disabled) -> {
                 searchKey == getString(R.string.disabled) -> {
                     appDb.rssSourceDao.flowDisabled()
                     appDb.rssSourceDao.flowDisabled()
                 }
                 }
+
                 searchKey == getString(R.string.need_login) -> {
                 searchKey == getString(R.string.need_login) -> {
                     appDb.rssSourceDao.flowLogin()
                     appDb.rssSourceDao.flowLogin()
                 }
                 }
+
                 searchKey == getString(R.string.no_group) -> {
                 searchKey == getString(R.string.no_group) -> {
                     appDb.rssSourceDao.flowNoGroup()
                     appDb.rssSourceDao.flowNoGroup()
                 }
                 }
+
                 searchKey.startsWith("group:") -> {
                 searchKey.startsWith("group:") -> {
                     val key = searchKey.substringAfter("group:")
                     val key = searchKey.substringAfter("group:")
                     appDb.rssSourceDao.flowGroupSearch(key)
                     appDb.rssSourceDao.flowGroupSearch(key)
                 }
                 }
+
                 else -> {
                 else -> {
                     appDb.rssSourceDao.flowSearch(searchKey)
                     appDb.rssSourceDao.flowSearch(searchKey)
                 }
                 }