feat: 优化代码

pull/115/head
kunfei 5 years ago
parent e2463037a4
commit fc319e606d
  1. 15
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  2. 2
      app/src/main/res/menu/read_book.xml
  3. 4
      app/src/main/res/menu/txt_toc_regex.xml
  4. 2
      app/src/main/res/values/strings.xml

@ -3,14 +3,19 @@ package io.legado.app.ui.book.read.config
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.Theme
import io.legado.app.utils.applyTint
import kotlinx.android.synthetic.main.dialog_toc_regex.*
class TocRegexDialog : BaseDialogFragment() {
class TocRegexDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
companion object {
fun show(fragmentManager: FragmentManager, tocRegex: String? = null) {
@ -39,6 +44,14 @@ class TocRegexDialog : BaseDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
tool_bar.setTitle(R.string.txt_toc_regex)
tool_bar.inflateMenu(R.menu.txt_toc_regex)
tool_bar.menu.applyTint(requireContext(), Theme.getTheme())
tool_bar.setOnMenuItemClickListener(this)
}
override fun onMenuItemClick(item: MenuItem?): Boolean {
return false
}
}

@ -43,7 +43,7 @@
<item
android:id="@+id/menu_toc_regex"
android:icon="@drawable/ic_exchange"
android:title="@string/txt_chapter_regex"
android:title="@string/txt_toc_regex"
android:visible="false"
app:showAsAction="always" />
</group>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<menu>
</menu>

@ -334,7 +334,7 @@
<string name="pt_show_all_find">显示所有发现</string>
<string name="ps_show_all_find">关闭则只显示勾选源的发现</string>
<string name="update_toc">更新目录</string>
<string name="txt_chapter_regex">txt目录正则</string>
<string name="txt_toc_regex">Txt目录正则</string>
<string name="set_charset">设置编码</string>
<string name="swap_sort">倒序-顺序</string>
<string name="sort">排序</string>

Loading…
Cancel
Save