TXT 目录正则页面增加标题示例

pull/2130/head
fisher 2 years ago
parent 23f19c0484
commit aea19ae6fe
  1. 2
      app/src/main/java/io/legado/app/data/DatabaseMigrations.kt
  2. 2
      app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleActivity.kt
  4. 1
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleAdapter.kt
  5. 13
      app/src/main/res/layout/dialog_toc_regex_edit.xml
  6. 14
      app/src/main/res/layout/item_txt_toc_rule.xml
  7. 1
      app/src/main/res/values-es-rES/strings.xml
  8. 1
      app/src/main/res/values-ja-rJP/strings.xml
  9. 1
      app/src/main/res/values-pt-rBR/strings.xml
  10. 1
      app/src/main/res/values-zh-rHK/strings.xml
  11. 1
      app/src/main/res/values-zh-rTW/strings.xml
  12. 1
      app/src/main/res/values-zh/strings.xml
  13. 1
      app/src/main/res/values/strings.xml

@ -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) {

@ -34,4 +34,17 @@
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/example">
<io.legado.app.lib.theme.view.ThemeEditText
android:id="@+id/tv_rule_example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>
</LinearLayout>

@ -5,9 +5,13 @@
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<io.legado.app.lib.theme.view.ThemeCheckBox
android:id="@+id/cb_source"
android:layout_width="0dp"
@ -48,4 +52,12 @@
android:tint="@color/primaryText"
tools:ignore="RtlHardcoded" />
</LinearLayout>
<TextView
android:id="@+id/title_example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>

@ -1006,4 +1006,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example">Ejemplo</string>
</resources>

@ -1009,4 +1009,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example"></string>
</resources>

@ -1009,4 +1009,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example">Exemplo</string>
</resources>

@ -1006,4 +1006,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example">示例</string>
</resources>

@ -1008,4 +1008,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example">示例</string>
</resources>

@ -1008,4 +1008,5 @@
<string name="page_touch_slop_title">滑动翻页阈值</string>
<string name="page_touch_slop_dialog_title">滑动翻页阈值(0 = 系统默认值)</string>
<string name="page_touch_slop_summary">滑动多长距离才会触发滑动翻页(系统默认值 %s px)</string>
<string name="example">示例</string>
</resources>

@ -660,6 +660,7 @@
<string name="import_default_rule">Import default rules</string>
<string name="name">Name</string>
<string name="regex">Regex</string>
<string name="example">Example</string>
<string name="more_menu">More menu</string>
<string name="reduce">Minus</string>
<string name="plus">Plus</string>

Loading…
Cancel
Save