|
@@ -20,6 +20,7 @@ import com.swago.baseswago.model.live.gift.IMGiftModel
|
|
|
import com.swago.baseswago.util.AppContext
|
|
|
import com.swago.baseswago.util.DpPxUtil
|
|
|
import com.swago.baseswago.util.SwagoInfo
|
|
|
+import com.swago.loadUrl
|
|
|
import com.swago.room.R
|
|
|
import com.swago.room.databinding.ViewWaftBinding
|
|
|
import java.net.URL
|
|
@@ -36,6 +37,7 @@ class WaftView : FrameLayout {
|
|
|
private val imGiftModelList = LinkedList<IPiaoTiao>()
|
|
|
private var binding : ViewWaftBinding? = null
|
|
|
private var svgaParser:SVGAParser? = null
|
|
|
+ private var context:Context ?= null
|
|
|
constructor(context: Context) : super(context)
|
|
|
constructor(context: Context, mAttributeSet: AttributeSet?) : super(context, mAttributeSet){
|
|
|
initView(context)
|
|
@@ -44,6 +46,7 @@ class WaftView : FrameLayout {
|
|
|
private fun initView(context: Context) {
|
|
|
binding = ViewWaftBinding.inflate(LayoutInflater.from(context), this, true)
|
|
|
svgaParser = SVGAParser(context)
|
|
|
+ this.context = context
|
|
|
}
|
|
|
|
|
|
|
|
@@ -127,7 +130,7 @@ class WaftView : FrameLayout {
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_big_prize)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_big_prize)
|
|
|
binding?.tvPrize?.text = "${next.multiple}"
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.big_prize).format(sendName,giftName,multiple)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.big_prize).format(sendName,giftName,multiple))
|
|
|
|
|
|
}else{
|
|
|
val sendName = "<font color='#FFDB43'>${next.senderName}</font>"
|
|
@@ -138,13 +141,13 @@ class WaftView : FrameLayout {
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_send)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_send)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.big_gift_msg).format(sendName,giftName,receiverName)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.big_gift_msg).format(sendName,giftName,receiverName))
|
|
|
}
|
|
|
if (!next.headSpecial.isNullOrEmpty()){
|
|
|
- binding?.svgAvatar?.visibility = View.VISIBLE
|
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
|
val drawable = SVGADrawable(videoItem)
|
|
|
+ binding?.svgAvatar?.visibility = View.VISIBLE
|
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
|
binding?.svgAvatar?.startAnimation()
|
|
|
}
|
|
@@ -153,7 +156,10 @@ class WaftView : FrameLayout {
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- binding?.svgAvatar?.visibility = View.GONE
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
+ }
|
|
|
+ context?.let {
|
|
|
+ binding?.ivAvatar?.loadUrl(it,next.senderAvatar)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -164,20 +170,21 @@ class WaftView : FrameLayout {
|
|
|
binding?.ivFunction?.visibility = View.GONE
|
|
|
binding?.ivAvatar?.visibility = View.VISIBLE
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_game)
|
|
|
- binding?.tvPrize?.setBackgroundResource(R.mipmap.ic_waft_game)
|
|
|
+ binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_game)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
when(SwagoInfo.getLanguageCode()){
|
|
|
"id","ms" -> {
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.game_prize).format(sendName,coin,gameName)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.game_prize).format(sendName,coin,gameName))
|
|
|
}
|
|
|
else -> {
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.game_prize).format(sendName,gameName,coin)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.game_prize).format(sendName,gameName,coin))
|
|
|
}
|
|
|
}
|
|
|
if (next.headSpecial.isNotEmpty()){
|
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
|
val drawable = SVGADrawable(videoItem)
|
|
|
+ binding?.svgAvatar?.visibility = VISIBLE
|
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
|
binding?.svgAvatar?.startAnimation()
|
|
|
}
|
|
@@ -185,48 +192,61 @@ class WaftView : FrameLayout {
|
|
|
override fun onError() {
|
|
|
}
|
|
|
})
|
|
|
+ } else {
|
|
|
+ binding?.svgAvatar?.visibility = INVISIBLE
|
|
|
+ }
|
|
|
+ context?.let {
|
|
|
+ binding?.ivAvatar?.loadUrl(it,next.userHeadImgUrl)
|
|
|
}
|
|
|
}
|
|
|
is PiaoTiaoRewardsData -> {
|
|
|
when(next.type) {
|
|
|
505 -> {
|
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
|
- val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
|
+ val sort = "<font color='#FFDB43'>${next.sort}</font>"
|
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.congratulations_to_for_start_of_today).format(sendName,coin)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.congratulations_to_for_start_of_today).format(sendName,sort))
|
|
|
}
|
|
|
506 -> {
|
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
|
- val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
|
+ val sort = "<font color='#FFDB43'>${next.sort}</font>"
|
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.congratulations_to_for_king_of_game).format(sendName,coin)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.congratulations_to_for_king_of_game).format(sendName,sort))
|
|
|
}
|
|
|
507 -> {
|
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
|
val coin = "<font color='#FFDB43'>${next.winCoin}</font>"
|
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.so_lucky_golden_egg).format(sendName,coin)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.so_lucky_golden_egg).format(sendName,coin))
|
|
|
}
|
|
|
508 -> {
|
|
|
val coin = "<font color='#FFDB43'>${next.actCoin}</font>"
|
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
binding?.tvPrize?.text = ""
|
|
|
- binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.prize_pool_golden_egg).format(coin)}")
|
|
|
+ binding?.marqueeTextView?.text = Html.fromHtml(AppContext.getContext().resources.getString(R.string.prize_pool_golden_egg).format(coin))
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -234,9 +254,6 @@ class WaftView : FrameLayout {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
binding?.marqueeTextView?.post {
|
|
|
binding?.marqueeTextView?.stopScroll()
|
|
|
binding?.marqueeTextView?.startScroll()
|