feat: 优化代码

pull/123/head
kunfei 5 years ago
parent afc99e13d3
commit ae09c555cd
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  3. 2
      app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt

@ -558,8 +558,10 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
* 替换规则变化
*/
override fun onReplaceRuleSave() {
Coroutine.async { BookHelp.upReplaceRules() }
ReadBook.loadContent()
Coroutine.async {
BookHelp.upReplaceRules()
ReadBook.loadContent()
}
}
/**
@ -637,7 +639,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
viewModel.openChapter(index)
}
}
requestCodeReplace -> ReadBook.loadContent()
requestCodeReplace -> onReplaceRuleSave()
}
}
}

@ -95,6 +95,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
onMenuItemSelected(it)
}
}
callBack.onMenuActionFinally()
}
}
}
@ -121,7 +122,6 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
}
}
}
callBack.onMenuActionFinally()
}
@RequiresApi(Build.VERSION_CODES.M)

@ -102,7 +102,7 @@ class ReplaceEditDialog : DialogFragment(),
return replaceRule
}
val callBack = activity as? CallBack
val callBack get() = activity as? CallBack
interface CallBack {
fun onReplaceRuleSave()

Loading…
Cancel
Save