Merge branch 'dev_pkrank'

This commit is contained in:
zlzw 2022-11-16 15:03:51 +08:00
commit 0a090301df
21 changed files with 367 additions and 30 deletions

View File

@ -138,7 +138,7 @@ public class AppContext extends CommonAppContext {
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis()); CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
registerError(); registerError();
registerFirebaseCrash(); registerFirebaseCrash();
// LogUtils.start(this); LogUtils.start(this);
sInstance = this; sInstance = this;
L.setDeBug(BuildConfig.DEBUG); L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this); AppEventsLogger.activateApp(this);

View File

@ -169,6 +169,7 @@ public class Constants {
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手 public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功 public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
public static final String SUPER_VISION = "supervision";//超级发言警告 public static final String SUPER_VISION = "supervision";//超级发言警告
public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据
//游戏socket //游戏socket
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 public static final String SOCKET_GAME_ZJH = "startGame";//炸金花

View File

@ -0,0 +1,88 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
/**
* 直播间PK排位赛
*/
public class PkRankBean extends BaseModel {
@SerializedName("anchor_id")
public int id;
@SerializedName("rank_name")
public String name;
@SerializedName("rank_img")
public String img;
@SerializedName("win_continuity1")
public String redVal;
@SerializedName("win_continuity2")
public String blueVal;
@SerializedName("pktt_img")
public String pkTopImgUrl;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getRedVal() {
if (StringUtil.isEmpty(redVal)) {
redVal = "0";
}
return redVal;
}
public void setRedVal(String redVal) {
this.redVal = redVal;
}
public String getBlueVal() {
if (StringUtil.isEmpty(blueVal)) {
blueVal = "0";
}
return blueVal;
}
public void setBlueVal(String blueVal) {
this.blueVal = blueVal;
}
public String getPkTopImgUrl() {
return pkTopImgUrl;
}
public void setPkTopImgUrl(String pkTopImgUrl) {
this.pkTopImgUrl = pkTopImgUrl;
}
@Override
public String toString() {
return "PkRankBean{" +
"id=" + id +
", name='" + name + '\'' +
", img='" + img + '\'' +
", redVal='" + redVal + '\'' +
", blueVal='" + blueVal + '\'' +
", pkTopImgUrl='" + pkTopImgUrl + '\'' +
'}';
}
}

View File

@ -29,7 +29,7 @@ public class ImgLoader {
private static final boolean SKIP_MEMORY_CACHE = true; private static final boolean SKIP_MEMORY_CACHE = true;
private static BlurTransformation sBlurTransformation; private static BlurTransformation sBlurTransformation;
private final static float thumbnail = 0.1f; private final static float thumbnail = 1.0f;
static { static {
sBlurTransformation = new BlurTransformation(25); sBlurTransformation = new BlurTransformation(25);

View File

@ -14,6 +14,7 @@ import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.SlideInBannerModel;
@ -262,4 +263,10 @@ public interface PDLiveApi {
*/ */
@GET("/api/public/?service=Task.sendTaskGift") @GET("/api/public/?service=Task.sendTaskGift")
Observable<ResponseModel<List<Observable>>> sendTaskGift(@Query("flag") String flag, @Query("type") String type); Observable<ResponseModel<List<Observable>>> sendTaskGift(@Query("flag") String flag, @Query("type") String type);
/**
* PK排位赛接口
*/
@GET("/api/public/?service=Ranking.getAnchorRankData")
Observable<ResponseModel<PkRankBean>> getPkRanksList(@Query("anchor_id") String anchorId,@Query("anchor_id2")String pkUid);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -120,8 +120,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;//主播与主播连麦逻辑 protected LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;//主播与主播连麦逻辑
protected LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;//主播与主播PK逻辑 protected LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;//主播与主播PK逻辑
public static LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;//主播与主播PK逻辑 public static LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;//主播与主播PK逻辑
public static SocketClient mSocketClient; public SocketClient mSocketClient;
public static SocketRyClient mSocketRyClient; public SocketRyClient mSocketRyClient;
protected LiveBean mLiveBean; protected LiveBean mLiveBean;
protected int mLiveSDK;//sdk类型 0金山 1腾讯 protected int mLiveSDK;//sdk类型 0金山 1腾讯
@ -706,7 +706,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 主播与主播PK 所有人收到PK开始的回调 * 主播与主播PK 所有人收到PK开始的回调
*/ */
@Override @Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) { public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname,String isLadders) {
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname); Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
@ -718,6 +718,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid()); Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
mLiveRoomViewHolder.initPkRank(isLadders);
} }
} }
} }

