pull/1395/head
gedoor 3 years ago
parent 028d496b30
commit ce76bf5d81
  1. 13
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  2. 8
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt
  3. 8
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  4. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  5. 3
      app/src/main/java/io/legado/app/ui/widget/dialog/CodeDialog.kt
  6. 17
      app/src/main/res/layout/dialog_code_view.xml
  7. 35
      app/src/main/res/layout/item_source_import.xml
  8. 1
      app/src/main/res/values-es-rES/strings.xml
  9. 1
      app/src/main/res/values-ja-rJP/strings.xml
  10. 1
      app/src/main/res/values-pt-rBR/strings.xml
  11. 1
      app/src/main/res/values-zh-rHK/strings.xml
  12. 1
      app/src/main/res/values-zh-rTW/strings.xml
  13. 1
      app/src/main/res/values-zh/strings.xml
  14. 1
      app/src/main/res/values/strings.xml

@ -212,23 +212,22 @@ class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_vie
else -> "已有" else -> "已有"
} }
} }
} }
override fun registerListener(holder: ItemViewHolder, binding: ItemSourceImportBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemSourceImportBinding) {
binding.apply { binding.apply {
root.onClick {
cbSourceName.isChecked = !cbSourceName.isChecked
viewModel.selectStatus[holder.layoutPosition] = cbSourceName.isChecked
upSelectText()
}
cbSourceName.setOnCheckedChangeListener { buttonView, isChecked -> cbSourceName.setOnCheckedChangeListener { buttonView, isChecked ->
if (buttonView.isPressed) { if (buttonView.isPressed) {
viewModel.selectStatus[holder.layoutPosition] = isChecked viewModel.selectStatus[holder.layoutPosition] = isChecked
upSelectText() upSelectText()
} }
} }
tvSee.setOnClickListener { root.onClick {
cbSourceName.isChecked = !cbSourceName.isChecked
viewModel.selectStatus[holder.layoutPosition] = cbSourceName.isChecked
upSelectText()
}
tvOpen.setOnClickListener {
val source = viewModel.allSources[holder.layoutPosition] val source = viewModel.allSources[holder.layoutPosition]
showDialogFragment(CodeDialog(GSON.toJson(source))) showDialogFragment(CodeDialog(GSON.toJson(source)))
} }

@ -27,6 +27,7 @@ import io.legado.app.ui.widget.dialog.CodeDialog
import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.* import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onClick
class ImportReplaceRuleDialog() : BaseDialogFragment(R.layout.dialog_recycler_view), class ImportReplaceRuleDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener { Toolbar.OnMenuItemClickListener {
@ -216,7 +217,12 @@ class ImportReplaceRuleDialog() : BaseDialogFragment(R.layout.dialog_recycler_vi
upSelectText() upSelectText()
} }
} }
tvSee.setOnClickListener { root.onClick {
cbSourceName.isChecked = !cbSourceName.isChecked
viewModel.selectStatus[holder.layoutPosition] = cbSourceName.isChecked
upSelectText()
}
tvOpen.setOnClickListener {
val source = viewModel.allRules[holder.layoutPosition] val source = viewModel.allRules[holder.layoutPosition]
showDialogFragment(CodeDialog(GSON.toJson(source))) showDialogFragment(CodeDialog(GSON.toJson(source)))
} }

@ -28,6 +28,7 @@ import io.legado.app.ui.widget.dialog.CodeDialog
import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.* import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onClick
/** /**
* 导入rss源弹出窗口 * 导入rss源弹出窗口
@ -219,7 +220,12 @@ class ImportRssSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_view
upSelectText() upSelectText()
} }
} }
tvSee.setOnClickListener { root.onClick {
cbSourceName.isChecked = !cbSourceName.isChecked
viewModel.selectStatus[holder.layoutPosition] = cbSourceName.isChecked
upSelectText()
}
tvOpen.setOnClickListener {
val source = viewModel.allSources[holder.layoutPosition] val source = viewModel.allSources[holder.layoutPosition]
showDialogFragment(CodeDialog(GSON.toJson(source))) showDialogFragment(CodeDialog(GSON.toJson(source)))
} }

@ -319,7 +319,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
override fun onPageFinished(view: WebView?, url: String?) { override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url) super.onPageFinished(view, url)
view?.title?.let { title -> view?.title?.let { title ->
if (title != url && title != view.url && title.isNotBlank()) { if (title != url && title != view.url && title.isNotBlank() && url != "about:blank") {
binding.titleBar.title = title binding.titleBar.title = title
} else { } else {
binding.titleBar.title = intent.getStringExtra("title") binding.titleBar.title = intent.getStringExtra("title")

@ -5,6 +5,7 @@ import android.view.View
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogCodeViewBinding import io.legado.app.databinding.DialogCodeViewBinding
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.code.addJsPattern import io.legado.app.ui.widget.code.addJsPattern
import io.legado.app.ui.widget.code.addJsonPattern import io.legado.app.ui.widget.code.addJsonPattern
import io.legado.app.ui.widget.code.addLegadoPattern import io.legado.app.ui.widget.code.addLegadoPattern
@ -15,6 +16,7 @@ class CodeDialog() : BaseDialogFragment(R.layout.dialog_code_view) {
constructor(code: String) : this() { constructor(code: String) : this() {
arguments = Bundle().apply { arguments = Bundle().apply {
putString("code", code) putString("code", code)
} }
} }
@ -27,6 +29,7 @@ class CodeDialog() : BaseDialogFragment(R.layout.dialog_code_view) {
} }
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.codeView.addLegadoPattern() binding.codeView.addLegadoPattern()
binding.codeView.addJsonPattern() binding.codeView.addJsonPattern()
binding.codeView.addJsPattern() binding.codeView.addJsPattern()

@ -1,8 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/background"> xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/background"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/actionBarStyle"
app:title="code edit"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextAppearance="@style/ToolbarTitle" />
<io.legado.app.ui.widget.code.CodeView <io.legado.app.ui.widget.code.CodeView
android:id="@+id/code_view" android:id="@+id/code_view"
@ -11,6 +22,6 @@
android:padding="12dp" android:padding="12dp"
android:textIsSelectable="true" /> android:textIsSelectable="true" />
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>

@ -1,17 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp" android:padding="8dp">
android:gravity="center_vertical"
android:orientation="horizontal">
<io.legado.app.lib.theme.view.ThemeCheckBox <io.legado.app.lib.theme.view.ThemeCheckBox
android:id="@+id/cb_source_name" android:id="@+id/cb_source_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_source_state"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="TouchTargetSizeCheck" /> tools:ignore="TouchTargetSizeCheck" />
<TextView <TextView
@ -19,19 +25,22 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp" android:padding="8dp"
android:textColor="@color/secondaryText" /> android:textColor="@color/secondaryText"
app:layout_constraintBottom_toBottomOf="parent"
<Space app:layout_constraintLeft_toRightOf="@id/cb_source_name"
android:layout_width="0dp" app:layout_constraintRight_toLeftOf="@id/tv_open"
android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent"
android:layout_weight="1" /> app:layout_constraintHorizontal_chainStyle="packed" />
<TextView <TextView
android:id="@+id/tv_see" android:id="@+id/tv_open"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp" android:padding="8dp"
android:text="@string/open"
android:textColor="@color/secondaryText" android:textColor="@color/secondaryText"
android:text="@string/see" /> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -896,5 +896,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -900,5 +900,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -900,5 +900,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -897,5 +897,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -899,5 +899,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -899,5 +899,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

@ -900,5 +900,6 @@
<string name="Open_fan">打开方式</string> <string name="Open_fan">打开方式</string>
<string name="use_browser_open">是否使用外部浏览器打开?</string> <string name="use_browser_open">是否使用外部浏览器打开?</string>
<string name="see">查看</string> <string name="see">查看</string>
<string name="open">打开</string>
</resources> </resources>

Loading…
Cancel
Save