|
@@ -20,6 +20,7 @@ import com.swago.baseswago.model.live.gift.IMGiftModel
|
|
import com.swago.baseswago.util.AppContext
|
|
import com.swago.baseswago.util.AppContext
|
|
import com.swago.baseswago.util.DpPxUtil
|
|
import com.swago.baseswago.util.DpPxUtil
|
|
import com.swago.baseswago.util.SwagoInfo
|
|
import com.swago.baseswago.util.SwagoInfo
|
|
|
|
+import com.swago.loadUrl
|
|
import com.swago.room.R
|
|
import com.swago.room.R
|
|
import com.swago.room.databinding.ViewWaftBinding
|
|
import com.swago.room.databinding.ViewWaftBinding
|
|
import java.net.URL
|
|
import java.net.URL
|
|
@@ -36,6 +37,7 @@ class WaftView : FrameLayout {
|
|
private val imGiftModelList = LinkedList<IPiaoTiao>()
|
|
private val imGiftModelList = LinkedList<IPiaoTiao>()
|
|
private var binding : ViewWaftBinding? = null
|
|
private var binding : ViewWaftBinding? = null
|
|
private var svgaParser:SVGAParser? = null
|
|
private var svgaParser:SVGAParser? = null
|
|
|
|
+ private var context:Context ?= null
|
|
constructor(context: Context) : super(context)
|
|
constructor(context: Context) : super(context)
|
|
constructor(context: Context, mAttributeSet: AttributeSet?) : super(context, mAttributeSet){
|
|
constructor(context: Context, mAttributeSet: AttributeSet?) : super(context, mAttributeSet){
|
|
initView(context)
|
|
initView(context)
|
|
@@ -44,6 +46,7 @@ class WaftView : FrameLayout {
|
|
private fun initView(context: Context) {
|
|
private fun initView(context: Context) {
|
|
binding = ViewWaftBinding.inflate(LayoutInflater.from(context), this, true)
|
|
binding = ViewWaftBinding.inflate(LayoutInflater.from(context), this, true)
|
|
svgaParser = SVGAParser(context)
|
|
svgaParser = SVGAParser(context)
|
|
|
|
+ this.context = context
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -127,7 +130,7 @@ class WaftView : FrameLayout {
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_big_prize)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_big_prize)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_big_prize)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_big_prize)
|
|
binding?.tvPrize?.text = "${next.multiple}"
|
|
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{
|
|
}else{
|
|
val sendName = "<font color='#FFDB43'>${next.senderName}</font>"
|
|
val sendName = "<font color='#FFDB43'>${next.senderName}</font>"
|
|
@@ -138,13 +141,13 @@ class WaftView : FrameLayout {
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_send)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_send)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_send)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_send)
|
|
binding?.tvPrize?.text = ""
|
|
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()){
|
|
if (!next.headSpecial.isNullOrEmpty()){
|
|
- binding?.svgAvatar?.visibility = View.VISIBLE
|
|
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
val drawable = SVGADrawable(videoItem)
|
|
val drawable = SVGADrawable(videoItem)
|
|
|
|
+ binding?.svgAvatar?.visibility = View.VISIBLE
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
binding?.svgAvatar?.startAnimation()
|
|
binding?.svgAvatar?.startAnimation()
|
|
}
|
|
}
|
|
@@ -153,7 +156,10 @@ class WaftView : FrameLayout {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- binding?.svgAvatar?.visibility = View.GONE
|
|
|
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
|
|
+ }
|
|
|
|
+ context?.let {
|
|
|
|
+ binding?.ivAvatar?.loadUrl(it,next.senderAvatar)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -168,16 +174,17 @@ class WaftView : FrameLayout {
|
|
binding?.tvPrize?.text = ""
|
|
binding?.tvPrize?.text = ""
|
|
when(SwagoInfo.getLanguageCode()){
|
|
when(SwagoInfo.getLanguageCode()){
|
|
"id","ms" -> {
|
|
"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 -> {
|
|
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()){
|
|
if (next.headSpecial.isNotEmpty()){
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
svgaParser?.decodeFromURL(URL(next.headSpecial), object : SVGAParser.ParseCompletion{
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
val drawable = SVGADrawable(videoItem)
|
|
val drawable = SVGADrawable(videoItem)
|
|
|
|
+ binding?.svgAvatar?.visibility = VISIBLE
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
binding?.svgAvatar?.setImageDrawable(drawable)
|
|
binding?.svgAvatar?.startAnimation()
|
|
binding?.svgAvatar?.startAnimation()
|
|
}
|
|
}
|
|
@@ -185,6 +192,11 @@ class WaftView : FrameLayout {
|
|
override fun onError() {
|
|
override fun onError() {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ binding?.svgAvatar?.visibility = INVISIBLE
|
|
|
|
+ }
|
|
|
|
+ context?.let {
|
|
|
|
+ binding?.ivAvatar?.loadUrl(it,next.userHeadImgUrl)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
is PiaoTiaoRewardsData -> {
|
|
is PiaoTiaoRewardsData -> {
|
|
@@ -194,39 +206,47 @@ class WaftView : FrameLayout {
|
|
val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.tvPrize?.text = ""
|
|
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,coin))
|
|
}
|
|
}
|
|
506 -> {
|
|
506 -> {
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.sort}</font>"
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.tvPrize?.text = ""
|
|
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,coin))
|
|
}
|
|
}
|
|
507 -> {
|
|
507 -> {
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
val sendName = "<font color='#FFDB43'>${next.userName}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.winCoin}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.winCoin}</font>"
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.tvPrize?.text = ""
|
|
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 -> {
|
|
508 -> {
|
|
val coin = "<font color='#FFDB43'>${next.actCoin}</font>"
|
|
val coin = "<font color='#FFDB43'>${next.actCoin}</font>"
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivFunction?.visibility = View.VISIBLE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
binding?.ivAvatar?.visibility = View.GONE
|
|
|
|
+ binding?.svgAvatar?.visibility = View.INVISIBLE
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ll?.setBackgroundResource(R.mipmap.bg_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.ivPrize?.setImageResource(R.mipmap.ic_waft_function)
|
|
|
|
+ binding?.ivFunction?.setImageResource(R.mipmap.ic_waft_function)
|
|
binding?.tvPrize?.text = ""
|
|
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?.post {
|
|
binding?.marqueeTextView?.stopScroll()
|
|
binding?.marqueeTextView?.stopScroll()
|
|
binding?.marqueeTextView?.startScroll()
|
|
binding?.marqueeTextView?.startScroll()
|