pull/473/head
gedoor 4 years ago
parent dd57f397e0
commit b85da46162
  1. 0
      app/src/main/assets/help/bookSource.md
  2. 0
      app/src/main/assets/help/rssSource.md
  3. 2
      app/src/main/java/io/legado/app/constant/AppConst.kt
  4. 26
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  5. 6
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -38,7 +38,7 @@ object AppConst {
val keyboardToolChars: List<String> by lazy {
arrayListOf(
"", "@", "&", "|", "%", "/", ":", "[", "]", "{", "}", "<", ">", "\\",
"", "@", "&", "|", "%", "/", ":", "[", "]", "{", "}", "<", ">", "\\",
"$", "#", "!", ".", "href", "src", "textNodes", "xpath", "json", "css",
"id", "class", "tag"
)

@ -25,6 +25,7 @@ import io.legado.app.ui.book.source.debug.BookSourceDebugActivity
import io.legado.app.ui.login.SourceLogin
import io.legado.app.ui.qrcode.QrCodeActivity
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_book_source_edit.*
import org.jetbrains.anko.*
@ -63,7 +64,7 @@ class BookSourceEditActivity :
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_save -> getSource().let { source ->
if (!source.equal(viewModel.bookSource ?: BookSource())){
if (!source.equal(viewModel.bookSource ?: BookSource())) {
source.lastUpdateTime = System.currentTimeMillis()
}
if (checkSource(source)) {
@ -81,7 +82,10 @@ class BookSourceEditActivity :
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }
R.id.menu_qr_code_camera -> startActivityForResult<QrCodeActivity>(qrRequestCode)
R.id.menu_share_str -> share(GSON.toJson(getSource()))
R.id.menu_share_qr -> shareWithQr(getString(R.string.share_book_source), GSON.toJson(getSource()))
R.id.menu_share_qr -> shareWithQr(
getString(R.string.share_book_source),
GSON.toJson(getSource())
)
R.id.menu_rule_summary -> {
try {
val intent = Intent(Intent.ACTION_VIEW)
@ -367,12 +371,28 @@ class BookSourceEditActivity :
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(getString(R.string.source_rule_url))
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

@ -403,10 +403,8 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
}
}
observeEvent<Int>(EventBus.CHECK_SOURCE_DONE) {
snackBar?.let {
it.dismiss()
snackBar = null
}
snackBar?.dismiss()
snackBar = null
groups.map { group ->
if (group.contains("失效")) {
search_view.setQuery("失效", true)

Loading…
Cancel
Save