fix: some UI changes (for better or worse)

This commit is contained in:
aayush262 2024-03-08 00:45:13 +05:30
parent 7ac679f927
commit a2ca16355a
26 changed files with 493 additions and 444 deletions

View file

@ -1,10 +1,17 @@
package ani.dantotsu.profile
import android.app.Activity
import android.content.Context
import android.view.View
import ani.dantotsu.R
import ani.dantotsu.databinding.ItemFollowerBinding
import ani.dantotsu.loadImage
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.request.RequestOptions
import com.xwray.groupie.viewbinding.BindableItem
import jp.wasabeef.glide.transformations.BlurTransformation
class FollowerItem(
private val id: Int,
@ -18,9 +25,16 @@ class FollowerItem(
override fun bind(viewBinding: ItemFollowerBinding, position: Int) {
binding = viewBinding
binding.profileUserName.text = name
val context = binding.profileBannerImage.context
avatar?.let { binding.profileUserAvatar.loadImage(it) }
if (banner != null) {
binding.profileBannerImage.loadImage(banner)
if (!(context as Activity).isDestroyed)
Glide.with(context as Context)
.load(GlideUrl(banner))
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 6)))
.into(binding.profileBannerImage)
} else {
binding.profileBannerImage.setImageResource(R.drawable.linear_gradient_bg)
}