feat: 游戏中奖飘屏,通用img飘屏,通用vga飘屏 添加dp68的 顶部间距
This commit is contained in:
@@ -23,6 +23,8 @@ import com.chwl.core.gift.event.NotifyEvent
|
|||||||
import com.chwl.core.home.bean.BannerInfo
|
import com.chwl.core.home.bean.BannerInfo
|
||||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
||||||
import com.chwl.core.utils.extension.subAndReplaceDot
|
import com.chwl.core.utils.extension.subAndReplaceDot
|
||||||
|
import com.chwl.library.common.util.isVerify
|
||||||
|
import com.chwl.library.common.util.setVis
|
||||||
import com.chwl.library.rxbus.RxBus
|
import com.chwl.library.rxbus.RxBus
|
||||||
import com.chwl.library.widget.SVGAView
|
import com.chwl.library.widget.SVGAView
|
||||||
import com.example.lib_utils.ktx.getColorById
|
import com.example.lib_utils.ktx.getColorById
|
||||||
@@ -55,19 +57,52 @@ class BaiShunGameNotify(context: Context) : BaseFloatView(context),
|
|||||||
requestRemoveSelf()
|
requestRemoveSelf()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val svgaView = findViewById<SVGAView>(R.id.iv_bg)
|
|
||||||
svgaView.loadFile("svga/baishun_notify_bg.svga")
|
|
||||||
|
|
||||||
|
val svgaView = findViewById<SVGAView>(R.id.iv_bg)
|
||||||
val textView = findViewById<TextView>(R.id.tv_text)
|
val textView = findViewById<TextView>(R.id.tv_text)
|
||||||
|
|
||||||
|
if (data.resourceType == RoomTemplateNotifyMsgBean.TYPE_SVGA && data.resourceContent.isVerify()) {
|
||||||
|
SVGAParser.shareParser().decodeFromURL(
|
||||||
|
URL(data.resourceContent),
|
||||||
|
object : SVGAParser.ParseCompletion {
|
||||||
|
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||||
|
val width = videoItem.videoSize.width
|
||||||
|
val height = videoItem.videoSize.height
|
||||||
|
var dimensionRatio = "75:11"
|
||||||
|
if (width > 0 && height > 0) {
|
||||||
|
dimensionRatio = "$width:$height"
|
||||||
|
}
|
||||||
|
val params = svgaView.layoutParams as ConstraintLayout.LayoutParams
|
||||||
|
params.dimensionRatio = dimensionRatio
|
||||||
|
svgaView.layoutParams = params
|
||||||
|
val drawable = SVGADrawable(videoItem)
|
||||||
|
svgaView.setImageDrawable(drawable)
|
||||||
|
svgaView.startAnimation()
|
||||||
|
setView(data,textView)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError() {
|
||||||
|
requestRemoveSelf()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
svgaView.loadFile("svga/baishun_notify_bg.svga")
|
||||||
|
setView(data,textView)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setView(data:RoomTemplateNotifyMsgBean,textView:TextView) {
|
||||||
val textSize = data.fontSize?.toFloat() ?: 12f
|
val textSize = data.fontSize?.toFloat() ?: 12f
|
||||||
val textColor = templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
val textColor = templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
||||||
textView.textSize = textSize
|
textView.textSize = textSize
|
||||||
textView.setTextColor(textColor)
|
textView.setTextColor(textColor)
|
||||||
|
|
||||||
|
|
||||||
templateMessageAdapter.convert(textView, data)
|
|
||||||
startEnterAnim()
|
startEnterAnim()
|
||||||
|
templateMessageAdapter.convert(textView, data)
|
||||||
val go = findViewById<ImageView>(R.id.go)
|
val go = findViewById<ImageView>(R.id.go)
|
||||||
|
go.setVis(true)
|
||||||
go.setOnClickListener {
|
go.setOnClickListener {
|
||||||
val event = NotifyEvent()
|
val event = NotifyEvent()
|
||||||
event.action = NotifyEvent.Action.ACT_BAI_SHUN_GAME
|
event.action = NotifyEvent.Action.ACT_BAI_SHUN_GAME
|
||||||
@@ -75,7 +110,6 @@ class BaiShunGameNotify(context: Context) : BaseFloatView(context),
|
|||||||
EventBus.getDefault().post(event)
|
EventBus.getDefault().post(event)
|
||||||
}
|
}
|
||||||
startDelayRemove()
|
startDelayRemove()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowUserCard(uid: String) {
|
override fun onShowUserCard(uid: String) {
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
app:clearsAfterDetached="true"
|
app:clearsAfterDetached="true"
|
||||||
|
android:layout_marginTop="@dimen/dp_68"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:autoPlay="true"
|
app:autoPlay="true"
|
||||||
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
||||||
@@ -39,6 +40,8 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/go"
|
android:id="@+id/go"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
|
android:visibility="invisible"
|
||||||
|
tools:visibility="visible"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginEnd="@dimen/dp_40"
|
android:layout_marginEnd="@dimen/dp_40"
|
||||||
android:src="@drawable/ic_notify_go"
|
android:src="@drawable/ic_notify_go"
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_marginTop="@dimen/dp_68"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:clearsAfterDetached="true"
|
app:clearsAfterDetached="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:layout_marginTop="@dimen/dp_68"
|
||||||
app:loopCount="1"
|
app:loopCount="1"
|
||||||
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
tools:src="@drawable/smash_eggs_notity_bg_4" />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user