diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index d99518f5c..5ff78d0b7 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -382,7 +382,7 @@ class BookSourceEditActivity : selector(getString(R.string.help), items) { _, index -> when (index) { 0 -> insertText(AppConst.urlOption) - 1 -> openUrl(getString(R.string.source_rule_url)) + 1 -> openUrl("https://alanskycn.gitee.io/teachme/Rule/source.html") 2 -> showRegexHelp() } } diff --git a/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt b/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt index d690a0b74..932ecb952 100644 --- a/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt @@ -22,6 +22,7 @@ import io.legado.app.utils.postEvent import kotlinx.android.synthetic.main.activity_replace_edit.* import org.jetbrains.anko.displayMetrics import org.jetbrains.anko.sdk27.listeners.onClick +import org.jetbrains.anko.selector import org.jetbrains.anko.toast import kotlin.math.abs @@ -64,8 +65,7 @@ class ReplaceEditActivity : upReplaceView(it) } iv_help.onClick { - val mdText = String(assets.open("help/regex.md").readBytes()) - TextDialog.show(supportFragmentManager, mdText, TextDialog.MD) + showRegexHelp() } } @@ -128,13 +128,31 @@ class ReplaceEditActivity : override fun sendText(text: String) { if (text == AppConst.keyboardToolChars[0]) { - val view = window?.decorView?.findFocus() - view?.clearFocus() + showHelpDialog() } else { 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() { mSoftKeyboardTool?.let { if (it.isShowing) return diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt index cf21ca604..a1f2119d2 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.lib.theme.ATH import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity import io.legado.app.ui.widget.KeyboardToolPop +import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.* import kotlinx.android.synthetic.main.activity_rss_source_edit.* import org.jetbrains.anko.* @@ -187,12 +188,28 @@ class RssSourceEditActivity : override fun sendText(text: String) { if (text == AppConst.keyboardToolChars[0]) { - insertText(AppConst.urlOption) + showHelpDialog() } else { 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() { mSoftKeyboardTool?.let { if (it.isShowing) return