修复问题 (#4711)
* 升级RecyclerView适配自适应刷新率 * 减小菜单点击区域 * ... * 修复显示章节位置问题,修复顶部间距问题 * 显示漫画名称 * ... * ...
This commit is contained in:
@@ -37,9 +37,5 @@ class LegadoGlideModule : AppGlideModule() {
|
||||
1024 * 1024 * 1000
|
||||
)
|
||||
)
|
||||
.setDefaultRequestOptions {
|
||||
RequestOptions().format(DecodeFormat.PREFER_RGB_565)
|
||||
.encodeQuality(90)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
suspend fun contentLoadFinish(
|
||||
chapter: BookChapter,
|
||||
content: String,
|
||||
book: Book
|
||||
book: Book,
|
||||
) {
|
||||
if (mTopChapter != null && mTopChapter!!.title != chapterTitle && BookHelp.hasContent(
|
||||
book,
|
||||
@@ -299,7 +299,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
}.mapIndexed { index, src ->
|
||||
MangeContent(
|
||||
mChapterPageCount = durChapterPageCount,
|
||||
mChapterPagePos = durChapterPagePos,
|
||||
mChapterPagePos = durChapterPagePos.plus(1),
|
||||
mChapterNextPagePos = durChapterPagePos.plus(1),
|
||||
mImageUrl = src,
|
||||
mDurChapterPos = index.plus(1)
|
||||
@@ -308,6 +308,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
this.forEach {
|
||||
it.mDurChapterCount = this.size
|
||||
}
|
||||
durChapterCount = this.size
|
||||
}
|
||||
val contentList = mutableListOf<Any>()
|
||||
contentList.add(
|
||||
@@ -318,7 +319,6 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
)
|
||||
)
|
||||
contentList.addAll(list)
|
||||
durChapterCount = contentList.size
|
||||
contentList.add(
|
||||
ReaderLoading(
|
||||
durChapterPagePos,
|
||||
@@ -367,7 +367,12 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
val bookSource = bookSource ?: return
|
||||
val book = book ?: return
|
||||
if (!book.canUpdate) return
|
||||
if (System.currentTimeMillis() - book.lastCheckTime < 600000) return
|
||||
if (System.currentTimeMillis() - book.lastCheckTime < 600000) {
|
||||
runOnUI {
|
||||
mCallback?.noData()
|
||||
}
|
||||
return
|
||||
}
|
||||
book.lastCheckTime = System.currentTimeMillis()
|
||||
WebBook.getChapterList(this, bookSource, book).onSuccess(IO) { cList ->
|
||||
if (book.bookUrl == ReadManga.book?.bookUrl
|
||||
@@ -389,6 +394,10 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
mCallback?.noData()
|
||||
}
|
||||
}
|
||||
}.onError {
|
||||
runOnUI {
|
||||
mCallback?.noData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +574,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
||||
fun syncProgress(
|
||||
newProgressAction: ((progress: BookProgress) -> Unit)? = null,
|
||||
uploadSuccessAction: (() -> Unit)? = null,
|
||||
syncSuccessAction: (() -> Unit)? = null
|
||||
syncSuccessAction: (() -> Unit)? = null,
|
||||
) {
|
||||
if (!AppConfig.syncBookProgress) return
|
||||
book?.let {
|
||||
|
||||
@@ -6,13 +6,13 @@ import android.os.Looper
|
||||
import android.view.KeyEvent
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader
|
||||
@@ -48,12 +48,12 @@ import io.legado.app.utils.StartActivityContract
|
||||
import io.legado.app.utils.getCompatColor
|
||||
import io.legado.app.utils.gone
|
||||
import io.legado.app.utils.immersionFullScreen
|
||||
import io.legado.app.utils.immersionPadding
|
||||
import io.legado.app.utils.printOnDebug
|
||||
import io.legado.app.utils.showDialogFragment
|
||||
import io.legado.app.utils.toastOnUi
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
import io.legado.app.utils.visible
|
||||
import splitties.dimensions.dp
|
||||
|
||||
class ReadMangaActivity : VMBaseActivity<ActivityMangeBinding, MangaViewModel>(),
|
||||
ReadManga.Callback, ChangeBookSourceDialog.CallBack, MangaMenu.CallBack {
|
||||
@@ -114,6 +114,13 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangeBinding, MangaViewModel>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
immersionFullScreen(windowInsetsControllerCompat)
|
||||
immersionPadding(binding.root) { view, insets, _ ->
|
||||
binding.mangaMenu.setTitleBarPadding(insets.top)
|
||||
view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
leftMargin = insets.left
|
||||
rightMargin = insets.right
|
||||
}
|
||||
}
|
||||
ReadManga.register(this)
|
||||
binding.mRecyclerMange.run {
|
||||
adapter = mAdapter
|
||||
@@ -178,11 +185,6 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangeBinding, MangaViewModel>()
|
||||
}
|
||||
}
|
||||
loadMoreView.gone()
|
||||
binding.mangaMenu.setTitleBarPadding(
|
||||
ViewCompat.getRootWindowInsets(findViewById(android.R.id.content))?.getInsets(
|
||||
WindowInsetsCompat.Type.statusBars()
|
||||
)?.top ?: dp(25)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
@@ -208,14 +210,15 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangeBinding, MangaViewModel>()
|
||||
|
||||
override fun loadContentFinish(list: MutableList<Any>) {
|
||||
if (!this.isDestroyed) {
|
||||
setTitle(ReadManga.book?.name)
|
||||
mAdapter.submitList(list) {
|
||||
if (!mFirstLoading) {
|
||||
if (list.size > 1) {
|
||||
binding.infobar.isVisible = true
|
||||
upText(
|
||||
ReadManga.durChapterPagePos,
|
||||
ReadManga.durChapterPagePos.plus(1),
|
||||
ReadManga.durChapterPageCount,
|
||||
ReadManga.durChapterPos,
|
||||
ReadManga.durChapterPos.plus(1),
|
||||
ReadManga.durChapterCount
|
||||
)
|
||||
}
|
||||
@@ -247,7 +250,7 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangeBinding, MangaViewModel>()
|
||||
binding.infobar.update(
|
||||
chapterPagePos,
|
||||
chapterPageCount,
|
||||
chapterPagePos.minus(1f).div(chapterPageCount.minus(1f)),
|
||||
chapterPagePos.times(1f).div(chapterPageCount.times(1f)),
|
||||
chapterPos,
|
||||
chapterCount
|
||||
)
|
||||
|
||||
@@ -102,7 +102,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
mcRect.set(width * 0.33f, height * 0.33f, width * 0.66f, height * 0.66f)
|
||||
mcRect.set(width * 0.33f, height * 0.33f, width * 0.66f, height * 0.46f)
|
||||
}
|
||||
|
||||
private fun getPositionX(positionX: Float): Float {
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.OnClickListener
|
||||
import android.view.View.OnLongClickListener
|
||||
import android.view.animation.Animation
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isGone
|
||||
@@ -232,6 +234,9 @@ class MangaMenu @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun setTitleBarPadding(top: Int) {
|
||||
if (top <= 0) {
|
||||
return
|
||||
}
|
||||
binding.flTitleBar.run {
|
||||
setPadding(leftPadding, this.paddingTop.plus(top), rightPadding, bottomPadding)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.view.WindowMetrics
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
@@ -249,4 +250,11 @@ fun AppCompatActivity.showHelp(fileName: String) {
|
||||
fun immersionFullScreen(windowInsetsControllerCompat: WindowInsetsControllerCompat) {
|
||||
windowInsetsControllerCompat.systemBarsBehavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
windowInsetsControllerCompat.hide(WindowInsetsCompat.Type.systemBars())
|
||||
}
|
||||
|
||||
inline fun immersionPadding(root: View, crossinline viewInsets: (v: View, insets: androidx.core.graphics.Insets, gestureInsets: androidx.core.graphics.Insets) -> Unit) {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(root) { view: View, windowInsetsCompat: WindowInsetsCompat ->
|
||||
viewInsets(view, windowInsetsCompat.getInsets(WindowInsetsCompat.Type.systemBars()), windowInsetsCompat.getInsets(WindowInsetsCompat.Type.systemGestures()))
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user