Commit fc914911 authored by jyx's avatar jyx

优化首页图片样式

parent d7b47a52
......@@ -21,7 +21,7 @@ class NewHotStyleAdapter : BaseQuickAdapter<VedioBean, BaseViewHolder>(R.layout.
R.id.tvVedioItemText,
"${it.vedioDesc}"
)
GlideUtils.loadImageViewGifForFitCenter(
GlideUtils.loadImageViewGifForCenterCrop(
context,
it.coverImage,
holder.getView(R.id.ivVedioItem)
......
......@@ -49,7 +49,7 @@ class TopAdapter(val topList: MutableList<VedioBean>?) :
holder.tvTopItemText.text = "${sb}"
}
GlideUtils.loadImageViewGifForFitCenter(
GlideUtils.loadImageViewGifForCenterCrop(
context,
topBean.coverImage,
holder.ivTopItem
......
......@@ -205,9 +205,10 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
fun setWatchingStatus() {
if (LocalVedioManager.isCacheVedio()) {
ll_main_watching_root.visibility = View.VISIBLE
ll_main_watching_root.setOnClickListener { }
val cacheVedio = LocalVedioManager.getCacheVedio()
if (cacheVedio != null) {
GlideUtils.loadImageViewGifForFitCenter(
GlideUtils.loadImageViewGifForCenterCrop(
requireContext(),
cacheVedio.coverImage,
iv_main_watching_pic
......
......@@ -9,6 +9,7 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.Priority
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.CenterInside
import com.bumptech.glide.load.resource.bitmap.FitCenter
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.gif.GifDrawable
......@@ -105,6 +106,19 @@ object GlideUtils {
.into(imageView)
}
fun loadImageViewGifForCenterInside(mContext: Context, drawable: String, imageView: ImageView) {
val options = RequestOptions()
.transform(
CenterInside(),
RoundedCorners(BubbleUtils.dp2px(5))
)
.diskCacheStrategy(DiskCacheStrategy.DATA)
Glide.with(mContext)
.load(drawable)
.apply(options)
.into(imageView)
}
//设置加载中图片
fun loadImageViewLoding(
mContext: Context?,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment