优化
This commit is contained in:
@@ -5,13 +5,9 @@ import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.GlideBuilder
|
||||
import com.bumptech.glide.Registry
|
||||
import com.bumptech.glide.annotation.GlideModule
|
||||
import com.bumptech.glide.load.DecodeFormat
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool
|
||||
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory
|
||||
import com.bumptech.glide.load.engine.cache.LruResourceCache
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.module.AppGlideModule
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import java.io.InputStream
|
||||
|
||||
|
||||
@@ -29,13 +25,6 @@ class LegadoGlideModule : AppGlideModule() {
|
||||
|
||||
override fun applyOptions(context: Context, builder: GlideBuilder) {
|
||||
super.applyOptions(context, builder)
|
||||
builder.setMemoryCache(LruResourceCache(1024 * 1024 * 500))
|
||||
.setBitmapPool(LruBitmapPool(1024 * 1024 * 200))
|
||||
.setDiskCache(
|
||||
InternalCacheDiskCacheFactory(
|
||||
context,
|
||||
1024 * 1024 * 1000
|
||||
)
|
||||
)
|
||||
builder.setDiskCache(InternalCacheDiskCacheFactory(context, 1024 * 1024 * 1000))
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import android.widget.Button
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
@@ -19,7 +20,6 @@ import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.github.panpf.zoomimage.GlideZoomImageView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.help.glide.progress.OnProgressListener
|
||||
import io.legado.app.help.glide.progress.ProgressManager
|
||||
@@ -32,14 +32,14 @@ open class MangaVH<VB : ViewBinding>(val binding: VB, private val context: Conte
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
protected lateinit var mLoading: ProgressBar
|
||||
protected lateinit var mImage: GlideZoomImageView
|
||||
protected lateinit var mImage: AppCompatImageView
|
||||
protected lateinit var mProgress: TextView
|
||||
protected lateinit var mFlProgress: FrameLayout
|
||||
protected var mRetry: Button? = null
|
||||
|
||||
fun initComponent(
|
||||
loading: ProgressBar,
|
||||
image: GlideZoomImageView,
|
||||
image: AppCompatImageView,
|
||||
progress: TextView,
|
||||
button: Button? = null,
|
||||
flProgress: FrameLayout,
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.viewbinding.ViewBinding
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.ListPreloader.PreloadModelProvider
|
||||
import com.bumptech.glide.RequestBuilder
|
||||
import com.github.panpf.zoomimage.zoom.GestureType
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.adapter.ItemViewHolder
|
||||
import io.legado.app.base.adapter.RecyclerAdapter.Companion.TYPE_FOOTER_VIEW
|
||||
@@ -89,10 +88,6 @@ class MangaAdapter(private val context: Context) :
|
||||
binding.retry,
|
||||
binding.flProgress
|
||||
)
|
||||
binding.image.zoomable.disabledGestureTypesState.value =
|
||||
GestureType.DOUBLE_TAP_SCALE or GestureType.ONE_FINGER_SCALE or
|
||||
GestureType.TWO_FINGER_SCALE or GestureType.KEYBOARD_DRAG or
|
||||
GestureType.ONE_FINGER_DRAG or GestureType.KEYBOARD_SCALE or GestureType.MOUSE_WHEEL_SCALE
|
||||
binding.retry.setOnClickListener {
|
||||
val item = mDiffer.currentList[layoutPosition]
|
||||
if (item is MangeContent) {
|
||||
|
||||
@@ -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.46f)
|
||||
mcRect.set(width * 0.33f, height * 0.33f, width * 0.66f, height * 0.66f)
|
||||
}
|
||||
|
||||
private fun getPositionX(positionX: Float): Float {
|
||||
@@ -306,7 +306,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
if (disableMangaScaling) {
|
||||
return false
|
||||
return super.onTouchEvent(ev)
|
||||
}
|
||||
if (isDoubleTapping && isQuickScaling) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user