edit ReplaceRuleActivity.kt

pull/840/head
gedoor 4 years ago
parent 18716db3fd
commit c60022da56
  1. 6
      app/src/main/assets/help/replaceRuleHelp.md
  2. 7
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  3. 6
      app/src/main/res/menu/replace_rule.xml

@ -0,0 +1,6 @@
# 替换管理界面帮助
* 替换规则是用来替换正文内容的一种规则
* 菜单可以新建和导入规则
* 可以拖动排序
* 可以选择操作

@ -32,6 +32,7 @@ import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.qrcode.QrCodeActivity
import io.legado.app.ui.replace.edit.ReplaceEditActivity
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.ui.widget.recycler.VerticalDivider
@ -190,6 +191,7 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
R.id.menu_import_source_local -> FilePicker
.selectFile(this, importRequestCode, allowExtensions = arrayOf("txt", "json"))
R.id.menu_import_source_qr -> startActivityForResult<QrCodeActivity>(importRequestCodeQr)
R.id.menu_help -> showHelp()
else -> if (item.groupId == R.id.replace_group) {
searchView.setQuery("group:${item.title}", true)
}
@ -243,6 +245,11 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
}.show()
}
private fun showHelp() {
val text = String(assets.open("help/replaceRuleHelp.md").readBytes())
TextDialog.show(supportFragmentManager, text, TextDialog.MD)
}
override fun onQueryTextChange(newText: String?): Boolean {
observeReplaceRuleData(newText)
return false

@ -48,4 +48,10 @@
android:title="@string/import_by_qr_code"
app:showAsAction="never" />
<item
android:id="@+id/menu_help"
android:icon="@drawable/ic_help"
android:title="@string/help"
app:showAsAction="never" />
</menu>

Loading…
Cancel
Save