fix : 房間背景 預覽播放問題
This commit is contained in:
@@ -59,6 +59,7 @@ class RoomBgPreviewDialog : BaseDialogFragment<DialogRoomBgPreviewBinding>() {
|
||||
}
|
||||
|
||||
if (isBuy) {
|
||||
binding.bg.loops
|
||||
binding.bg.loadUrl(mUri)
|
||||
} else {
|
||||
ImageLoadUtils.loadImage(context,mFile,binding.bg)
|
||||
@@ -71,6 +72,7 @@ class RoomBgPreviewDialog : BaseDialogFragment<DialogRoomBgPreviewBinding>() {
|
||||
postBuy(mBgId)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnSuccess {
|
||||
ToastUtils.show(R.string.doSuccess)
|
||||
mCallBack?.onSuccess()
|
||||
dismiss()
|
||||
}
|
||||
@@ -93,6 +95,7 @@ class RoomBgPreviewDialog : BaseDialogFragment<DialogRoomBgPreviewBinding>() {
|
||||
postCustom( it)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnSuccess {
|
||||
ToastUtils.show(R.string.doSuccess)
|
||||
mCallBack?.onSuccess()
|
||||
dismiss()
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ import com.chwl.app.common.EmptyViewHelper
|
||||
import com.chwl.app.common.widget.dialog.DialogManager
|
||||
import com.chwl.app.databinding.DialogRoomBgSetBinding
|
||||
import com.chwl.app.databinding.ItemRoomBgSetBinding
|
||||
import com.chwl.app.ui.utils.loadImage
|
||||
import com.chwl.core.bean.response.ServiceResult
|
||||
import com.chwl.core.gift.bean.RoomBgInfo
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
@@ -259,9 +258,13 @@ class RoomBgSetDialog : BaseDialogFragment<DialogRoomBgSetBinding>() {
|
||||
|
||||
data?.let { data ->
|
||||
|
||||
binding.bg.loadImage(data.url ?: "")
|
||||
binding.bg.loadUrl(data.url ?: "")
|
||||
binding.select.setVis(data.isCur)
|
||||
|
||||
|
||||
binding.statusPlay.setVis(data.url?.endsWith(".svga") == true)
|
||||
binding.statusGif.setVis(data.url?.endsWith(".svga") == true)
|
||||
|
||||
if (data.type == RoomBgInfo.Type.T_FREE) {
|
||||
|
||||
val bindingAdapterPosition = helper.bindingAdapterPosition
|
||||
@@ -271,6 +274,8 @@ class RoomBgSetDialog : BaseDialogFragment<DialogRoomBgSetBinding>() {
|
||||
}
|
||||
binding.statusLimit.setVis(bindingAdapterPosition == 0)
|
||||
|
||||
|
||||
|
||||
} else if (data.type == RoomBgInfo.Type.T_PAY) {
|
||||
|
||||
//有时长显示 左上角剩余时间
|
||||
@@ -279,8 +284,6 @@ class RoomBgSetDialog : BaseDialogFragment<DialogRoomBgSetBinding>() {
|
||||
binding.statusLimit.changeSoildColor(R.color.black_transparent_50.getColor())
|
||||
|
||||
|
||||
binding.statusPlay.setVis(data.url?.endsWith(".svga") == true)
|
||||
binding.statusGif.setVis(data.url?.endsWith(".svga") == true)
|
||||
|
||||
|
||||
|
||||
|
@@ -28,6 +28,8 @@
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="240dp"
|
||||
android:scaleType="fitXY"
|
||||
app:autoPlay="true"
|
||||
app:loopCount="-1"
|
||||
android:layout_height="520dp" />
|
||||
|
||||
<ImageView
|
||||
|
@@ -9,32 +9,47 @@
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
tools:background="@color/black">
|
||||
|
||||
<com.chwl.app.common.widget.RectRoundImageView
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="@dimen/dp_135"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:src="@drawable/bg_login"
|
||||
app:borderRadius="@dimen/dp_10"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/bgView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@color/transparent"
|
||||
app:cardCornerRadius="@dimen/dp_10"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:type="round" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<com.chwl.library.widget.SVGAView
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="@dimen/dp_135"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:scaleType="fitXY"
|
||||
app:autoPlay="true"
|
||||
app:loopCount="1"
|
||||
app:fillMode="Backward"
|
||||
tools:src="@drawable/bg_login" />
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<com.chwl.library.widget.text.DrawableTextView
|
||||
android:id="@+id/select"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:dt_drawableType="shape"
|
||||
app:dt_radius="@dimen/dp_9"
|
||||
app:dt_soildColor="@color/transparent"
|
||||
app:dt_strikeColor="#FF8C03"
|
||||
app:dt_strikeWidth="@dimen/dp_2"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/bg"
|
||||
tools:visibility="gone" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/bgView"
|
||||
app:layout_constraintEnd_toEndOf="@id/bgView"
|
||||
app:layout_constraintStart_toStartOf="@id/bgView"
|
||||
app:layout_constraintTop_toTopOf="@id/bgView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
<com.chwl.library.widget.text.DrawableTextView
|
||||
@@ -53,8 +68,8 @@
|
||||
app:dt_drawableType="shape"
|
||||
app:dt_radius="@dimen/dp_10"
|
||||
app:dt_soildColor="#80000000"
|
||||
app:layout_constraintStart_toStartOf="@id/bg"
|
||||
app:layout_constraintTop_toTopOf="@id/bg"
|
||||
app:layout_constraintStart_toStartOf="@id/bgView"
|
||||
app:layout_constraintTop_toTopOf="@id/bgView"
|
||||
tools:text="@string/Original"
|
||||
tools:visibility="visible" />
|
||||
|
||||
@@ -68,7 +83,7 @@
|
||||
android:src="@drawable/ic_draw_w_arrow"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/statusPlay"
|
||||
app:layout_constraintTop_toTopOf="@id/bg"
|
||||
app:layout_constraintTop_toTopOf="@id/bgView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
@@ -79,8 +94,8 @@
|
||||
android:layout_marginEnd="@dimen/dp_6"
|
||||
android:src="@drawable/ic_draw_w_arrow"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@id/bg"
|
||||
app:layout_constraintTop_toTopOf="@id/bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/bgView"
|
||||
app:layout_constraintTop_toTopOf="@id/bgView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
@@ -91,8 +106,8 @@
|
||||
android:layout_marginEnd="@dimen/dp_6"
|
||||
android:src="@drawable/ic_delete_room_album"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@id/bg"
|
||||
app:layout_constraintTop_toTopOf="@id/bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/bgView"
|
||||
app:layout_constraintTop_toTopOf="@id/bgView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
@@ -110,9 +125,9 @@
|
||||
app:dt_drawableLeftHeight="@dimen/dp_20"
|
||||
app:dt_drawableLeftSrc="@drawable/ic_coin_84"
|
||||
app:dt_drawableLeftWidth="@dimen/dp_20"
|
||||
app:layout_constraintEnd_toEndOf="@id/bg"
|
||||
app:layout_constraintStart_toStartOf="@id/bg"
|
||||
app:layout_constraintTop_toBottomOf="@id/bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/bgView"
|
||||
app:layout_constraintStart_toStartOf="@id/bgView"
|
||||
app:layout_constraintTop_toBottomOf="@id/bgView"
|
||||
tools:text="11111"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class SVGAView : SVGAImageView, ILog {
|
||||
}
|
||||
}
|
||||
|
||||
fun loadUrl(url: String?) {
|
||||
fun loadUrl(url: String?,autoPayer:Boolean = true) {
|
||||
logD("loadUrl() url:$url")
|
||||
if (url.isNullOrEmpty()) {
|
||||
this.resourceUrl = null
|
||||
@@ -96,23 +96,28 @@ class SVGAView : SVGAImageView, ILog {
|
||||
if (url == resourceUrl && drawable is SVGADrawable) {
|
||||
logD("loadUrl() 已加载 isAnimating:$isAnimating")
|
||||
if (!isAnimating) {
|
||||
startAnimation()
|
||||
if (autoPayer) {
|
||||
startAnimation()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
this.setImageDrawable(null)
|
||||
this.resourceUrl = url
|
||||
val cacheItem = svgaCache?.get(url)
|
||||
if (cacheItem != null) {
|
||||
logD("loadUrl() 有缓存")
|
||||
this@SVGAView.setImageDrawable(SVGADrawable(cacheItem))
|
||||
this@SVGAView.startAnimation()
|
||||
if (autoPayer) {
|
||||
this@SVGAView.startAnimation()
|
||||
}
|
||||
return
|
||||
}
|
||||
loadSVGAUrl(url)
|
||||
loadSVGAUrl(url,autoPayer)
|
||||
}
|
||||
|
||||
private fun loadSVGAUrl(url: String) {
|
||||
private fun loadSVGAUrl(url: String,autoPayer:Boolean = true) {
|
||||
logD("loadSVGAUrl url:$url")
|
||||
GlideUtils.instance().downloadFromUrl(context,url,object : RequestListener<File?> {
|
||||
override fun onLoadFailed(
|
||||
@@ -139,7 +144,7 @@ class SVGAView : SVGAImageView, ILog {
|
||||
val path = resource.path
|
||||
logD("loadSVGAUrl onDownloadCompleted url:$url path:$path")
|
||||
if (resourceUrl == url) {
|
||||
loadSVGAFile(url, path)
|
||||
loadSVGAFile(url, path,autoPayer)
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -148,7 +153,7 @@ class SVGAView : SVGAImageView, ILog {
|
||||
|
||||
}
|
||||
|
||||
private fun loadSVGAFile(url: String, path: String) {
|
||||
private fun loadSVGAFile(url: String, path: String,autoPayer:Boolean = true) {
|
||||
try {
|
||||
logD("loadSVGAFile path:$path url:$url")
|
||||
val inputStream = BufferedInputStream(FileInputStream(path))
|
||||
@@ -163,7 +168,9 @@ class SVGAView : SVGAImageView, ILog {
|
||||
}
|
||||
svgaCache?.put(resourceUrl ?: "", videoItem)
|
||||
this@SVGAView.setImageDrawable(SVGADrawable(videoItem))
|
||||
this@SVGAView.startAnimation()
|
||||
if (autoPayer) {
|
||||
this@SVGAView.startAnimation()
|
||||
}
|
||||
onViewStateChanged(1)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user