创建PK排位赛分支
This commit is contained in:
parent
da3398f1f9
commit
d20210f291
@ -169,6 +169,7 @@ public class Constants {
|
||||
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
|
||||
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
|
||||
public static final String SUPER_VISION = "supervision";//超级发言警告
|
||||
public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
39
common/src/main/java/com/yunbao/common/bean/PkRankBean.java
Normal file
39
common/src/main/java/com/yunbao/common/bean/PkRankBean.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 直播间PK排位赛
|
||||
*/
|
||||
public class PkRankBean extends BaseModel{
|
||||
@SerializedName("anchor_id")
|
||||
public int id;
|
||||
@SerializedName("rank_name")
|
||||
public String name;
|
||||
@SerializedName("rank_img")
|
||||
public String img;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ public class ImgLoader {
|
||||
private static final boolean SKIP_MEMORY_CACHE = true;
|
||||
|
||||
private static BlurTransformation sBlurTransformation;
|
||||
private final static float thumbnail = 0.1f;
|
||||
private final static float thumbnail = 1.0f;
|
||||
|
||||
static {
|
||||
sBlurTransformation = new BlurTransformation(25);
|
||||
|
@ -14,6 +14,7 @@ import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@ -262,4 +263,10 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Task.sendTaskGift")
|
||||
Observable<ResponseModel<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);
|
||||
}
|
||||
|
BIN
common/src/main/res/mipmap-mdpi/icon_pk_rank.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/icon_pk_rank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
@ -430,7 +430,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
|
||||
if (dress.getJSONArray("wraps").size() >= 1) {
|
||||
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
|
||||
shawl.setTag("test");
|
||||
ImgLoader.display(mContext, display.getString("display_src"), shawl);
|
||||
}
|
||||
if (dress.getJSONArray("avatar_frame").size() == 1) {
|
||||
|
@ -174,7 +174,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
LUCKY_ANGEL(31, "幸运天使"),
|
||||
WE_CHEAT(32, "整蛊"),
|
||||
WISH_LIST_UPDATE(33, "心愿单更新推送"),
|
||||
UN_LEAVELIVE(34, "取消暂时离开")
|
||||
UN_LEAVELIVE(34, "取消暂时离开"),
|
||||
PK_RANK_UPDATE(35, "PK排位赛更新")
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
@ -24,6 +24,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.FansMedalBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.SocketModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@ -515,6 +516,15 @@ public class SocketRyClient {
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL)
|
||||
.setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
|
||||
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(pkRankBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@ -307,6 +308,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private FullServiceNotificationView fullScreen;//全副喇叭
|
||||
private NobleNoticeView noble;//全副喇叭
|
||||
private FaceManager manager;
|
||||
private LinearLayout pkRankLayout;
|
||||
private ViewFlipper pkRankVf;
|
||||
private ImageView mPkRankIcon;
|
||||
private TextView mPkRankText;
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
@ -769,6 +774,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout);
|
||||
mAnchorLayout = (LinearLayout) findViewById(R.id.group_1);
|
||||
mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico);
|
||||
pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk);
|
||||
pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf);
|
||||
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
|
||||
fans_btn.setVisibility(View.GONE);
|
||||
@ -1056,16 +1063,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void clearChat() {
|
||||
if (mLiveChatAdapter != null) {
|
||||
mLiveChatAdapter.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearGuardIcon() {
|
||||
if (userGuard != null) {
|
||||
userGuard.setImageResource(R.mipmap.img_guardian_empty);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void showStart(StarChallengeStatusModel data) {
|
||||
boolean upData = false;
|
||||
if (mBannerList2 != null && mBannerList2.size() == 0) {
|
||||
@ -1491,6 +1501,40 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
}, Throwable::printStackTrace)
|
||||
.isDisposed();
|
||||
initPkRank();
|
||||
}
|
||||
|
||||
private void initPkRank() {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPkRanksList(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(listResponseModel -> {
|
||||
PkRankBean bean = listResponseModel.getData().getInfo();
|
||||
|
||||
if (bean != null) {
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
|
||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
textParams.leftMargin = DpUtil.dp2px(5);
|
||||
|
||||
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.setText(bean.getName());
|
||||
mPkRankText.setLayoutParams(textParams);
|
||||
mPkRankText.setGravity(Gravity.CENTER);
|
||||
titleIcon.setImageResource(R.mipmap.icon_pk_rank);
|
||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||
titleIcon.setLayoutParams(params);
|
||||
mPkRankIcon.setLayoutParams(params);
|
||||
pkRankVf.addView(titleIcon);
|
||||
pkRankVf.addView(hourView);
|
||||
pkRankVf.startFlipping();
|
||||
}
|
||||
}, Throwable::printStackTrace)
|
||||
.isDisposed();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1523,6 +1567,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePkRank(PkRankBean bean) {
|
||||
mPkRankText.setText(bean.getName());
|
||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置热度值
|
||||
*
|
||||
@ -3472,4 +3521,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveChatAdapter.insertItem(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void imUpdatePkRank(PkRankBean bean) {
|
||||
if (bean != null) {
|
||||
updatePkRank(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
live/src/main/res/drawable/bg_live_item_pk_rank.xml
Normal file
10
live/src/main/res/drawable/bg_live_item_pk_rank.xml
Normal 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>
|
@ -488,6 +488,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/open_sidebar"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="20dp"
|
||||
@ -514,6 +515,32 @@
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="visible"
|
||||
android:id="@+id/live_rank_pk"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/bg_live_item_pk_rank"
|
||||
android:layout_alignTop="@id/hour_rank_layout"
|
||||
android:layout_alignParentRight="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/rank_pk_vf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:flipInterval="5000"
|
||||
android:inAnimation="@anim/anim_marquee_in"
|
||||
android:outAnimation="@anim/anim_marquee_out" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_noble"
|
||||
|
Loading…
Reference in New Issue
Block a user