pull/1705/head
kunfei 3 years ago
parent 4bf92cd994
commit c837e665df
  1. 5
      app/src/main/assets/updateLog.md
  2. 11
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  3. 13
      app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt
  4. 11
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt

@ -11,6 +11,11 @@
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2022/03/09**
* 添加通用封面规则,在封面设置里,进入详情页会使用此规则重新获取封面
*
**2022/03/07** **2022/03/07**
* 更新cronet: 99.0.4844.58 * 更新cronet: 99.0.4844.58

@ -65,7 +65,9 @@ class BookSourceEditActivity :
} }
} }
private var mSoftKeyboardTool: PopupWindow? = null private val mSoftKeyboardTool: PopupWindow by lazy {
KeyboardToolPop(this, AppConst.keyboardToolChars, this)
}
private var mIsSoftKeyBoardShowing = false private var mIsSoftKeyBoardShowing = false
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
@ -139,7 +141,6 @@ class BookSourceEditActivity :
private fun initView() { private fun initView() {
binding.recyclerView.setEdgeEffectColor(primaryColor) binding.recyclerView.setEdgeEffectColor(primaryColor)
mSoftKeyboardTool = KeyboardToolPop(this, AppConst.keyboardToolChars, this)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener()) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener())
binding.recyclerView.layoutManager = LinearLayoutManager(this) binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = adapter binding.recyclerView.adapter = adapter
@ -176,7 +177,7 @@ class BookSourceEditActivity :
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
mSoftKeyboardTool?.dismiss() mSoftKeyboardTool.dismiss()
} }
private fun setEditEntities(tabPosition: Int?) { private fun setEditEntities(tabPosition: Int?) {
@ -485,7 +486,7 @@ class BookSourceEditActivity :
} }
private fun showKeyboardTopPopupWindow() { private fun showKeyboardTopPopupWindow() {
mSoftKeyboardTool?.let { mSoftKeyboardTool.let {
if (it.isShowing) return if (it.isShowing) return
if (!isFinishing) { if (!isFinishing) {
it.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0) it.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
@ -494,7 +495,7 @@ class BookSourceEditActivity :
} }
private fun closePopupWindow() { private fun closePopupWindow() {
mSoftKeyboardTool?.dismiss() mSoftKeyboardTool.dismiss()
} }
private inner class KeyboardOnGlobalChangeListener : ViewTreeObserver.OnGlobalLayoutListener { private inner class KeyboardOnGlobalChangeListener : ViewTreeObserver.OnGlobalLayoutListener {

@ -55,11 +55,12 @@ class ReplaceEditActivity :
override val binding by viewBinding(ActivityReplaceEditBinding::inflate) override val binding by viewBinding(ActivityReplaceEditBinding::inflate)
override val viewModel by viewModels<ReplaceEditViewModel>() override val viewModel by viewModels<ReplaceEditViewModel>()
private var mSoftKeyboardTool: PopupWindow? = null private val mSoftKeyboardTool: PopupWindow by lazy {
KeyboardToolPop(this, AppConst.keyboardToolChars, this)
}
private var mIsSoftKeyBoardShowing = false private var mIsSoftKeyBoardShowing = false
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
mSoftKeyboardTool = KeyboardToolPop(this, AppConst.keyboardToolChars, this)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this)
viewModel.initData(intent) { viewModel.initData(intent) {
upReplaceView(it) upReplaceView(it)
@ -121,12 +122,12 @@ class ReplaceEditActivity :
if (view is EditText) { if (view is EditText) {
val start = view.selectionStart val start = view.selectionStart
val end = view.selectionEnd val end = view.selectionEnd
//TODO 获取EditText的文字 //获取EditText的文字
val edit = view.editableText val edit = view.editableText
if (start < 0 || start >= edit.length) { if (start < 0 || start >= edit.length) {
edit.append(text) edit.append(text)
} else { } else {
//TODO 光标所在位置插入文字 //光标所在位置插入文字
edit.replace(start, end, text) edit.replace(start, end, text)
} }
} }
@ -155,7 +156,7 @@ class ReplaceEditActivity :
} }
private fun showKeyboardTopPopupWindow() { private fun showKeyboardTopPopupWindow() {
mSoftKeyboardTool?.let { mSoftKeyboardTool.let {
if (it.isShowing) return if (it.isShowing) return
if (!isFinishing) { if (!isFinishing) {
it.showAtLocation(binding.llContent, Gravity.BOTTOM, 0, 0) it.showAtLocation(binding.llContent, Gravity.BOTTOM, 0, 0)
@ -164,7 +165,7 @@ class ReplaceEditActivity :
} }
private fun closePopupWindow() { private fun closePopupWindow() {
mSoftKeyboardTool?.dismiss() mSoftKeyboardTool.dismiss()
} }
override fun onGlobalLayout() { override fun onGlobalLayout() {

@ -36,7 +36,9 @@ class RssSourceEditActivity :
override val binding by viewBinding(ActivityRssSourceEditBinding::inflate) override val binding by viewBinding(ActivityRssSourceEditBinding::inflate)
override val viewModel by viewModels<RssSourceEditViewModel>() override val viewModel by viewModels<RssSourceEditViewModel>()
private var mSoftKeyboardTool: PopupWindow? = null private val mSoftKeyboardTool: PopupWindow by lazy {
KeyboardToolPop(this, AppConst.keyboardToolChars, this)
}
private var mIsSoftKeyBoardShowing = false private var mIsSoftKeyBoardShowing = false
private val adapter by lazy { RssSourceEditAdapter() } private val adapter by lazy { RssSourceEditAdapter() }
private val sourceEntities: ArrayList<EditEntity> = ArrayList() private val sourceEntities: ArrayList<EditEntity> = ArrayList()
@ -79,7 +81,7 @@ class RssSourceEditActivity :
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
mSoftKeyboardTool?.dismiss() mSoftKeyboardTool.dismiss()
} }
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
@ -141,7 +143,6 @@ class RssSourceEditActivity :
private fun initView() { private fun initView() {
binding.recyclerView.setEdgeEffectColor(primaryColor) binding.recyclerView.setEdgeEffectColor(primaryColor)
mSoftKeyboardTool = KeyboardToolPop(this, AppConst.keyboardToolChars, this)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this)
binding.recyclerView.adapter = adapter binding.recyclerView.adapter = adapter
} }
@ -276,7 +277,7 @@ class RssSourceEditActivity :
} }
private fun showKeyboardTopPopupWindow() { private fun showKeyboardTopPopupWindow() {
mSoftKeyboardTool?.let { mSoftKeyboardTool.let {
if (it.isShowing) return if (it.isShowing) return
if (!isFinishing) { if (!isFinishing) {
it.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0) it.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
@ -285,7 +286,7 @@ class RssSourceEditActivity :
} }
private fun closePopupWindow() { private fun closePopupWindow() {
mSoftKeyboardTool?.dismiss() mSoftKeyboardTool.dismiss()
} }
override fun onGlobalLayout() { override fun onGlobalLayout() {

Loading…
Cancel
Save