diff --git a/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java index b21383f87..6155afba4 100644 --- a/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java +++ b/common/src/main/java/com/yunbao/common/bean/XydCompleteModel.java @@ -1,6 +1,5 @@ package com.yunbao.common.bean; -import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; public class XydCompleteModel extends BaseModel { @@ -64,6 +63,17 @@ public class XydCompleteModel extends BaseModel { private String equipment; @SerializedName("bubble") private String bubble; + @SerializedName("xydgiftname") + private String xydgiftname; + + public String getXydgiftname() { + return xydgiftname; + } + + public XydCompleteModel setXydgiftname(String xydgiftname) { + this.xydgiftname = xydgiftname; + return this; + } public String getMethod() { return method; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index fe3e1a885..cadaa3f2c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1309,7 +1309,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case XYD_COMPLETE: if (manager != null) { - manager.showXydComplete(event.getXydCompleteModel()); + manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean()); } break; diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 8b065d7ec..e1ed47740 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -11,6 +11,7 @@ import com.yunbao.common.bean.WishModel; import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.live.bean.LivePKUserListBean; +import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.OpenParametersModel; public class LiveAudienceEvent extends BaseModel { @@ -39,6 +40,16 @@ public class LiveAudienceEvent extends BaseModel { private String uname; private WishModel wishListProgress; private XydCompleteModel xydCompleteModel; + private LiveReceiveGiftBean liveReceiveGiftBean; + + public LiveReceiveGiftBean getLiveReceiveGiftBean() { + return liveReceiveGiftBean; + } + + public LiveAudienceEvent setLiveReceiveGiftBean(LiveReceiveGiftBean liveReceiveGiftBean) { + this.liveReceiveGiftBean = liveReceiveGiftBean; + return this; + } public XydCompleteModel getXydCompleteModel() { return xydCompleteModel; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index c7bf249b4..9d03bcd4f 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -287,7 +287,7 @@ public class LiveGiftAnimPresenter { } public ConcurrentLinkedQueue getmQueue() { - return mQueue; + return mGifQueue; } private void downLoadIconGifCallback() { @@ -1074,7 +1074,7 @@ public class LiveGiftAnimPresenter { /** * 显示gif礼物 比如油纸伞 */ - private void showGifGift(final LiveReceiveGiftBean bean) { + public void showGifGift(final LiveReceiveGiftBean bean) { String url = bean.getGifUrl(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 8879a2222..2c4dd2482 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -602,7 +602,8 @@ public class SocketRyClient { XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class); EventBus.getDefault().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE) - .setXydCompleteModel(xydCompleteModel)); + .setXydCompleteModel(xydCompleteModel) + .setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class))); break; case Constants.WISH_LIST_PROGRESS: StringBuffer conString = new StringBuffer(); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 6b9cb1cd3..deb32880f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -353,7 +353,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ImageView mAnchorSayHide; //----!主播说组件---// private Banner topBanner1;//心愿单&联系方式 - private SVGAImageView xydSvg; public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; @Subscribe(threadMode = ThreadMode.MAIN) @@ -580,17 +579,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - private Runnable xydCompleteRunnable = new Runnable() { - @Override - public void run() { - xydSvg.setVisibility(View.GONE); - if (xydCompleteModels.size() > 0) - showXydComplete(xydCompleteModels.get(0), true); - } - }; List xydCompleteModels = new ArrayList<>(); - public synchronized void showXydComplete(XydCompleteModel model, boolean isRunble) { + public synchronized void showXydComplete(XydCompleteModel model, boolean isRunble, LiveReceiveGiftBean liveReceiveGiftBean) { if (model.getLiveId().equals(mLiveUid)) { if (!isRunble) { @@ -598,43 +589,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bean.setContent(model.getMsg()); bean.setUserNiceName(model.getUserName()); - bean.setAtUserName(model.getGiftname()) + bean.setAtUserName(model.getXydgiftname()) .setLevel(model.getLevel()); bean.setType(LiveChatBean.XYD_COMPLETE); mLiveChatAdapter.insertItem(bean); xydCompleteModels.add(model); } - - if (mLiveGiftAnimPresenter != null && mLiveGiftAnimPresenter.getmQueue().size() > 0) { - new Handler().postDelayed(xydCompleteRunnable, 1000); - } else { - try { - xydSvg.setLoops(1); - xydSvg.setVisibility(View.VISIBLE); - new SVGAParser(Contexts).parse(new URL(model.getSvg()), new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - xydSvg.setImageDrawable(drawable); - - SVGAViewUtils.playEndClear(xydSvg); - - } - - @Override - public void onError() { - } - - }); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - - if (xydCompleteModels.size() > 0) { - xydCompleteModels.remove(0); - new Handler().postDelayed(xydCompleteRunnable, 1000); - } + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); } + liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName()); + mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean); + } } @@ -1422,7 +1388,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1); new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); - xydSvg = (SVGAImageView) findViewById(R.id.xyd_svg); } /** diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index bcdb921ee..1ee7a16c8 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1980,9 +1980,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } - public void showXydComplete(XydCompleteModel model) { + public void showXydComplete(XydCompleteModel model, LiveReceiveGiftBean liveReceiveGiftBean) { if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.showXydComplete(model, false); + mLiveRoomViewHolder.showXydComplete(model, false,liveReceiveGiftBean); } } } diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 51c32a909..4b173dd33 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -701,8 +701,8 @@ android:layout_width="52dp" android:layout_height="76dp" android:layout_below="@+id/live_rank_pk" - android:layout_marginTop="20dp" android:layout_alignParentRight="true" + android:layout_marginTop="20dp" android:layout_marginRight="5dp" app:delay_time="5000" app:indicator_height="8dp" @@ -2355,12 +2355,6 @@ android:layout_marginTop="60dp" android:visibility="gone" /> - + + \ No newline at end of file