diff --git a/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java b/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java index 49395e080..d4ca2674d 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java @@ -43,6 +43,7 @@ public class FullServiceNotificationView extends FrameLayout { private RelativeLayout contextLayout; private long animationTime = 8600; private String userName = "熱度卡如何獲得?", userText = "前往「個人中心」-「我的包裹」中,即可使用熱度卡。"; + private String anchorId = ""; public FullServiceNotificationView(@NonNull Context context) { super(context); @@ -64,6 +65,12 @@ public class FullServiceNotificationView extends FrameLayout { this.userText = userText; rcUserText.setText(":" + userText); rcUserName.setGradientColor(Color.parseColor("#FFFFFF"), Color.parseColor("#FFEF00")); + rcUserName.setText(userName); + return this; + } + + public FullServiceNotificationView setAnchorId(String anchorId) { + this.anchorId = anchorId; return this; } @@ -79,6 +86,16 @@ public class FullServiceNotificationView extends FrameLayout { contextLayout = rootView.findViewById(R.id.context_layout); gotoRoomView.setVisibility(GONE); contextLayout.setVisibility(GONE); + //点击跳转直播间 + gotoRoomView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + + if (callBack != null) { + callBack.goToLive(); + } + } + }); } @@ -156,15 +173,18 @@ public class FullServiceNotificationView extends FrameLayout { if (frame == 12) { gotoRoomView.setVisibility(VISIBLE); contextLayout.setVisibility(VISIBLE); - contextLayout.post(() -> { - TranslateAnimation animationTranslate = new TranslateAnimation(0, -contextLayout.getMeasuredWidth(), 0, 0); - AnimationSet animationSet1 = new AnimationSet(true); - animationSet1.addAnimation(animationTranslate); - animationSet1.setFillAfter(true); - animationSet1.setDuration((animationTime - 800) / 2); - animationSet1.setAnimationListener(animationListener); - contextLayout.startAnimation(animationSet1); - }); + if ((userName.length()+userText.length())>13){ + contextLayout.post(() -> { + TranslateAnimation animationTranslate = new TranslateAnimation(0, -contextLayout.getMeasuredWidth(), 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration((animationTime - 800) / 2); + animationSet1.setAnimationListener(animationListener); + contextLayout.startAnimation(animationSet1); + }); + } + } if (frame == 165) { gotoRoomView.setVisibility(GONE); @@ -235,4 +255,15 @@ public class FullServiceNotificationView extends FrameLayout { return this; } } + + private FullServiceNotificationViewCallBack callBack; + + public FullServiceNotificationView setCallBack(FullServiceNotificationViewCallBack callBack) { + this.callBack = callBack; + return this; + } + + public interface FullServiceNotificationViewCallBack { + void goToLive(); + } } 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 36c08a244..80cd7e821 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -91,6 +91,7 @@ import com.yunbao.live.adapter.LiveChatAdapter; import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter; import com.yunbao.live.adapter.LiveUserAdapter; import com.yunbao.live.bean.DrPkbean; +import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveDanMuBean; @@ -110,12 +111,14 @@ import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveDanmuPresenter; import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -2885,6 +2888,44 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void showFullScreen(MsgModel msgModel) { fullScreen.setUserNameAndUserText(msgModel.getUserName(), msgModel.getTrumpetMsg()) - .setType(msgModel.getRoleType()); + .setType(msgModel.getRoleType()) + .setCallBack(() -> gotoLive(msgModel.getAnchorId())); + } + + /** + * 前往直播间 + */ + private void gotoLive(final String liveId) { + LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { + if (liveBean1 == null) { + return; + } + if (LivePlayRyViewHolder.Micing == 1) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(1) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); + } else if (LivePlayRyViewHolder.Micing == 2) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(2) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); + } else { + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + } + + }); + mCheckLivePresenter.checkLive(liveBean); + + } else { + RouteUtil.forwardUserHome(mContext, liveId, 0); + } + } + }); } }