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. 90
      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,47 +5,59 @@
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:orientation="vertical"
android:padding="16dp">
<io.legado.app.lib.theme.view.ThemeCheckBox
android:id="@+id/cb_source"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:textColor="@color/primaryText"
tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
<io.legado.app.lib.theme.view.ThemeSwitch
android:id="@+id/swt_enabled"
android:name="@string/enable"
android:layout_width="wrap_content"
<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"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:textColor="@color/primaryText"
tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
<io.legado.app.lib.theme.view.ThemeSwitch
android:id="@+id/swt_enabled"
android:name="@string/enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
tools:ignore="RtlSymmetry,TouchTargetSizeCheck" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_edit"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/edit"
android:padding="6dp"
android:src="@drawable/ic_edit"
android:tint="@color/primaryText" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="6dp"
android:src="@drawable/ic_more_vert"
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:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
tools:ignore="RtlSymmetry,TouchTargetSizeCheck" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_edit"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/edit"
android:padding="6dp"
android:src="@drawable/ic_edit"
android:tint="@color/primaryText" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="6dp"
android:src="@drawable/ic_more_vert"
android:tint="@color/primaryText"
tools:ignore="RtlHardcoded" />
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