TXT 目录正则页面增加标题示例
This commit is contained in:
@@ -48,7 +48,7 @@ object DatabaseMigrations {
|
||||
database.execSQL("DROP TABLE txtTocRules")
|
||||
database.execSQL(
|
||||
"""CREATE TABLE txtTocRules(id INTEGER NOT NULL,
|
||||
name TEXT NOT NULL, rule TEXT NOT NULL, serialNumber INTEGER NOT NULL,
|
||||
name TEXT NOT NULL, rule TEXT NOT NULL,example TEXT DEFAULT NULL, serialNumber INTEGER NOT NULL,
|
||||
enable INTEGER NOT NULL, PRIMARY KEY (id))"""
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ data class TxtTocRule(
|
||||
var id: Long = System.currentTimeMillis(),
|
||||
var name: String = "",
|
||||
var rule: String = "",
|
||||
var example: String? = null,
|
||||
var serialNumber: Int = -1,
|
||||
var enable: Boolean = true
|
||||
) {
|
||||
@@ -25,6 +26,7 @@ data class TxtTocRule(
|
||||
return id == other.id
|
||||
&& name == other.name
|
||||
&& rule == other.rule
|
||||
&& example == other.example
|
||||
&& serialNumber == other.serialNumber
|
||||
&& enable == other.enable
|
||||
}
|
||||
|
||||
@@ -97,12 +97,14 @@ class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleV
|
||||
alertBinding.apply {
|
||||
tvRuleName.setText(source.name)
|
||||
tvRuleRegex.setText(source.rule)
|
||||
tvRuleExample.setText(source.example)
|
||||
}
|
||||
customView { alertBinding.root }
|
||||
okButton {
|
||||
alertBinding.apply {
|
||||
source.name = tvRuleName.text.toString()
|
||||
source.rule = tvRuleRegex.text.toString()
|
||||
source.example = tvRuleExample.text.toString()
|
||||
viewModel.save(source)
|
||||
}
|
||||
}
|
||||
@@ -157,7 +159,7 @@ class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleV
|
||||
@SuppressLint("InflateParams")
|
||||
private fun showImportDialog() {
|
||||
val aCache = ACache.get(cacheDir = false)
|
||||
val defaultUrl = "https://gitee.com/fisher52/YueDuJson/raw/master/myTxtChapterRule.json"
|
||||
val defaultUrl = "https://raw.githubusercontent.com/52fisher/YueDuJson/master/myTxtChapterRule.json"
|
||||
val cacheUrls: MutableList<String> = aCache
|
||||
.getAsString(importTocRuleKey)
|
||||
?.splitNotBlank(",")
|
||||
|
||||
@@ -45,6 +45,7 @@ class TxtTocRuleAdapter(context: Context, private val callBack: CallBack) :
|
||||
cbSource.text = item.name
|
||||
swtEnabled.isChecked = item.enable
|
||||
cbSource.isChecked = selected.contains(item)
|
||||
titleExample.text = item.example
|
||||
} else {
|
||||
bundle.keySet().map {
|
||||
when (it) {
|
||||
|
||||
Reference in New Issue
Block a user