|
@@ -1,6 +1,7 @@
|
|
package com.swago.room.widget
|
|
package com.swago.room.widget
|
|
|
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
|
+import android.graphics.drawable.Drawable
|
|
import android.util.AttributeSet
|
|
import android.util.AttributeSet
|
|
import android.util.Log
|
|
import android.util.Log
|
|
import android.util.TimeUtils
|
|
import android.util.TimeUtils
|
|
@@ -11,6 +12,10 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
import com.bumptech.glide.Glide
|
|
import com.bumptech.glide.Glide
|
|
|
|
+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.swago.baseswago.R
|
|
import com.swago.baseswago.R
|
|
import com.swago.baseswago.baseroom.*
|
|
import com.swago.baseswago.baseroom.*
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
@@ -34,6 +39,7 @@ class ComHeaderView : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
|
|
|
|
|
|
lateinit var binding: LayoutUserHeaderViewBinding
|
|
lateinit var binding: LayoutUserHeaderViewBinding
|
|
|
|
|
|
|
|
+ var glideImageFun:((id:GlideException?)->Unit)? = null
|
|
var followFun:((id:String)->Unit)? = null
|
|
var followFun:((id:String)->Unit)? = null
|
|
var showUserInfo:((id:String)->Unit)? = null
|
|
var showUserInfo:((id:String)->Unit)? = null
|
|
var openAudienceListDialog:(()->Unit)? = null
|
|
var openAudienceListDialog:(()->Unit)? = null
|
|
@@ -150,7 +156,29 @@ class ComHeaderView : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
|
|
binding.clRoot.visibility = View.VISIBLE
|
|
binding.clRoot.visibility = View.VISIBLE
|
|
Glide.with(context).load(iRoomInfo.getRoomCover())
|
|
Glide.with(context).load(iRoomInfo.getRoomCover())
|
|
.placeholder(R.mipmap.default_avatar)
|
|
.placeholder(R.mipmap.default_avatar)
|
|
- .error(R.mipmap.default_avatar).into(binding.ivAvatar)
|
|
|
|
|
|
+ .error(R.mipmap.default_avatar)
|
|
|
|
+ .listener(object : RequestListener<Drawable>{
|
|
|
|
+ override fun onLoadFailed(
|
|
|
|
+ ex: GlideException?,
|
|
|
|
+ p1: Any?,
|
|
|
|
+ p2: Target<Drawable>?,
|
|
|
|
+ p3: Boolean
|
|
|
|
+ ): Boolean {
|
|
|
|
+ glideImageFun?.invoke(ex)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onResourceReady(
|
|
|
|
+ p0: Drawable?,
|
|
|
|
+ p1: Any?,
|
|
|
|
+ p2: Target<Drawable>?,
|
|
|
|
+ p3: DataSource?,
|
|
|
|
+ p4: Boolean
|
|
|
|
+ ): Boolean {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .into(binding.ivAvatar)
|
|
binding.tvName.text =iRoomInfo.getAnchorName()
|
|
binding.tvName.text =iRoomInfo.getAnchorName()
|
|
binding.tvId.text = "Likes:${iRoomInfo.getLikeNum()}"
|
|
binding.tvId.text = "Likes:${iRoomInfo.getLikeNum()}"
|
|
binding.tvHot.text = iRoomInfo.getRoomHot()
|
|
binding.tvHot.text = iRoomInfo.getRoomHot()
|