Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-12-29 16:17:14 +08:00
commit df36529619
6 changed files with 150 additions and 22 deletions

View File

@ -0,0 +1,47 @@
package com.yunbao.common.event;
public class AnchorInfoEvent {
protected boolean clear;
protected String id;
protected String userNiceName;
protected String avatar;
public AnchorInfoEvent(boolean clears,String ids, String userNiceNames,String avatars) {
clear = clears;
id = ids;
userNiceName = userNiceNames;
avatar = avatars;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserNiceName() {
return userNiceName;
}
public void setUserNiceName(String userNiceName) {
this.userNiceName = userNiceName;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public boolean isClear() {
return clear;
}
public void setClear(boolean clear) {
this.clear = clear;
}
}

View File

@ -38,6 +38,8 @@ import com.alibaba.fastjson.JSONObject;
import com.tencent.trtc.TRTCCloud;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
@ -392,10 +394,10 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
((LiveRyAnchorActivity) mContext).setPkBtnVisible(true);
}
//如果PK结束Im没有发送关闭PK的消息倒计时结束自动关闭
if (mLiveLinkMicPkViewHolder != null) {
mLiveLinkMicPkViewHolder.removeFromParent();
mLiveLinkMicPkViewHolder.release();
}
// if (mLiveLinkMicPkViewHolder != null) {
// mLiveLinkMicPkViewHolder.removeFromParent();
// mLiveLinkMicPkViewHolder.release();
// }
mLiveLinkMicPkViewHolder = null;
}
}
@ -608,6 +610,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 主播与主播PK PK主播发过来的已经接受
*/
public void onLinkMicToPk(UserBean u) {
EventBus.getDefault().post(new AnchorInfoEvent(false,u.getId(), u.getUserNiceName(),u.getAvatar()));
Log.e("eve", u.getId() + "");
/**
* 加入副房间
@ -770,6 +773,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
EventBus.getDefault().post(new AnchorInfoEvent(false,bean.getId(), bean.getUserNiceName(),bean.getAvatar()));
if (bean != null && bean.isRandomPk()) {
msg1.put("random_pk", bean.isRandomPk() ? 1 : 0);
msg1.put("is_ladders", bean.getRankPkImgUrl());
@ -1057,6 +1062,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 退出多人PK
*/
public static void leaveDRRoom() {
//清理PK上面对方的头像
EventBus.getDefault().post(new AnchorInfoEvent(true,"", "",""));
Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0;
for (int i = 0; i < inputStreamList.size(); i++) {

View File

@ -190,10 +190,14 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
public void setTime(String content) {
if (mTime != null) {
Log.i("vvvs",content);
if(content.trim().equals("00:01")||content.trim().equals("00:00")){
mTime.setText("計算中");
}else {
mTime.setText(content);
}
}
}
public void onEnterRoomPkStart() {
if (mFrameImageView != null) {

View File

@ -25,6 +25,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
import com.makeramen.roundedimageview.RoundedImageView;
import com.tencent.liteav.device.TXDeviceManager;
import com.tencent.rtmp.ITXLivePushListener;
import com.tencent.rtmp.TXLiveConstants;
@ -33,6 +34,9 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
@ -53,6 +57,8 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketSendBean;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
@ -100,10 +106,30 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public static RCRTCLiveInfo rcrtcLiveInfo;
private ViewGroup liveActivityContainer;
private TextView tv_avatarOther_name;
private ImageView avatarOther;
private LinearLayout goto_room_view;
//修改上面主播的头像
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUPAnchorInfo(AnchorInfoEvent e) {
if (e != null) {
if(e.isClear()==false) {
tv_avatarOther_name.setText(e.getUserNiceName());
ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther);
goto_room_view.setVisibility(View.VISIBLE);
}else{
goto_room_view.setVisibility(View.GONE);
}
}
}
public LivePushRyViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
this.contexts = context;
EventBus.getDefault().register(this);
}
@Override
@ -379,6 +405,10 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
dr_pk_view.setVisibility(View.GONE);
btn_close = (TextView) findViewById(R.id.btn_close);
tv_avatarOther_name = (TextView) findViewById(R.id.tv_avatarOther_name);
avatarOther = (ImageView) findViewById(R.id.avatarOther);
goto_room_view = (LinearLayout) findViewById(R.id.goto_room_view);
goto_room_view.setVisibility(View.GONE);
mMainHandler = new Handler(Looper.getMainLooper());
btn_close.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -104,6 +104,46 @@
android:layout_height="match_parent"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:layout_alignParentRight="true"
android:layout_marginTop="122dp"
android:layout_marginRight="9dp"
android:background="@drawable/bg_live_other_ico"
android:gravity="center">
<RelativeLayout
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginLeft="3dp"
android:gravity="center">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatarOther"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:riv_oval="true" />
</RelativeLayout>
<TextView
android:id="@+id/tv_avatarOther_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="3dp"
android:maxLength="4"
android:maxLines="1"
android:text=""
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
@ -127,6 +167,21 @@
/>
</FrameLayout>
<TextView android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="400dp"
android:layout_marginRight="8dp"
android:layout_alignParentRight="true"
android:text="結束連麥"
android:textSize="13sp"
android:visibility="gone"
android:textColor="@color/color_white"
android:background="@drawable/background_dedede"/>
<com.yunbao.live.custom.MyFrameLayout3
@ -139,21 +194,6 @@
app:mfl3_ratio="0.25"
/>
<TextView android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="120dp"
android:layout_marginRight="8dp"
android:layout_alignParentRight="true"
android:text="結束連麥"
android:textSize="13sp"
android:textColor="@color/color_white"
android:visibility="gone"
android:background="@drawable/background_dedede"/>
<ImageView

View File

@ -2116,7 +2116,6 @@
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@mipmap/voice" />
</RelativeLayout>