From c8e30b5241fbdd2818a7e698e4867887bc877372 Mon Sep 17 00:00:00 2001 From: Kevin SuTJ Date: Fri, 8 Jul 2022 11:01:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Fixed=20the=20problem=20that=20some=20book?= =?UTF-8?q?=20sources=20were=20not=20edited,=20but=20the=20prompt=20"?= =?UTF-8?q?=E5=B0=9A=E6=9C=AA=E4=BF=9D=E5=AD=98=EF=BC=8C=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E7=BC=96=E8=BE=91"=20is=20displayed=20when?= =?UTF-8?q?=20exiting.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index acc770fff..00534394e 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -377,7 +377,7 @@ class BookSourceEditActivity : } infoEntities.forEach { when (it.key) { - "init" -> bookInfoRule.init = it.value ?: "" + "init" -> bookInfoRule.init = it.value "name" -> bookInfoRule.name = viewModel.ruleComplete(it.value, bookInfoRule.init) "author" -> bookInfoRule.author = viewModel.ruleComplete(it.value, bookInfoRule.init) From fdd0990afea805044b746fbde2ea93eb45be47d3 Mon Sep 17 00:00:00 2001 From: Kevin SuTJ Date: Fri, 8 Jul 2022 15:55:38 +0800 Subject: [PATCH 2/2] clean code; clean unused import --- .../legado/app/ui/association/ImportOnLineBookFileDialog.kt | 2 +- .../app/ui/association/ImportOnLineBookFileViewModel.kt | 6 ++---- .../java/io/legado/app/ui/book/info/BookInfoViewModel.kt | 1 - .../src/main/java/me/ag2s/umdlib/domain/UmdChapters.java | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileDialog.kt b/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileDialog.kt index 5e9cfa07f..5e1d954f3 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileDialog.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileDialog.kt @@ -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) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileViewModel.kt index d601cd20e..4054e0fbd 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportOnLineBookFileViewModel.kt @@ -3,19 +3,17 @@ package io.legado.app.ui.association import android.app.Application import android.net.Uri import androidx.lifecycle.MutableLiveData -import io.legado.app.R import io.legado.app.base.BaseViewModel import io.legado.app.constant.AppPattern -import io.legado.app.constant.AppLog import io.legado.app.constant.EventBus import io.legado.app.data.appDb -import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource import io.legado.app.exception.NoStackTraceException import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl 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) { diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index b60fbfa43..a7df33ffe 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -2,7 +2,6 @@ package io.legado.app.ui.book.info import android.app.Application import android.content.Intent -import android.net.Uri import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import io.legado.app.R diff --git a/epublib/src/main/java/me/ag2s/umdlib/domain/UmdChapters.java b/epublib/src/main/java/me/ag2s/umdlib/domain/UmdChapters.java index e0fb5691c..48cae1583 100644 --- a/epublib/src/main/java/me/ag2s/umdlib/domain/UmdChapters.java +++ b/epublib/src/main/java/me/ag2s/umdlib/domain/UmdChapters.java @@ -125,7 +125,7 @@ public class UmdChapters { int left = 0; int chunkCnt = 0; ByteArrayOutputStream bos = new ByteArrayOutputStream(DEFAULT_CHUNK_INIT_SIZE + 256); - List chunkRbList = new ArrayList(); + List chunkRbList = new ArrayList<>(); while(startPos < allContents.length) { left = allContents.length - startPos;