View File

@ -430,7 +430,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
if (dress.getJSONArray("wraps").size() >= 1) { if (dress.getJSONArray("wraps").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
shawl.setTag("test");
ImgLoader.display(mContext, display.getString("display_src"), shawl); ImgLoader.display(mContext, display.getString("display_src"), shawl);
} }
if (dress.getJSONArray("avatar_frame").size() == 1) { if (dress.getJSONArray("avatar_frame").size() == 1) {

View File

@ -16,6 +16,7 @@ public class LiveAudienceEvent extends BaseModel {
private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel(); private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel();
private int micIng = 0;//连麦状态 private int micIng = 0;//连麦状态
private LiveBean bean; private LiveBean bean;
private Object object;
private int liveType; private int liveType;
private int liveTypeVal; private int liveTypeVal;
private MsgModel msgModel;//全服消息 private MsgModel msgModel;//全服消息
@ -140,6 +141,15 @@ public class LiveAudienceEvent extends BaseModel {
return this; return this;
} }
public Object getObject() {
return object;
}
public LiveAudienceEvent setObject(Object object) {
this.object = object;
return this;
}
public enum LiveAudienceType { public enum LiveAudienceType {
SIDEBAR(1, "侧边栏"), SIDEBAR(1, "侧边栏"),
BOTTOM_COLLECTION(2, "底部合集"), BOTTOM_COLLECTION(2, "底部合集"),
@ -174,7 +184,11 @@ public class LiveAudienceEvent extends BaseModel {
LUCKY_ANGEL(31, "幸运天使"), LUCKY_ANGEL(31, "幸运天使"),
WE_CHEAT(32, "整蛊"), WE_CHEAT(32, "整蛊"),
WISH_LIST_UPDATE(33, "心愿单更新推送"), WISH_LIST_UPDATE(33, "心愿单更新推送"),
UN_LEAVELIVE(34, "取消暂时离开") UN_LEAVELIVE(34, "取消暂时离开"),
PK_RANK_UPDATE(35, "PK排位赛更新"),
PK_TWO_START(36, "双人PK开始"),
PK_TWO_UPDATE_HEAD_DATA(37, "更新PK头像信息"),
PK_TWO_END(38, "双人PK开始"),
; ;
private int type; private int type;

View File

@ -82,6 +82,8 @@ import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo; import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom; import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import org.greenrobot.eventbus.EventBus;
//import cn.rongcloud.rtc.jni.video.RCRect; //import cn.rongcloud.rtc.jni.video.RCRect;
/** /**
@ -1839,6 +1841,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
mLiveLinkMicPkViewHolder.startAnim(); mLiveLinkMicPkViewHolder.startAnim();
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid));
mLiveLinkMicPkViewHolder.showTime(); mLiveLinkMicPkViewHolder.showTime();
nextPkTimeCountDown(); nextPkTimeCountDown();
if (mIsAnchor) { if (mIsAnchor) {

View File

@ -763,13 +763,13 @@ public class SocketClient {
break; break;
case 2://收到对方确认主播PK回调 case 2://收到对方确认主播PK回调
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname")); mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname")); mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
break; break;
case 3://对方主播拒绝PK的回调 case 3://对方主播拒绝PK的回调
mListener.onLinkMicPkRefuse(); mListener.onLinkMicPkRefuse();
break; break;
case 4://所有人收到PK开始址的回调 case 4://所有人收到PK开始址的回调
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname")); mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
break; break;
case 5://PK时候断开连麦的回调 case 5://PK时候断开连麦的回调
if (LivePushTxViewHolder.mTRTCCloud != null) { if (LivePushTxViewHolder.mTRTCCloud != null) {

View File

@ -247,7 +247,7 @@ public interface SocketMessageListener {
/** /**
* 主播与主播PK 所有人收到PK开始的回调 * 主播与主播PK 所有人收到PK开始的回调
*/ */
void onLinkMicPkStart(String pkUid, String pkhead, String pkname); void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders);
/** /**
* 主播与主播PK 断开连麦pk的回调 * 主播与主播PK 断开连麦pk的回调

View File

@ -24,6 +24,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.AiAutomaticSpeechModel;
import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.FansMedalBean;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.SocketModel; import com.yunbao.common.bean.SocketModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -515,6 +516,17 @@ public class SocketRyClient {
.setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL) .setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL)
.setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class))); .setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
break; break;
case Constants.PK_RANK_UPDATE:
Log.i("PK排位",map.toString());
JSONObject item=map.getJSONObject("ct");
PkRankBean pkRankBean=new PkRankBean();
pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id")));
pkRankBean.setName(item.getString("new_rank_name"));
pkRankBean.setImg(item.getString("new_rank_img"));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE)
.setObject(pkRankBean));
break;
} }
} }
@ -980,7 +992,7 @@ public class SocketRyClient {
*/ */
private static void processAnchorLinkMicPk(JSONObject map) { private static void processAnchorLinkMicPk(JSONObject map) {
int action = map.getIntValue("action"); int action = map.getIntValue("action");
Log.i("Socket", "action = "+action+" json = "+map.toString()); Log.i("Socket", "action = " + action + " json = " + map.toString());
switch (action) { switch (action) {
case 1://收到对方主播PK回调 case 1://收到对方主播PK回调
@ -992,13 +1004,13 @@ public class SocketRyClient {
break; break;
case 2://收到对方主播PK回调 case 2://收到对方主播PK回调
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname")); mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));// mListener.onLinkMicPkStart(map.getString("uid")); mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
break; break;
case 3://对方主播拒绝PK的回调 case 3://对方主播拒绝PK的回调
mListener.onLinkMicPkRefuse(); mListener.onLinkMicPkRefuse();
break; break;
case 4://所有人收到PK开始址的回调 case 4://所有人收到PK开始址的回调
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname")); mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
break; break;
case 5://PK时候断开连麦的回调 case 5://PK时候断开连麦的回调
if (rtcRoom != null) { if (rtcRoom != null) {

View File

@ -20,6 +20,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
@ -29,8 +30,11 @@ import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.custom.FrameImageView; import com.yunbao.live.custom.FrameImageView;
import com.yunbao.live.custom.PkProgressBar; import com.yunbao.live.custom.PkProgressBar;
import com.yunbao.live.custom.ProgressTextView; import com.yunbao.live.custom.ProgressTextView;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.utils.LiveIconUtil; import com.yunbao.live.utils.LiveIconUtil;
import org.greenrobot.eventbus.EventBus;
import cn.qqtheme.framework.util.ScreenUtils; import cn.qqtheme.framework.util.ScreenUtils;
/** /**
@ -177,7 +181,6 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
animationDrawable = (AnimationDrawable) frame_img_pk.getBackground(); animationDrawable = (AnimationDrawable) frame_img_pk.getBackground();
animationDrawable.start(); animationDrawable.start();
} }
LiveRoomViewHolder.UpPkTwo();
} }
public void showTime() { public void showTime() {
@ -239,7 +242,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
animationDrawable.start(); animationDrawable.start();
} }
LiveRoomViewHolder.setHeadData(bean); EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_UPDATE_HEAD_DATA).setObject(bean));
} }
private void changeLine(float nowIndex, long leftGift, long rightGift) { private void changeLine(float nowIndex, long leftGift, long rightGift) {
@ -497,7 +500,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
animationDrawable.stop(); animationDrawable.stop();
} }
LiveRoomViewHolder.closePkTwo(); EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_END));
} }
public void setIsAnchor(boolean flag) { public void setIsAnchor(boolean flag) {

View File

@ -70,6 +70,7 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -90,6 +91,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
@ -274,8 +276,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static ImageView img_pk_fist_l, img_pk_fist_r; public static ImageView img_pk_fist_l, img_pk_fist_r;
public static RoundedImageView avatar_l1, avatar_l2, avatar_l3, avatar_r1, avatar_r2, avatar_r3; public static RoundedImageView avatar_l1, avatar_l2, avatar_l3, avatar_r1, avatar_r2, avatar_r3;
public static LivePKUserListBean livePKUserListBean; public static LivePKUserListBean livePKUserListBean;
public static String uidL1, uidL2, uidL3, uidR1, uidR2, uidR3; public String uidL1, uidL2, uidL3, uidR1, uidR2, uidR3;
public static RelativeLayout lt_pk_line; public RelativeLayout lt_pk_line;
public WindowManager windowManager; public WindowManager windowManager;
// public boolean isRy = false; // public boolean isRy = false;
@ -307,6 +309,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private FullServiceNotificationView fullScreen;//全副喇叭 private FullServiceNotificationView fullScreen;//全副喇叭
private NobleNoticeView noble;//全副喇叭 private NobleNoticeView noble;//全副喇叭
private FaceManager manager; private FaceManager manager;
private LinearLayout pkRankLayout;
private ViewFlipper pkRankVf;
private ImageView mPkRankIcon;
private TextView mPkRankText;
private ImageView mPkRankTopIcon;
private TextView mRedVal, mBlueVal;
private String pkUid = "";
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);
@ -769,6 +778,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout);
mAnchorLayout = (LinearLayout) findViewById(R.id.group_1); mAnchorLayout = (LinearLayout) findViewById(R.id.group_1);
mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico); mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico);
pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk);
pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf);
mPkRankTopIcon = (ImageView) findViewById(R.id.icon_pk_top);
mRedVal = (TextView) findViewById(R.id.pk_rank_red_val);
mBlueVal = (TextView) findViewById(R.id.pk_rank_blue_val);
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
fans_btn.setVisibility(View.GONE); fans_btn.setVisibility(View.GONE);
@ -784,9 +798,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
findViewById(R.id.hot_btn).setOnClickListener(this); findViewById(R.id.hot_btn).setOnClickListener(this);
try { try {
Glide.with(mContext).asGif().load(R.drawable.fans_medal).into(mViewMedal); ImgLoader.displayGif(mContext, R.drawable.fans_medal, mViewMedal);
} catch (Exception e) { } catch (Exception e) {
System.err.println("发生异常行为");
e.printStackTrace(); e.printStackTrace();
} }
@ -1034,6 +1047,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mContext instanceof LiveRyAnchorActivity) { if (mContext instanceof LiveRyAnchorActivity) {
findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.open_sidebar).setVisibility(View.GONE);
findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE);
findViewById(R.id.live_rank_pk).setVisibility(View.GONE);
} else { } else {
configBanner3(); configBanner3();
} }
@ -1056,16 +1070,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
} }
public void clearChat(){
if(mLiveChatAdapter!=null){ public void clearChat() {
if (mLiveChatAdapter != null) {
mLiveChatAdapter.clear(); mLiveChatAdapter.clear();
} }
} }
public void clearGuardIcon(){
if(userGuard!=null){ public void clearGuardIcon() {
if (userGuard != null) {
userGuard.setImageResource(R.mipmap.img_guardian_empty); userGuard.setImageResource(R.mipmap.img_guardian_empty);
} }
} }
public synchronized void showStart(StarChallengeStatusModel data) { public synchronized void showStart(StarChallengeStatusModel data) {
boolean upData = false; boolean upData = false;
if (mBannerList2 != null && mBannerList2.size() == 0) { if (mBannerList2 != null && mBannerList2.size() == 0) {
@ -1491,6 +1508,70 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}, Throwable::printStackTrace) }, Throwable::printStackTrace)
.isDisposed(); .isDisposed();
initPkRank();
}
private void initPkRankView() {
if(pkRankVf.getTag()!=null){
return;
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22));
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = DpUtil.dp2px(2);
textParams.setMarginStart(DpUtil.dp2px(1));
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
ImageView titleIcon = new ImageView(mContext);
mPkRankIcon = hourView.findViewById(R.id.wish_pic);
mPkRankText = hourView.findViewById(R.id.wish_index);
mPkRankText.setLayoutParams(textParams);
mPkRankText.setGravity(Gravity.CENTER);
titleIcon.setImageResource(R.mipmap.icon_pk_rank);
titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mPkRankIcon.setLayoutParams(params);
pkRankVf.addView(titleIcon);
pkRankVf.addView(hourView);
pkRankVf.startFlipping();
pkRankVf.setTag("start");
}
private void initPkRank() {
initPkRank(null);
}
public void initPkRank(String isLadders) {
API.get().pdLiveApi(mContext)
.getPkRanksList(mLiveUid, pkUid)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(listResponseModel -> {
PkRankBean bean = listResponseModel.getData().getInfo();
if (bean != null) {
Log.i("PK", bean.toString() + " | " + isLadders);
initPkRankView();
mPkRankText.setText(bean.getName());
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
if (StringUtil.isEmpty(bean.getPkTopImgUrl()) || StringUtil.isEmpty(isLadders)) {
return;
}
if (!StringUtil.isEmpty(isLadders)) {
bean.setPkTopImgUrl(isLadders);
}
if (Integer.parseInt(bean.getRedVal()) > 2) {
mRedVal.setVisibility(View.VISIBLE);
mRedVal.setText(bean.getRedVal() + "連勝");
}
if (Integer.parseInt(bean.getBlueVal()) > 2) {
mBlueVal.setVisibility(View.VISIBLE);
mBlueVal.setText(bean.getBlueVal() + "連勝");
}
mPkRankTopIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon);
}
}, Throwable::printStackTrace)
.isDisposed();
} }
/** /**
@ -1523,6 +1604,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
private void updatePkRank(PkRankBean bean) {
mPkRankText.setText(bean.getName());
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
initPkRank();
}
/** /**
* 设置热度值 * 设置热度值
* *
@ -1636,7 +1723,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
//头像显示 //头像显示
public static void setHeadData(LivePKUserListBean bean) { public void setHeadData(LivePKUserListBean bean) {
livePKUserListBean = bean; livePKUserListBean = bean;
String mLiveuid = LiveRoomViewHolder.mLiveUid; String mLiveuid = LiveRoomViewHolder.mLiveUid;
if (livePKUserListBean != null) { if (livePKUserListBean != null) {
@ -1689,7 +1776,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
//双人pk显示 //双人pk显示
public static void UpPkTwo() { public void UpPkTwo() {
ScreenDimenUtil util = ScreenDimenUtil.getInstance(); ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
@ -1715,9 +1802,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
//双人pk关闭 //双人pk关闭
public static void closePkTwo() { public void closePkTwo() {
mPkRankTopIcon.setVisibility(View.GONE);
lt_pk_line.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE);
livePKUserListBean = new LivePKUserListBean(); livePKUserListBean = new LivePKUserListBean();
pkUid = "";
} }
/** /**
@ -3472,4 +3561,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveChatAdapter.insertItem(bean); mLiveChatAdapter.insertItem(bean);
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) {
switch (event.getType()) {
case PK_RANK_UPDATE:
updatePkRank((PkRankBean) event.getObject());
break;
case PK_TWO_UPDATE_HEAD_DATA:
setHeadData((LivePKUserListBean) event.getObject());
break;
case PK_TWO_START:
pkUid = event.getObject().toString();
UpPkTwo();
initPkRank();
break;
case PK_TWO_END:
closePkTwo();
break;
}
}
} }

View File

@ -923,7 +923,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
@Override @Override
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname) { public void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders) {
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler(); Handler handler = new Handler();
@ -934,6 +934,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid()); Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid());
if (!liveID.equals(CommonAppConfig.getInstance().getUid())) { if (!liveID.equals(CommonAppConfig.getInstance().getUid())) {
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
mLiveRoomViewHolder.initPkRank(isLadders);
} }
} }
} }

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="122dp" android:height="30dp">
<shape android:shape="rectangle">
<solid android:color="#ff77b8fe" />
<gradient android:type="linear" android:useLevel="true" android:startColor="#ff6171ff" android:endColor="#ffaf59ff" android:angle="180" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="80dp" android:height="30dp">
<shape android:shape="rectangle">
<solid android:color="#CC6171ff" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="80dp" android:height="30dp">
<shape android:shape="rectangle">
<solid android:color="#CCfb4b47" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape>
</item>
</selector>

View File

@ -496,7 +496,8 @@
android:background="@drawable/bg_live_item_right" android:background="@drawable/bg_live_item_right"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:gravity="center"> android:gravity="center"
android:visibility="invisible">
<ImageView <ImageView
android:layout_width="8dp" android:layout_width="8dp"
@ -514,6 +515,29 @@
android:textSize="10sp" /> android:textSize="10sp" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/live_rank_pk"
android:layout_width="80dp"
android:layout_height="20dp"
android:layout_alignTop="@id/hour_rank_layout"
android:layout_alignParentRight="true"
android:background="@drawable/bg_live_item_pk_rank"
android:clickable="true"
android:focusable="true"
android:visibility="visible">
<ViewFlipper
android:id="@+id/rank_pk_vf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:flipInterval="5000"
android:inAnimation="@anim/anim_marquee_in"
android:outAnimation="@anim/anim_marquee_out" />
</LinearLayout>
<ImageView <ImageView
android:id="@+id/btn_noble" android:id="@+id/btn_noble"
@ -1218,6 +1242,16 @@
</FrameLayout> </FrameLayout>
<ImageView
android:id="@+id/icon_pk_top"
android:layout_width="130dp"
android:layout_height="35dp"
android:layout_alignTop="@+id/live_video"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@mipmap/icon_rank_top_box"
android:visibility="gone" />
<RelativeLayout <RelativeLayout
android:id="@+id/lt_pk_line" android:id="@+id/lt_pk_line"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -1225,7 +1259,43 @@
android:layout_marginTop="@dimen/live_top" android:layout_marginTop="@dimen/live_top"
android:visibility="gone"> android:visibility="gone">
<TextView
android:id="@+id/pk_rank_red_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/pk_red_layout"
android:layout_marginStart="13dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_live_item_pk_rank_red"
android:paddingStart="17dp"
android:paddingTop="8dp"
android:paddingEnd="17dp"
android:paddingBottom="8dp"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/pk_rank_blue_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/pk_red_layout"
android:layout_alignParentEnd="true"
android:layout_marginEnd="13dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_live_item_pk_rank_blue"
android:paddingStart="17dp"
android:paddingTop="8dp"
android:paddingEnd="17dp"
android:paddingBottom="8dp"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/pk_red_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"> android:layout_alignParentBottom="true">