pull/473/head
gedoor 4 years ago
parent b85da46162
commit b21c42be82
  1. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  2. 26
      app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt
  3. 19
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt

@ -382,7 +382,7 @@ class BookSourceEditActivity :
selector(getString(R.string.help), items) { _, index -> selector(getString(R.string.help), items) { _, index ->
when (index) { when (index) {
0 -> insertText(AppConst.urlOption) 0 -> insertText(AppConst.urlOption)
1 -> openUrl(getString(R.string.source_rule_url)) 1 -> openUrl("https://alanskycn.gitee.io/teachme/Rule/source.html")
2 -> showRegexHelp() 2 -> showRegexHelp()
} }
} }

@ -22,6 +22,7 @@ import io.legado.app.utils.postEvent
import kotlinx.android.synthetic.main.activity_replace_edit.* import kotlinx.android.synthetic.main.activity_replace_edit.*
import org.jetbrains.anko.displayMetrics import org.jetbrains.anko.displayMetrics
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.selector
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
import kotlin.math.abs import kotlin.math.abs
@ -64,8 +65,7 @@ class ReplaceEditActivity :
upReplaceView(it) upReplaceView(it)
} }
iv_help.onClick { iv_help.onClick {
val mdText = String(assets.open("help/regex.md").readBytes()) showRegexHelp()
TextDialog.show(supportFragmentManager, mdText, TextDialog.MD)
} }
} }
@ -128,13 +128,31 @@ class ReplaceEditActivity :
override fun sendText(text: String) { override fun sendText(text: String) {
if (text == AppConst.keyboardToolChars[0]) { if (text == AppConst.keyboardToolChars[0]) {
val view = window?.decorView?.findFocus() showHelpDialog()
view?.clearFocus()
} else { } else {
insertText(text) insertText(text)
} }
} }
private fun showHelpDialog() {
val items = arrayListOf("替换净化教程", "正则教程")
selector(getString(R.string.help), items) { _, index ->
when (index) {
0 -> showReplaceHelp()
1 -> showRegexHelp()
}
}
}
private fun showReplaceHelp() {
}
private fun showRegexHelp() {
val mdText = String(assets.open("help/regex.md").readBytes())
TextDialog.show(supportFragmentManager, mdText, TextDialog.MD)
}
private fun showKeyboardTopPopupWindow() { private fun showKeyboardTopPopupWindow() {
mSoftKeyboardTool?.let { mSoftKeyboardTool?.let {
if (it.isShowing) return if (it.isShowing) return

@ -20,6 +20,7 @@ import io.legado.app.lib.theme.ATH
import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.qrcode.QrCodeActivity
import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity
import io.legado.app.ui.widget.KeyboardToolPop import io.legado.app.ui.widget.KeyboardToolPop
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_rss_source_edit.* import kotlinx.android.synthetic.main.activity_rss_source_edit.*
import org.jetbrains.anko.* import org.jetbrains.anko.*
@ -187,12 +188,28 @@ class RssSourceEditActivity :
override fun sendText(text: String) { override fun sendText(text: String) {
if (text == AppConst.keyboardToolChars[0]) { if (text == AppConst.keyboardToolChars[0]) {
insertText(AppConst.urlOption) showHelpDialog()
} else { } else {
insertText(text) insertText(text)
} }
} }
private fun showHelpDialog() {
val items = arrayListOf("插入URL参数", "订阅源教程", "正则教程")
selector(getString(R.string.help), items) { _, index ->
when (index) {
0 -> insertText(AppConst.urlOption)
1 -> openUrl("https://alanskycn.gitee.io/teachme/Rule/rss.html")
2 -> showRegexHelp()
}
}
}
private fun showRegexHelp() {
val mdText = String(assets.open("help/regex.md").readBytes())
TextDialog.show(supportFragmentManager, mdText, TextDialog.MD)
}
private fun showKeyboardTopPopupWindow() { private fun showKeyboardTopPopupWindow() {
mSoftKeyboardTool?.let { mSoftKeyboardTool?.let {
if (it.isShowing) return if (it.isShowing) return

Loading…
Cancel
Save