77 签约房开始webp动画,练歌房右侧麦上用户刷新。
This commit is contained in:
@@ -48,6 +48,7 @@ import com.xscm.moduleutil.widget.RoomKtvWheatView;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
private MusicSongBean musicSongBean;
|
||||
RoomFragment parentFragment;
|
||||
BaseQuickAdapter<RoomPitBean, BaseViewHolder> adapter;
|
||||
|
||||
private List<RoomPitBean> mSongPitList = new ArrayList<>();
|
||||
VolumeManager volumeManager;
|
||||
|
||||
public RoomKtvFragment() {
|
||||
@@ -172,7 +173,6 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
}
|
||||
|
||||
if (roomInfoResp.getSong_pit_list() != null && !roomInfoResp.getSong_pit_list().isEmpty()) {
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
for (RoomPitBean roomPitBean : roomInfoResp.getSong_pit_list()) {
|
||||
if (roomPitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
|
||||
@@ -182,6 +182,12 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
sv();
|
||||
tzblChanged();
|
||||
|
||||
@@ -308,6 +314,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
mBinding.llTiaoyt.setOnClickListener(this::onClick);
|
||||
mBinding.llQg.setOnClickListener(this::onClick);
|
||||
mBinding.llSz.setOnClickListener(this::onClick);
|
||||
mSongPitList.clear();
|
||||
adapter = new BaseQuickAdapter<RoomPitBean, BaseViewHolder>(R.layout.item_room_charm_rank) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomPitBean item) {
|
||||
@@ -338,6 +345,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
});
|
||||
}
|
||||
};
|
||||
adapter.setNewData(mSongPitList);
|
||||
if (getActivity() != null && getActivity() instanceof RoomActivity) {
|
||||
Objects.requireNonNull(((RoomActivity) getActivity()).getBinding()).recyclerView.setAdapter(adapter);
|
||||
}
|
||||
@@ -751,7 +759,12 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
AgoraManager.getInstance().muteLocalAudioStream(false);
|
||||
}
|
||||
}
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
sv();
|
||||
}
|
||||
|
||||
@@ -771,7 +784,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
AgoraManager.getInstance().muteLocalAudioStream(true);
|
||||
}
|
||||
} else {
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
sv();
|
||||
}
|
||||
@@ -787,10 +804,15 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
pitBean.setCharm("0");
|
||||
mBinding.muJb.setData(pitBean);
|
||||
|
||||
for (int i = 0; i < roomInfoResp.getSong_pit_list().size(); i++) {
|
||||
roomInfoResp.getSong_pit_list().get(i).setCharm("0");
|
||||
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
for (int i = 0; i < roomInfoResp.getSong_pit_list().size(); i++) {
|
||||
roomInfoResp.getSong_pit_list().get(i).setCharm("0");
|
||||
}
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void event1005(RoomMessageEvent messageEvent) {
|
||||
@@ -812,7 +834,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
}
|
||||
|
||||
// 更新麦位列表数据
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
@@ -882,7 +908,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
break;
|
||||
}
|
||||
}
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 在离线
|
||||
@@ -912,7 +942,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
break;
|
||||
}
|
||||
}
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void event1035(RoomMessageEvent messageEvent) {
|
||||
@@ -952,7 +986,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
roomInfoResp.getSong_pit_list().get(i).setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||||
}
|
||||
}
|
||||
adapter.setNewData(roomInfoResp.getSong_pit_list());
|
||||
mSongPitList.clear();
|
||||
if (roomInfoResp.getSong_pit_list() != null){
|
||||
mSongPitList.addAll(roomInfoResp.getSong_pit_list());
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.vectordrawable.graphics.drawable.Animatable2Compat
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.integration.webp.decoder.WebpDrawable
|
||||
import com.bumptech.glide.integration.webp.decoder.WebpDrawableTransformation
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterInside
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.databinding.DialogSignTypeBinding
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||
|
||||
class DialogSignType(context:Context) : BaseDialog<DialogSignTypeBinding>(context){
|
||||
@@ -52,25 +64,84 @@ class DialogSignType(context:Context) : BaseDialog<DialogSignTypeBinding>(contex
|
||||
0 ->{
|
||||
mBinding.groupFail.visibility = View.GONE
|
||||
mBinding.ivStart.visibility = View.VISIBLE
|
||||
loadWebpOneStart(R.drawable.iv_start, mBinding.ivStart)
|
||||
mBinding.ivSuccess.visibility = View.GONE
|
||||
}
|
||||
1 ->{
|
||||
mBinding.groupFail.visibility = View.GONE
|
||||
mBinding.ivStart.visibility = View.GONE
|
||||
mBinding.ivSuccess.visibility = View.VISIBLE
|
||||
window?.decorView?.postDelayed({
|
||||
dismiss()
|
||||
}, 1500)
|
||||
}
|
||||
2 ->{
|
||||
mBinding.groupFail.visibility = View.VISIBLE
|
||||
mBinding.ivStart.visibility = View.GONE
|
||||
mBinding.ivSuccess.visibility = View.GONE
|
||||
|
||||
window?.decorView?.postDelayed({
|
||||
dismiss()
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
|
||||
window?.decorView?.postDelayed({
|
||||
dismiss()
|
||||
}, 1500)
|
||||
|
||||
|
||||
}
|
||||
var webpDrawable:WebpDrawable? = null
|
||||
fun loadWebpOneStart(webp_anim: Int, mAnimView: ImageView?) {
|
||||
if (mAnimView == null) {
|
||||
return
|
||||
}
|
||||
// 1. 本地资源专属优化配置
|
||||
val options = RequestOptions() // 强制限制解码尺寸为ImageView显示尺寸(核心优化)
|
||||
.override(800, 800) // 本地图用原尺寸,或指定固定尺寸
|
||||
|
||||
//webp动图
|
||||
val transformation = CenterInside()
|
||||
Glide.with(mAnimView)
|
||||
.load(webp_anim) //不是本地资源就改为url即可
|
||||
.apply(options)
|
||||
.optionalTransform(transformation)
|
||||
.optionalTransform(WebpDrawable::class.java, WebpDrawableTransformation(transformation))
|
||||
.addListener(object : RequestListener<Drawable> {
|
||||
override fun onLoadFailed(
|
||||
e: GlideException?,
|
||||
model: Any,
|
||||
target: Target<Drawable>,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: Drawable,
|
||||
model: Any,
|
||||
target: Target<Drawable>,
|
||||
dataSource: DataSource,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
webpDrawable = resource as WebpDrawable
|
||||
//需要设置为循环1次才会有onAnimationEnd回调
|
||||
webpDrawable?.loopCount = 1
|
||||
webpDrawable?.registerAnimationCallback(object :
|
||||
Animatable2Compat.AnimationCallback() {
|
||||
override fun onAnimationStart(drawable: Drawable) {
|
||||
super.onAnimationStart(drawable)
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(drawable: Drawable) {
|
||||
super.onAnimationEnd(drawable)
|
||||
webpDrawable?.unregisterAnimationCallback(this)
|
||||
dismiss()
|
||||
}
|
||||
})
|
||||
|
||||
return false
|
||||
}
|
||||
})
|
||||
.into(mAnimView)
|
||||
}
|
||||
|
||||
}
|
||||
BIN
MainModule/src/main/res/drawable/iv_start.webp
Normal file
BIN
MainModule/src/main/res/drawable/iv_start.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
Reference in New Issue
Block a user