添加单章换源

pull/1649/head
kunfei 3 years ago
parent 533f8554aa
commit e3038daee1
  1. 8
      app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt
  2. 8
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  3. 8
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  4. 18
      app/src/main/res/menu/book_read.xml
  5. 2
      app/src/main/res/values-es-rES/strings.xml
  6. 2
      app/src/main/res/values-ja-rJP/strings.xml
  7. 2
      app/src/main/res/values-pt-rBR/strings.xml
  8. 2
      app/src/main/res/values-zh-rHK/strings.xml
  9. 2
      app/src/main/res/values-zh-rTW/strings.xml
  10. 2
      app/src/main/res/values-zh/strings.xml
  11. 6
      app/src/main/res/values/strings.xml

@ -61,7 +61,7 @@ class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
override fun observeLiveBus() {
super.observeLiveBus()
viewModel.searchStateData.observe(viewLifecycleOwner, {
viewModel.searchStateData.observe(viewLifecycleOwner) {
binding.refreshProgressBar.isAutoLoading = it
if (it) {
startStopMenuItem?.let { item ->
@ -75,10 +75,10 @@ class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
}
}
binding.toolBar.menu.applyTint(requireContext())
})
viewModel.searchBooksLiveData.observe(viewLifecycleOwner, {
}
viewModel.searchBooksLiveData.observe(viewLifecycleOwner) {
adapter.setItems(it)
})
}
}
override fun onMenuItemClick(item: MenuItem?): Boolean {

@ -128,7 +128,7 @@ class ChangeSourceDialog() : BaseDialogFragment(R.layout.dialog_change_source),
}
private fun initLiveData() {
viewModel.searchStateData.observe(viewLifecycleOwner, {
viewModel.searchStateData.observe(viewLifecycleOwner) {
binding.refreshProgressBar.isAutoLoading = it
if (it) {
startStopMenuItem?.let { item ->
@ -142,10 +142,10 @@ class ChangeSourceDialog() : BaseDialogFragment(R.layout.dialog_change_source),
}
}
binding.toolBar.menu.applyTint(requireContext())
})
viewModel.searchBooksLiveData.observe(viewLifecycleOwner, {
}
viewModel.searchBooksLiveData.observe(viewLifecycleOwner) {
adapter.setItems(it)
})
}
launch {
appDb.bookSourceDao.flowGroupEnabled().collect {
groups.clear()

@ -236,7 +236,13 @@ class ReadBookActivity : BaseReadBookActivity(),
*/
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_change_source -> {
R.id.menu_book_change_source -> {
binding.readMenu.runMenuOut()
ReadBook.book?.let {
showDialogFragment(ChangeSourceDialog(it.name, it.author))
}
}
R.id.menu_chapter_change_source -> {
binding.readMenu.runMenuOut()
ReadBook.book?.let {
showDialogFragment(ChangeSourceDialog(it.name, it.author))

@ -9,7 +9,23 @@
android:id="@+id/menu_change_source"
android:icon="@drawable/ic_exchange"
android:title="@string/change_origin"
app:showAsAction="always" />
app:showAsAction="always">
<menu>
<item
android:id="@+id/menu_chapter_change_source"
android:title="@string/chapter_change_source"
app:showAsAction="never" />
<item
android:id="@+id/menu_book_change_source"
android:title="@string/book_change_source"
app:showAsAction="never" />
</menu>
</item>
<item
android:id="@+id/menu_refresh"

@ -939,5 +939,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -942,5 +942,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -942,5 +942,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -939,5 +939,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -941,5 +941,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -941,5 +941,7 @@
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

@ -930,7 +930,7 @@
<string name="seconds"></string>
<string name="less_than">小于</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<string name="record_debug_log">记录调试日志</string>
<string name="record_debug_log">Record debug log</string>
<string name="sub_dir">Sub dir</string>
<string name="general">General</string>
<string name="use_replace">Use replace</string>
@ -941,6 +941,8 @@
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<string name="edit_content">编辑内容</string>
<string name="edit_content">Edit Content</string>
<string name="chapter_change_source">单章换源</string>
<string name="book_change_source">整书换源</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save