修复:多人Pk结束动画问题

This commit is contained in:
18401019693 2022-12-12 18:16:53 +08:00
parent f024283e80
commit 869ad9adf7
2 changed files with 36 additions and 28 deletions

View File

@ -295,7 +295,8 @@ public class SocketRyClient {
} }
} else if (action3 == 5) { } else if (action3 == 5) {
// endDRGif(); EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
if (LiveRyAnchorActivity.mLiveAnchorViewHolder != null) { if (LiveRyAnchorActivity.mLiveAnchorViewHolder != null) {
dr_pk_view.setVisibility(View.GONE); dr_pk_view.setVisibility(View.GONE);

View File

@ -331,6 +331,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//全服通知 //全服通知
private ImageView customFullServiceNotify; private ImageView customFullServiceNotify;
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView); super(context, parentView);
Contexts = context; Contexts = context;
@ -434,7 +435,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/** /**
* pk时间倒计时 * pk时间倒计时
*/ */
public static void changePkTime() { public void changePkTime() {
Log.i("tvt", mPkTimeCount + ""); Log.i("tvt", mPkTimeCount + "");
mPkTimeCount--; mPkTimeCount--;
if (mPkTimeCount > 0) {// if (mPkTimeCount > 0) {//
@ -449,34 +450,37 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mHandler != null) { if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null); mHandler.removeCallbacksAndMessages(null);
} }
// endDRGif(); endDRGif();
} }
} }
public void endDRGif() { public void endDRGif() {
dr_pk_end_gif.setVisibility(View.VISIBLE); if (dr_pk_end_gif.getVisibility() == View.GONE) {
RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置 dr_pk_end_gif.setVisibility(View.VISIBLE);
Glide.with(Contexts).asGif() RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置
.apply(options)//应用配置 Glide.with(Contexts).asGif()
.load(R.mipmap.drpkend) .apply(options)//应用配置
.listener(new RequestListener<GifDrawable>() { .load(R.mipmap.drpkend)
@Override .listener(new RequestListener<GifDrawable>() {
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) { @Override
return false; public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
} return false;
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
if (resource instanceof GifDrawable) {
resource.setLoopCount(1);//只播放一次
} }
//发送延时消息通知动画结束
mHandler.sendEmptyMessageDelayed(1, @Override
3000); public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
return false; if (resource instanceof GifDrawable) {
} resource.setLoopCount(1);//只播放一次
}) }
.into(dr_pk_end_gif); //发送延时消息通知动画结束
mHandler.sendEmptyMessageDelayed(1,
3000);
return false;
}
})
.into(dr_pk_end_gif);
}
} }
@ -491,7 +495,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
d_pk_view.setVisibility(View.VISIBLE); d_pk_view.setVisibility(View.VISIBLE);
if (time != 0) { if (time != 0) {
mPkTimeCount = time; mPkTimeCount = time;
changePkTime(); mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
} }
@ -644,7 +648,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
img.setImageResource(R.mipmap.icon_no4); img.setImageResource(R.mipmap.icon_no4);
} else if (j == 5) { } else if (j == 5) {
img.setImageResource(R.mipmap.icon_no5); img.setImageResource(R.mipmap.icon_no5);
}else { } else {
img.setImageResource(R.mipmap.icon_no1); img.setImageResource(R.mipmap.icon_no1);
} }
@ -3805,6 +3809,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
case CUSTOM_FULL_SERVICE_NOTIFY: case CUSTOM_FULL_SERVICE_NOTIFY:
customFullServiceNotify(event.getCustomFullServiceNotifyEvent()); customFullServiceNotify(event.getCustomFullServiceNotifyEvent());
break; break;
case PK_TIME_COUNT:
endDRGif();
break;
} }
} }
@ -3829,7 +3836,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
customFullServiceNotify.startAnimation(inAlphaAnimation); customFullServiceNotify.startAnimation(inAlphaAnimation);
customFullServiceNotify.setVisibility(View.VISIBLE); customFullServiceNotify.setVisibility(View.VISIBLE);
ImgLoader.display(mContext,customFullServiceNotifyEvent.getImg(),customFullServiceNotify); ImgLoader.display(mContext, customFullServiceNotifyEvent.getImg(), customFullServiceNotify);
customFullHandler.postDelayed(customFullRunnable, handlerDuration * 1000); customFullHandler.postDelayed(customFullRunnable, handlerDuration * 1000);
} else {//文字通知 } else {//文字通知