Merge pull request #2037 from nEdAy/feature/fixed-edit-book-sources-dialog-error

Fixed the problem that some book sources were not edited, but the prompt "尚未保存,是否继续编辑" is displayed when exiting.
pull/2042/head
kunfei 2 years ago committed by GitHub
commit ccbe744cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileDialog.kt
  2. 6
      app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileViewModel.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  5. 2
      epublib/src/main/java/me/ag2s/umdlib/domain/UmdChapters.java

@ -24,7 +24,7 @@ import io.legado.app.utils.visible
/** /**
* 导入在线书籍文件弹出窗口 * 导入在线书籍文件弹出窗口
*/ */
class ImportOnLineBookFileDialog() : BaseDialogFragment(R.layout.dialog_recycler_view) { class ImportOnLineBookFileDialog : BaseDialogFragment(R.layout.dialog_recycler_view) {
private val binding by viewBinding(DialogRecyclerViewBinding::bind) private val binding by viewBinding(DialogRecyclerViewBinding::bind)

@ -3,19 +3,17 @@ package io.legado.app.ui.association
import android.app.Application import android.app.Application
import android.net.Uri import android.net.Uri
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import io.legado.app.R
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
import io.legado.app.constant.AppLog
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.data.appDb import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.exception.NoStackTraceException import io.legado.app.exception.NoStackTraceException
import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeRule
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.utils.* import io.legado.app.utils.postEvent
import io.legado.app.utils.toastOnUi
class ImportOnLineBookFileViewModel(app: Application) : BaseViewModel(app) { class ImportOnLineBookFileViewModel(app: Application) : BaseViewModel(app) {

@ -2,7 +2,6 @@ package io.legado.app.ui.book.info
import android.app.Application import android.app.Application
import android.content.Intent import android.content.Intent
import android.net.Uri
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import io.legado.app.R import io.legado.app.R

@ -377,7 +377,7 @@ class BookSourceEditActivity :
} }
infoEntities.forEach { infoEntities.forEach {
when (it.key) { when (it.key) {
"init" -> bookInfoRule.init = it.value ?: "" "init" -> bookInfoRule.init = it.value
"name" -> bookInfoRule.name = viewModel.ruleComplete(it.value, bookInfoRule.init) "name" -> bookInfoRule.name = viewModel.ruleComplete(it.value, bookInfoRule.init)
"author" -> bookInfoRule.author = "author" -> bookInfoRule.author =
viewModel.ruleComplete(it.value, bookInfoRule.init) viewModel.ruleComplete(it.value, bookInfoRule.init)

@ -125,7 +125,7 @@ public class UmdChapters {
int left = 0; int left = 0;
int chunkCnt = 0; int chunkCnt = 0;
ByteArrayOutputStream bos = new ByteArrayOutputStream(DEFAULT_CHUNK_INIT_SIZE + 256); ByteArrayOutputStream bos = new ByteArrayOutputStream(DEFAULT_CHUNK_INIT_SIZE + 256);
List<byte[]> chunkRbList = new ArrayList<byte[]>(); List<byte[]> chunkRbList = new ArrayList<>();
while(startPos < allContents.length) { while(startPos < allContents.length) {
left = allContents.length - startPos; left = allContents.length - startPos;

Loading…
Cancel
Save