diff --git a/app/build.gradle b/app/build.gradle index 7abfd3409..17e739766 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -131,7 +131,7 @@ resourcePlaceholders { dependencies { //noinspection GradleDependency - coreLibraryDesugaring('com.android.tools:desugar_jdk_libs:1.1.6') + coreLibraryDesugaring('com.android.tools:desugar_jdk_libs:1.2.2') testImplementation('junit:junit:4.13.2') androidTestImplementation('androidx.test:runner:1.4.0') androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0') diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 18e45f5a7..48044fc6e 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,6 +11,10 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2022/09/16** + +* 一些优化 + **2022/09/15** * 更新cronet: 105.0.5195.136 diff --git a/app/src/main/java/io/legado/app/help/AppWebDav.kt b/app/src/main/java/io/legado/app/help/AppWebDav.kt index 3c498c315..2ef0bce5e 100644 --- a/app/src/main/java/io/legado/app/help/AppWebDav.kt +++ b/app/src/main/java/io/legado/app/help/AppWebDav.kt @@ -19,9 +19,11 @@ import io.legado.app.lib.webdav.WebDavException import io.legado.app.lib.webdav.WebDavFile import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.utils.* -import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main +import kotlinx.coroutines.ensureActive +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext import splitties.init.appCtx import java.io.File import java.text.SimpleDateFormat diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 608d593b2..aa31d30c7 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -139,8 +139,11 @@ object BookHelp { var bytes = analyzeUrl.getByteArrayAwait() //某些图片被加密,需要进一步解密 bookSource?.getContentRule()?.imageDecode?.let { + if (it.isBlank()) { + return@let + } kotlin.runCatching { - bookSource?.evalJS(it) { + bookSource.evalJS(it) { put("book", book) put("result", bytes) put("src", src) diff --git a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt index 4bfc46d30..e5cc66e35 100644 --- a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt @@ -7,8 +7,8 @@ import android.net.Uri import androidx.annotation.DrawableRes import com.bumptech.glide.RequestBuilder import io.legado.app.utils.isAbsUrl -import io.legado.app.utils.isDataUrl import io.legado.app.utils.isContentScheme +import io.legado.app.utils.isDataUrl import java.io.File @Suppress("unused") diff --git a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt index 3984fbdda..f551f3d6f 100644 --- a/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt +++ b/app/src/main/java/io/legado/app/ui/about/ReadRecordActivity.kt @@ -1,6 +1,5 @@ package io.legado.app.ui.about -import java.text.SimpleDateFormat import android.content.Context import android.os.Bundle import android.view.Menu @@ -26,6 +25,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.text.SimpleDateFormat class ReadRecordActivity : BaseActivity() { diff --git a/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt index d3665bfe7..9e36dd7f6 100644 --- a/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/BaseAssociationViewModel.kt @@ -21,7 +21,7 @@ abstract class BaseAssociationViewModel(application: Application) : BaseViewMode } } - fun importJson(json: String) { + private fun importJson(json: String) { //暂时根据文件内容判断属于什么 when { json.contains("sourceUrl") -> diff --git a/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt index 3ad302d5d..0f6a924e1 100644 --- a/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt @@ -7,13 +7,11 @@ import androidx.lifecycle.MutableLiveData import io.legado.app.constant.AppLog import io.legado.app.constant.AppPattern.bookFileRegex import io.legado.app.exception.NoStackTraceException -import io.legado.app.help.IntentData import io.legado.app.model.localBook.LocalBook import io.legado.app.utils.inputStream import io.legado.app.utils.isJson import io.legado.app.utils.printOnDebug import java.io.File -import java.io.InputStream class FileAssociationViewModel(application: Application) : BaseAssociationViewModel(application) { val importBookLiveData = MutableLiveData() diff --git a/app/src/main/java/io/legado/app/ui/association/OnLineImportViewModel.kt b/app/src/main/java/io/legado/app/ui/association/OnLineImportViewModel.kt index a71af4620..ee0591db5 100644 --- a/app/src/main/java/io/legado/app/ui/association/OnLineImportViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/OnLineImportViewModel.kt @@ -1,12 +1,16 @@ package io.legado.app.ui.association import android.app.Application +import androidx.core.net.toUri import io.legado.app.R import io.legado.app.help.config.ReadBookConfig import io.legado.app.help.http.newCallResponseBody import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.text +import io.legado.app.utils.FileUtils +import io.legado.app.utils.externalCache import okhttp3.MediaType.Companion.toMediaType +import splitties.init.appCtx class OnLineImportViewModel(app: Application) : BaseAssociationViewModel(app) { @@ -72,8 +76,18 @@ class OnLineImportViewModel(app: Application) : BaseAssociationViewModel(app) { importReadConfig(rs.bytes(), finally) } else -> { - val json = rs.text("utf-8") - importJson(json) + val inputStream = rs.byteStream() + val file = FileUtils.createFileIfNotExist( + appCtx.externalCache, + "download", + "scheme_import_cache.json" + ) + file.outputStream().use { out -> + inputStream.use { + it.copyTo(out) + } + } + importJson(file.toUri()) } } } diff --git a/app/src/main/java/io/legado/app/ui/association/VerificationCodeActivity.kt b/app/src/main/java/io/legado/app/ui/association/VerificationCodeActivity.kt index 13ade4694..1166abef5 100644 --- a/app/src/main/java/io/legado/app/ui/association/VerificationCodeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/VerificationCodeActivity.kt @@ -17,8 +17,9 @@ class VerificationCodeActivity : override fun onActivityCreated(savedInstanceState: Bundle?) { intent.getStringExtra("imageUrl")?.let { val sourceOrigin = intent.getStringExtra("sourceOrigin") + val sourceName = intent.getStringExtra("sourceName") showDialogFragment( - VerificationCodeDialog(it, sourceOrigin) + VerificationCodeDialog(it, sourceOrigin, sourceName) ) } ?: finish() } diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 4ea28ac68..113fb5f25 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -200,7 +200,7 @@ class ImportBookActivity : VMBaseActivity(context), diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 5a1aab20d..8efb51994 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -15,7 +15,8 @@ import android.view.animation.Animation import android.widget.FrameLayout import android.widget.SeekBar import androidx.appcompat.widget.PopupMenu -import androidx.core.view.* +import androidx.core.view.isGone +import androidx.core.view.isVisible import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.databinding.ViewReadMenuBinding diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt index 90ec2fa9a..7a778fc29 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt @@ -15,7 +15,9 @@ import io.legado.app.help.config.AppConfig import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.ReadBook import io.legado.app.model.localBook.EpubFile -import io.legado.app.utils.* +import io.legado.app.utils.BitmapUtils +import io.legado.app.utils.FileUtils +import io.legado.app.utils.toastOnUi import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.withContext diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 29a60b2b7..0883ccf65 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -21,7 +21,6 @@ import io.legado.app.data.entities.BookSource import io.legado.app.databinding.ActivityBookSourceBinding import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.help.DirectLinkUpload -import io.legado.app.help.IntentData import io.legado.app.help.config.LocalConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.primaryColor diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index 41890da49..a06dfee5c 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -10,12 +10,10 @@ import com.google.android.flexbox.FlexboxLayout import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.RecyclerAdapter -import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.ExploreKind import io.legado.app.databinding.ItemFilletTextBinding import io.legado.app.databinding.ItemFindBookBinding -import io.legado.app.help.config.SourceConfig import io.legado.app.help.coroutine.Coroutine import io.legado.app.lib.theme.accentColor import io.legado.app.ui.login.SourceLoginActivity @@ -173,10 +171,7 @@ class ExploreAdapter(context: Context, val callBack: CallBack) : }.onSuccess { callBack.refreshData() } - R.id.menu_del -> Coroutine.async(callBack.scope) { - appDb.bookSourceDao.delete(source) - SourceConfig.removeSource(source.bookSourceUrl) - } + R.id.menu_del -> callBack.deleteSource(source) } true } @@ -191,5 +186,6 @@ class ExploreAdapter(context: Context, val callBack: CallBack) : fun openExplore(sourceUrl: String, title: String, exploreUrl: String?) fun editSource(sourceUrl: String) fun toTop(source: BookSource) + fun deleteSource(source: BookSource) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt index 46b1cd1c1..d9d29b4b0 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt @@ -18,6 +18,7 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.databinding.FragmentExploreBinding import io.legado.app.help.config.AppConfig +import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryTextColor import io.legado.app.ui.book.explore.ExploreShowActivity @@ -183,6 +184,16 @@ class ExploreFragment : VMBaseFragment(R.layout.fragment_explo viewModel.topSource(source) } + override fun deleteSource(source: BookSource) { + alert(R.string.draw) { + setMessage(getString(R.string.sure_del) + "\n" + source.bookSourceName) + noButton() + yesButton { + viewModel.deleteSource(source) + } + } + } + fun compressExplore() { if (!adapter.compressExplore()) { if (AppConfig.isEInkMode) { diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreViewModel.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreViewModel.kt index e6a2cc569..34bf44b9b 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreViewModel.kt @@ -4,6 +4,7 @@ import android.app.Application import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource +import io.legado.app.help.config.SourceConfig class ExploreViewModel(application: Application) : BaseViewModel(application) { @@ -15,4 +16,11 @@ class ExploreViewModel(application: Application) : BaseViewModel(application) { } } + fun deleteSource(source: BookSource) { + execute { + appDb.bookSourceDao.delete(source) + SourceConfig.removeSource(source.bookSourceUrl) + } + } + } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/utils/EncoderUtils.kt b/app/src/main/java/io/legado/app/utils/EncoderUtils.kt index 208261289..a9adacb30 100644 --- a/app/src/main/java/io/legado/app/utils/EncoderUtils.kt +++ b/app/src/main/java/io/legado/app/utils/EncoderUtils.kt @@ -1,10 +1,10 @@ package io.legado.app.utils import android.util.Base64 +import cn.hutool.crypto.symmetric.SymmetricCrypto import java.security.spec.AlgorithmParameterSpec import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.SecretKeySpec -import cn.hutool.crypto.symmetric.SymmetricCrypto /** * transformations https://developer.android.google.cn/reference/kotlin/javax/crypto/Cipher?hl=en diff --git a/app/src/main/java/io/legado/app/utils/StringExtensions.kt b/app/src/main/java/io/legado/app/utils/StringExtensions.kt index 1ea3f0b39..1228907b5 100644 --- a/app/src/main/java/io/legado/app/utils/StringExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/StringExtensions.kt @@ -2,11 +2,11 @@ package io.legado.app.utils -import io.legado.app.constant.AppPattern.dataUriRegex import android.icu.text.Collator import android.icu.util.ULocale import android.net.Uri import android.text.Editable +import io.legado.app.constant.AppPattern.dataUriRegex import java.io.File import java.util.* diff --git a/app/src/main/res/layout/activity_book_source_edit.xml b/app/src/main/res/layout/activity_book_source_edit.xml index bed6d5a36..49298cca8 100644 --- a/app/src/main/res/layout/activity_book_source_edit.xml +++ b/app/src/main/res/layout/activity_book_source_edit.xml @@ -13,64 +13,64 @@ app:fitStatusBar="false" app:title="@string/edit_book_source" /> - - - - - - - - - - - - + android:scrollbars="none"> - - - - - + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingHorizontal="8dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + + + + + + + + + + + + + + + + android:layout_height="match_parent" + tools:listitem="@layout/item_source_edit" /> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_bookmark.xml b/app/src/main/res/layout/dialog_bookmark.xml index 7c1f49627..b3c9f1796 100644 --- a/app/src/main/res/layout/dialog_bookmark.xml +++ b/app/src/main/res/layout/dialog_bookmark.xml @@ -35,7 +35,8 @@ + android:layout_weight="1" + android:overScrollMode="ifContentScrolls"> + android:layout_height="match_parent" + android:overScrollMode="ifContentScrolls"> + android:layout_height="wrap_content" + android:overScrollMode="ifContentScrolls"> + android:layout_height="wrap_content" + android:overScrollMode="ifContentScrolls"> 段评内容(contentRule) 段评回复URL(reviewQuoteUrl) 段评发布时间(postTimeRule) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1026,4 +1026,6 @@ show read title addition area read bar style follow page Decode Image(imageDecode) + + diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index e1cdf5197..ada590af6 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -1019,8 +1019,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1029,4 +1029,6 @@ show read title addition area read bar style follow page Decode Image(imageDecode) + + diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 6c7f0b320..12d27e110 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1019,8 +1019,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1029,4 +1029,6 @@ show read title addition area read bar style follow page Decode Image(imageDecode) + + diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 0857f25d7..ddd5bef78 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1016,8 +1016,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1026,4 +1026,6 @@ 展示顶部工具栏附加区域 工具栏样式跟随页面 图片解密(imageDecode) + + diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index dbc30e0e4..0f11cdd39 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1018,8 +1018,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1028,4 +1028,6 @@ 展示顶部工具栏附加区域 工具栏样式跟随页面 图片解密(imageDecode) + + diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 014b0e727..9df14a606 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -1018,8 +1018,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1028,4 +1028,6 @@ 展示顶部工具栏附加区域 工具栏样式跟随页面 图片解密(imageDecode) + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b8e307ae6..3dba52629 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1019,8 +1019,8 @@ 段评内容(contentRule) 段评发布时间(postTimeRule) 段评回复URL(reviewQuoteUrl) - 点踩URL(voteUpUrl) - 点赞URL(voteDownUrl) + 点踩URL(voteDownUrl) + 点赞URL(voteUpUrl) 发送回复URL(postReviewUrl) 发送回复段评URL(postQuoteUrl) 删除段评URL(deleteUrl) @@ -1029,4 +1029,6 @@ show read title addition area read bar style follow page Decode Image(imageDecode) + + diff --git a/build.gradle b/build.gradle index 27d2ef894..b9e15233a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { kotlin_version = '1.7.10' compose_version = '1.2.1' compose_compiler_version = '1.3.0' - agp_version= '7.2.2' + agp_version = '7.3.0' exoplayer_version = '2.18.1' splitties_version = '3.0.0' room_version = '2.4.3'