Merge pull request #1861 from Xwite/master

fix:书源校验打开校验设置闪屏bug
pull/1866/head
kunfei 3 years ago committed by GitHub
commit d9efe8b8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -5,6 +5,8 @@ import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.SubMenu import android.view.SubMenu
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
@ -357,7 +359,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
private fun checkSource() { private fun checkSource() {
alert(titleResource = R.string.search_book_key) { val dialog = alert(titleResource = R.string.search_book_key) {
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
editView.hint = "search word" editView.hint = "search word"
editView.setText(CheckSource.keyword) editView.setText(CheckSource.keyword)
@ -375,12 +377,17 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
Debug.isChecking = firstItem >= 0 && lastItem >= 0 Debug.isChecking = firstItem >= 0 && lastItem >= 0
checkMessageRefreshJob(firstItem, lastItem).start() checkMessageRefreshJob(firstItem, lastItem).start()
} }
neutralButton(R.string.check_source_config) { neutralButton(R.string.check_source_config, null)
checkSource()
showDialogFragment<CheckSourceConfig>()
}
cancelButton() cancelButton()
} }
//手动设置监听 避免点击打开校验设置后对话框关闭
dialog.getButton(AlertDialog.BUTTON_NEUTRAL)?.let {
it.setOnClickListener(object: View.OnClickListener {
override fun onClick(view: View) {
showDialogFragment<CheckSourceConfig>()
}
})
}
} }
@SuppressLint("InflateParams") @SuppressLint("InflateParams")

Loading…
Cancel
Save