Compare commits

...

6 Commits

Author SHA1 Message Date
dependabot[bot]
ec559fbb46
Merge d4afcbe8fd into 4c6ec35d95 2024-05-26 21:45:38 +08:00
Horis
4c6ec35d95 优化 2024-05-25 12:18:51 +08:00
Horis
b30680c02e
Merge pull request #3946 from mgz0227/master
替换被封域名
2024-05-24 11:09:29 +08:00
miaogongzi
a3685c4358 替换被封域名 2024-05-24 02:33:20 +08:00
Horis
a2cc621917 优化 2024-05-22 10:34:26 +08:00
dependabot[bot]
d4afcbe8fd
Bump androidx.benchmark from 1.2.3 to 1.2.4
Bumps androidx.benchmark from 1.2.3 to 1.2.4.

---
updated-dependencies:
- dependency-name: androidx.benchmark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 04:22:20 +00:00
9 changed files with 63 additions and 26 deletions

View File

@ -1,7 +1,7 @@
[
{
"uploadUrl": "https://sy.mgz6.cc/shuyuan,{\"method\":\"POST\",\"body\": {\"file\": \"fileRequest\"},\"type\": \"multipart/form-data\"}",
"downloadUrlRule": "$.data@js:if (result == '') \n '' \n else \n 'https://shuyuan.mgz6.cc/shuyuan/' + result",
"uploadUrl": "https://sy.mgz6.com/shuyuan,{\"method\":\"POST\",\"body\": {\"file\": \"fileRequest\"},\"type\": \"multipart/form-data\"}",
"downloadUrlRule": "$.data@js:if (result == '') \n '' \n else \n 'https://shuyuan.mgz6.com/shuyuan/' + result",
"summary": "喵公子网盘①(有效期7天)",
"compress": false
},

View File

@ -179,6 +179,14 @@ class EpubFile(var book: Book) {
elements.select("img[src=\"cover.jpeg\"]").forEachIndexed { i, it ->
if (i > 0) it.remove()
}
elements.select("img").forEach {
if (it.attributesSize() <= 1) {
return@forEach
}
val src = it.attr("src")
it.clearAttributes()
it.attr("src", src)
}
val tag = Book.rubyTag
if (book.getDelTag(tag)) {
elements.select("rp, rt").remove()

View File

@ -303,9 +303,7 @@ class ReadBookActivity : BaseReadBookActivity(),
if (bookChanged) {
bookChanged = false
ReadBook.callBack = this
viewModel.initData(intent) {
upMenu()
}
viewModel.initData(intent)
} else {
//web端阅读时app处于阅读界面本地记录会覆盖web保存的进度在此处恢复
ReadBook.webBookProgress?.let {

View File

@ -159,6 +159,7 @@ class MoreConfigDialog : DialogFragment() {
}
PreferKey.optimizeRender -> {
ChapterProvider.upStyle()
ReadBook.callBack?.upPageAnim(true)
ReadBook.loadContent(false)
}

View File

@ -200,7 +200,7 @@ class ReadStyleDialog : BaseDialogFragment(R.layout.dialog_read_book_style),
override fun selectFont(path: String) {
if (path != ReadBookConfig.textFont) {
ReadBookConfig.textFont = path
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 5))
}
}

View File

@ -200,6 +200,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
}
MotionEvent.ACTION_MOVE -> {
if (!pressDown) return true
val absX = abs(startX - event.x)
val absY = abs(startY - event.y)
if (!isMove) {

View File

@ -881,7 +881,9 @@ object ChapterProvider {
tPaint.typeface = titleFont
tPaint.textSize = with(ReadBookConfig) { textSize + titleSize }.toFloat().spToPx()
tPaint.isAntiAlias = true
tPaint.isLinearText = true
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) {
tPaint.isLinearText = true
}
//正文
val cPaint = TextPaint()
cPaint.color = ReadBookConfig.textColor
@ -889,7 +891,9 @@ object ChapterProvider {
cPaint.typeface = textFont
cPaint.textSize = ReadBookConfig.textSize.toFloat().spToPx()
cPaint.isAntiAlias = true
cPaint.isLinearText = true
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) {
cPaint.isLinearText = true
}
return Pair(tPaint, cPaint)
}

View File

@ -14,6 +14,8 @@ import androidx.appcompat.widget.PopupMenu
import androidx.appcompat.widget.SearchView
import androidx.core.os.bundleOf
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
@ -50,6 +52,7 @@ import io.legado.app.utils.ACache
import io.legado.app.utils.applyTint
import io.legado.app.utils.cnCompare
import io.legado.app.utils.dpToPx
import io.legado.app.utils.flowWithLifecycleFirst
import io.legado.app.utils.hideSoftInput
import io.legado.app.utils.isAbsUrl
import io.legado.app.utils.launch
@ -68,6 +71,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.isActive
@ -98,7 +102,6 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
override var sortAscending = true
private set
private var snackBar: Snackbar? = null
private var isPaused = false
private val qrResult = registerForActivityResult(QrCodeResult()) {
it ?: return@registerForActivityResult
showDialogFragment(ImportBookSourceDialog(it))
@ -125,6 +128,19 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
}
}
}
private val groupMenuLifecycleOwner = object : LifecycleOwner {
private val registry = LifecycleRegistry(this)
override val lifecycle: Lifecycle get() = registry
fun onMenuOpened() {
registry.handleLifecycleEvent(Lifecycle.Event.ON_START)
}
fun onMenuClosed() {
registry.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
}
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
initRecyclerView()
@ -372,12 +388,17 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
private fun initLiveDataGroup() {
lifecycleScope.launch {
appDb.bookSourceDao.flowGroups().conflate().collect {
groups.clear()
groups.addAll(it)
upGroupMenu()
delay(500)
}
appDb.bookSourceDao.flowGroups()
.flowWithLifecycle(lifecycle)
.flowWithLifecycleFirst(groupMenuLifecycleOwner.lifecycle)
.conflate()
.distinctUntilChanged()
.collect {
groups.clear()
groups.addAll(it)
upGroupMenu()
delay(500)
}
}
}
@ -400,6 +421,20 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
}
}
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean {
if (menu === groupMenu) {
groupMenuLifecycleOwner.onMenuOpened()
}
return super.onMenuOpened(featureId, menu)
}
override fun onPanelClosed(featureId: Int, menu: Menu) {
super.onPanelClosed(featureId, menu)
if (menu === groupMenu) {
groupMenuLifecycleOwner.onMenuClosed()
}
}
private fun initSelectActionBar() {
binding.selectActionBar.setMainActionText(R.string.delete)
binding.selectActionBar.inflateMenu(R.menu.book_source_sel)
@ -637,16 +672,6 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
}
}
override fun onPause() {
super.onPause()
isPaused = true
}
override fun onResume() {
super.onResume()
isPaused = false
}
override fun upCountView() {
binding.selectActionBar
.upCountView(adapter.selection.size, adapter.itemCount)

View File

@ -161,7 +161,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
androidx-benchmark = { id = "androidx.benchmark", version = "1.2.3" }
androidx-benchmark = { id = "androidx.benchmark", version = "1.2.4" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }