添加多人PK名称点击
This commit is contained in:
parent
4d86317ec8
commit
e97a4e607c
@ -691,24 +691,24 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) {
|
public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) {
|
||||||
|
|
||||||
LiveBean liveBean = e.getLiveBean();
|
LiveBean liveBean = e.getLiveBean();
|
||||||
if (e.isLiveEnd()) {
|
if (e.isLiveEnd()) {
|
||||||
manager.removeLiveEnd();
|
manager.removeLiveEnd();
|
||||||
}
|
}
|
||||||
if (liveBean != null) {
|
if (liveBean != null) {
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
|
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
||||||
manager.onRemove(false);
|
manager.onRemove(false);
|
||||||
mLiveType = e.getLiveType();
|
mLiveType = e.getLiveType();
|
||||||
mLiveTypeVal = e.getLiveTypeVal();
|
mLiveTypeVal = e.getLiveTypeVal();
|
||||||
mLiveBean = liveBean;
|
mLiveBean = liveBean;
|
||||||
mLiveUid = liveBean.getUid();
|
mLiveUid = liveBean.getUid();
|
||||||
mStream = liveBean.getStream();
|
mStream = liveBean.getStream();
|
||||||
mAncherName = liveBean.getUserNiceName();
|
mAncherName = liveBean.getUserNiceName();
|
||||||
mAncherIcon = liveBean.getAvatar();
|
mAncherIcon = liveBean.getAvatar();
|
||||||
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
|
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1251,6 +1251,10 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
case SOCKET_LIVE_DRPK_SET_PK_END_VIEW:
|
case SOCKET_LIVE_DRPK_SET_PK_END_VIEW:
|
||||||
if (manager.getmLivePlayViewHolder() != null) {
|
if (manager.getmLivePlayViewHolder() != null) {
|
||||||
manager.getmLivePlayViewHolder().setPkEndview();
|
manager.getmLivePlayViewHolder().setPkEndview();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (manager != null) {
|
||||||
|
manager.removeDetailView();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package com.yunbao.live.views;
|
package com.yunbao.live.views;
|
||||||
|
|
||||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||||
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@ -35,6 +35,7 @@ import com.lxj.xpopup.core.BasePopupView;
|
|||||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||||
import com.lzf.easyfloat.EasyFloat;
|
import com.lzf.easyfloat.EasyFloat;
|
||||||
import com.lzy.okserver.OkDownload;
|
import com.lzy.okserver.OkDownload;
|
||||||
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
@ -53,6 +54,7 @@ import com.yunbao.common.views.LiveClarityCustomPopup;
|
|||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
|
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
import com.yunbao.live.utils.LiveExoPlayerManager;
|
import com.yunbao.live.utils.LiveExoPlayerManager;
|
||||||
|
|
||||||
@ -89,7 +91,6 @@ import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame;
|
|||||||
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||||
import cn.rongcloud.rtc.base.RCRTCStreamType;
|
import cn.rongcloud.rtc.base.RCRTCStreamType;
|
||||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
import cn.rongcloud.rtc.center.stream.RCRTCAudioInputStreamImpl;
|
|
||||||
import cn.rongcloud.rtc.core.RendererCommon;
|
import cn.rongcloud.rtc.core.RendererCommon;
|
||||||
|
|
||||||
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||||
@ -393,7 +394,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
mVideoView.requestLayout();
|
mVideoView.requestLayout();
|
||||||
|
|
||||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams();
|
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams();
|
||||||
params1.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
params1.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||||
params1.addRule(RelativeLayout.ALIGN_TOP);
|
params1.addRule(RelativeLayout.ALIGN_TOP);
|
||||||
ry_view.setLayoutParams(params1);
|
ry_view.setLayoutParams(params1);
|
||||||
@ -556,17 +557,17 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||||
mVideoView.requestLayout();
|
mVideoView.requestLayout();
|
||||||
}
|
}
|
||||||
if (detailsView != null) {
|
// if (detailsView != null) {
|
||||||
mVideoView.removeView(detailsView);
|
// mVideoView.removeView(detailsView);
|
||||||
detailsView = null;
|
// detailsView = null;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDetailView(){
|
public void removeDetailView() {
|
||||||
if (detailsView != null) {
|
// if (detailsView != null) {
|
||||||
mVideoView.removeView(detailsView);
|
// mVideoView.removeView(detailsView);
|
||||||
detailsView = null;
|
// detailsView = null;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1221,129 +1222,33 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int mPkTimeCount = 0;
|
|
||||||
private Handler countdownHandler = new Handler();
|
|
||||||
private View detailsView = null;
|
|
||||||
private FrameLayout timeTitle;
|
|
||||||
private TextView textTime;
|
|
||||||
private TextView textPkName1, textPkName2, textPkName3, textPkName4;
|
|
||||||
private TextView textGrade1, textGrade2, textGrade3, textGrade4;
|
|
||||||
private ImageView imageGrade1, imageGrade2, imageGrade3, imageGrade4;
|
|
||||||
private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4;
|
|
||||||
|
|
||||||
/**
|
private int mPkTimeCount = 0;
|
||||||
* PK倒计时
|
|
||||||
*/
|
|
||||||
public void upDataPkScore(JSONArray pkScores, int time) {
|
|
||||||
|
|
||||||
if (detailsView == null) {
|
|
||||||
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
|
||||||
timeTitle = detailsView.findViewById(R.id.time_title);
|
|
||||||
textTime = detailsView.findViewById(R.id.text_time);
|
|
||||||
linearGrade1 = detailsView.findViewById(R.id.lin_pk1);
|
|
||||||
linearGrade2 = detailsView.findViewById(R.id.lin_pk2);
|
|
||||||
linearGrade3 = detailsView.findViewById(R.id.lin_pk3);
|
|
||||||
linearGrade4 = detailsView.findViewById(R.id.lin_pk4);
|
|
||||||
textPkName1 = detailsView.findViewById(R.id.text_pk_name1);
|
|
||||||
textPkName2 = detailsView.findViewById(R.id.text_pk_name2);
|
|
||||||
textPkName3 = detailsView.findViewById(R.id.text_pk_name3);
|
|
||||||
textPkName4 = detailsView.findViewById(R.id.text_pk_name4);
|
|
||||||
textGrade1 = detailsView.findViewById(R.id.text_grade1);
|
|
||||||
textGrade2 = detailsView.findViewById(R.id.text_grade2);
|
|
||||||
textGrade3 = detailsView.findViewById(R.id.text_grade3);
|
|
||||||
textGrade4 = detailsView.findViewById(R.id.text_grade4);
|
|
||||||
imageGrade1 = detailsView.findViewById(R.id.image_grade1);
|
|
||||||
imageGrade2 = detailsView.findViewById(R.id.image_grade2);
|
|
||||||
imageGrade3 = detailsView.findViewById(R.id.image_grade3);
|
|
||||||
imageGrade4 = detailsView.findViewById(R.id.image_grade4);
|
|
||||||
linearGrade1.setVisibility(View.GONE);
|
|
||||||
linearGrade2.setVisibility(View.GONE);
|
|
||||||
linearGrade3.setVisibility(View.GONE);
|
|
||||||
linearGrade4.setVisibility(View.GONE);
|
|
||||||
mVideoView.addView(detailsView);
|
|
||||||
|
|
||||||
}
|
public interface PlayViewLayoutInterface {
|
||||||
|
void playViewLayout(int width, int height);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pkScores.size(); i++) {
|
private PlayViewLayoutInterface layoutInterface;
|
||||||
JSONObject score = pkScores.getJSONObject(i);
|
|
||||||
String userNiceName = score.getString("user_nicename");
|
public void setLayoutInterface(PlayViewLayoutInterface layoutInterface) {
|
||||||
long userScore = score.getLong("score");
|
mVideoView.post(new Runnable() {
|
||||||
int resScore = R.mipmap.icon_livepk_no1;
|
@Override
|
||||||
if (userScore == 0 && !score.containsKey("paiming")) {
|
public void run() {
|
||||||
resScore = R.mipmap.icon_livepk_no1;
|
int width = mVideoView.getMeasuredWidth();
|
||||||
} else {
|
int height = mVideoView.getMeasuredHeight();
|
||||||
if (score.containsKey("paiming")) {
|
if (layoutInterface != null) {
|
||||||
int ranking = score.getIntValue("paiming");
|
layoutInterface.playViewLayout(width, height);
|
||||||
switch (ranking) {
|
|
||||||
case 1:
|
|
||||||
resScore = R.mipmap.icon_livepk_no1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
resScore = R.mipmap.icon_livepk_no2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
resScore = R.mipmap.icon_livepk_no3;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
resScore = R.mipmap.icon_livepk_no4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
});
|
||||||
linearGrade1.setVisibility(View.VISIBLE);
|
|
||||||
textPkName1.setText(userNiceName);
|
|
||||||
ImgLoader.display(mContext, resScore, imageGrade1);
|
|
||||||
textGrade1.setText(String.valueOf(userScore));
|
|
||||||
} else if (i == 1) {
|
|
||||||
linearGrade2.setVisibility(View.VISIBLE);
|
|
||||||
textPkName2.setText(userNiceName);
|
|
||||||
ImgLoader.display(mContext, resScore, imageGrade2);
|
|
||||||
textGrade2.setText(String.valueOf(userScore));
|
|
||||||
} else if (i == 2) {
|
|
||||||
linearGrade4.setVisibility(View.VISIBLE);
|
|
||||||
textPkName4.setText(userNiceName);
|
|
||||||
ImgLoader.display(mContext, resScore, imageGrade4);
|
|
||||||
textGrade4.setText(String.valueOf(userScore));
|
|
||||||
} else if (i == 3) {
|
|
||||||
linearGrade3.setVisibility(View.VISIBLE);
|
|
||||||
textPkName3.setText(userNiceName);
|
|
||||||
ImgLoader.display(mContext, resScore, imageGrade3);
|
|
||||||
textGrade3.setText(String.valueOf(userScore));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time > 0) {
|
|
||||||
mPkTimeCount = time;
|
|
||||||
timeTitle.setVisibility(View.VISIBLE);
|
|
||||||
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable countdownRunnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mPkTimeCount--;
|
|
||||||
if (mPkTimeCount > 0) {//
|
|
||||||
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
|
||||||
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
|
||||||
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime());
|
|
||||||
} else {
|
|
||||||
timeTitle.setVisibility(View.GONE);
|
|
||||||
countdownHandler.removeCallbacks(countdownRunnable);
|
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取下一秒钟的时间
|
|
||||||
*/
|
|
||||||
private long getNextSecondTime() {
|
|
||||||
long now = SystemClock.uptimeMillis();
|
|
||||||
return now + (1000 - now % 1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@ -116,7 +115,6 @@ import com.yunbao.live.activity.LiveAudienceActivity;
|
|||||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||||
import com.yunbao.live.adapter.LiveChatAdapter;
|
import com.yunbao.live.adapter.LiveChatAdapter;
|
||||||
import com.yunbao.live.adapter.LiveChatRecyclerViewLayoutManager;
|
|
||||||
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
|
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
|
||||||
import com.yunbao.live.adapter.LiveUserAdapter;
|
import com.yunbao.live.adapter.LiveUserAdapter;
|
||||||
import com.yunbao.live.bean.DrPkbean;
|
import com.yunbao.live.bean.DrPkbean;
|
||||||
@ -3904,10 +3902,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
mLiveChatAdapter.insertItem(bean);
|
mLiveChatAdapter.insertItem(bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 幸运100%活动
|
* 幸运100%活动
|
||||||
*/
|
*/
|
||||||
public void lucky100(MsgModel model){
|
public void lucky100(MsgModel model) {
|
||||||
if (mLiveChatAdapter != null) {
|
if (mLiveChatAdapter != null) {
|
||||||
LiveChatBean bean = new LiveChatBean();
|
LiveChatBean bean = new LiveChatBean();
|
||||||
bean.setType(LiveChatBean.LUCKY_100_CHECK);
|
bean.setType(LiveChatBean.LUCKY_100_CHECK);
|
||||||
@ -4009,4 +4008,163 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private Handler countdownHandler = new Handler();
|
||||||
|
private View detailsView = null;
|
||||||
|
private FrameLayout timeTitle;
|
||||||
|
private TextView textTime;
|
||||||
|
private TextView textPkName1, textPkName2, textPkName3, textPkName4;
|
||||||
|
private TextView textGrade1, textGrade2, textGrade3, textGrade4;
|
||||||
|
private ImageView imageGrade1, imageGrade2, imageGrade3, imageGrade4;
|
||||||
|
private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4;
|
||||||
|
/**
|
||||||
|
* PK倒计时
|
||||||
|
*/
|
||||||
|
private String userId2, userId3 = "", userId4;
|
||||||
|
|
||||||
|
public void upDataPkScore(JSONArray pkScores, int time) {
|
||||||
|
if (detailsView == null) {
|
||||||
|
detailsView = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
|
||||||
|
timeTitle = detailsView.findViewById(R.id.time_title);
|
||||||
|
textTime = detailsView.findViewById(R.id.text_time);
|
||||||
|
linearGrade1 = detailsView.findViewById(R.id.lin_pk1);
|
||||||
|
linearGrade2 = detailsView.findViewById(R.id.lin_pk2);
|
||||||
|
linearGrade3 = detailsView.findViewById(R.id.lin_pk3);
|
||||||
|
linearGrade4 = detailsView.findViewById(R.id.lin_pk4);
|
||||||
|
textPkName1 = detailsView.findViewById(R.id.text_pk_name1);
|
||||||
|
textPkName2 = detailsView.findViewById(R.id.text_pk_name2);
|
||||||
|
textPkName3 = detailsView.findViewById(R.id.text_pk_name3);
|
||||||
|
textPkName4 = detailsView.findViewById(R.id.text_pk_name4);
|
||||||
|
textGrade1 = detailsView.findViewById(R.id.text_grade1);
|
||||||
|
textGrade2 = detailsView.findViewById(R.id.text_grade2);
|
||||||
|
textGrade3 = detailsView.findViewById(R.id.text_grade3);
|
||||||
|
textGrade4 = detailsView.findViewById(R.id.text_grade4);
|
||||||
|
imageGrade1 = detailsView.findViewById(R.id.image_grade1);
|
||||||
|
imageGrade2 = detailsView.findViewById(R.id.image_grade2);
|
||||||
|
imageGrade3 = detailsView.findViewById(R.id.image_grade3);
|
||||||
|
imageGrade4 = detailsView.findViewById(R.id.image_grade4);
|
||||||
|
linearGrade1.setVisibility(View.GONE);
|
||||||
|
linearGrade2.setVisibility(View.GONE);
|
||||||
|
linearGrade3.setVisibility(View.GONE);
|
||||||
|
linearGrade4.setVisibility(View.GONE);
|
||||||
|
mRoot.addView(detailsView);
|
||||||
|
mRoot.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int mScreenWdith = ScreenDimenUtil.getInstance().getScreenWdith();
|
||||||
|
int vHeight = mScreenWdith * 720 / 960;
|
||||||
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) detailsView.getLayoutParams();
|
||||||
|
params.height = vHeight;
|
||||||
|
params.width = mScreenWdith;
|
||||||
|
params.topMargin = DpUtil.dp2px(105);
|
||||||
|
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||||
|
detailsView.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < pkScores.size(); i++) {
|
||||||
|
JSONObject score = pkScores.getJSONObject(i);
|
||||||
|
String userNiceName = score.getString("user_nicename");
|
||||||
|
long userScore = score.getLong("score");
|
||||||
|
String userId = score.getString("id");
|
||||||
|
int resScore = R.mipmap.icon_livepk_no1;
|
||||||
|
if (userScore == 0 && !score.containsKey("paiming")) {
|
||||||
|
resScore = R.mipmap.icon_livepk_no1;
|
||||||
|
} else {
|
||||||
|
if (score.containsKey("paiming")) {
|
||||||
|
int ranking = score.getIntValue("paiming");
|
||||||
|
switch (ranking) {
|
||||||
|
case 1:
|
||||||
|
resScore = R.mipmap.icon_livepk_no1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
resScore = R.mipmap.icon_livepk_no2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
resScore = R.mipmap.icon_livepk_no3;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
resScore = R.mipmap.icon_livepk_no4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
linearGrade1.setVisibility(View.VISIBLE);
|
||||||
|
textPkName1.setText(userNiceName);
|
||||||
|
ImgLoader.display(mContext, resScore, imageGrade1);
|
||||||
|
textGrade1.setText(String.valueOf(userScore));
|
||||||
|
|
||||||
|
} else if (i == 1) {
|
||||||
|
linearGrade2.setVisibility(View.VISIBLE);
|
||||||
|
textPkName2.setText(userNiceName);
|
||||||
|
ImgLoader.display(mContext, resScore, imageGrade2);
|
||||||
|
textGrade2.setText(String.valueOf(userScore));
|
||||||
|
userId2 = userId;
|
||||||
|
} else if (i == 2) {
|
||||||
|
linearGrade4.setVisibility(View.VISIBLE);
|
||||||
|
textPkName4.setText(userNiceName);
|
||||||
|
ImgLoader.display(mContext, resScore, imageGrade4);
|
||||||
|
textGrade4.setText(String.valueOf(userScore));
|
||||||
|
userId4 = userId;
|
||||||
|
} else if (i == 3) {
|
||||||
|
linearGrade3.setVisibility(View.VISIBLE);
|
||||||
|
textPkName3.setText(userNiceName);
|
||||||
|
ImgLoader.display(mContext, resScore, imageGrade3);
|
||||||
|
textGrade3.setText(String.valueOf(userScore));
|
||||||
|
userId3 = userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time > 0) {
|
||||||
|
mPkTimeCount = time;
|
||||||
|
timeTitle.setVisibility(View.VISIBLE);
|
||||||
|
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime());
|
||||||
|
}
|
||||||
|
textPkName2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showUserDialog(userId2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
textPkName4.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showUserDialog(userId4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
textPkName3.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showUserDialog(userId3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Runnable countdownRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mPkTimeCount--;
|
||||||
|
if (mPkTimeCount > 0) {//
|
||||||
|
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
|
||||||
|
textTime.setText(String.format(mContext.getString(R.string.pk_time), s1));
|
||||||
|
countdownHandler.postAtTime(countdownRunnable, getNextSecondTime());
|
||||||
|
} else {
|
||||||
|
timeTitle.setVisibility(View.GONE);
|
||||||
|
countdownHandler.removeCallbacks(countdownRunnable);
|
||||||
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
|
.setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public void removeDetailView() {
|
||||||
|
if (detailsView != null) {
|
||||||
|
mRoot.removeView(detailsView);
|
||||||
|
detailsView = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
||||||
isEnterRoom = false;
|
isEnterRoom = false;
|
||||||
openParametersModel = new OpenParametersModel();
|
openParametersModel = new OpenParametersModel();
|
||||||
if(mLiveRoomViewHolder!=null){
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.UpPkTwo();
|
mLiveRoomViewHolder.UpPkTwo();
|
||||||
}
|
}
|
||||||
mContext.runOnUiThread(new Runnable() {
|
mContext.runOnUiThread(new Runnable() {
|
||||||
@ -581,6 +581,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
|
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
|
||||||
}
|
}
|
||||||
|
// mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() {
|
||||||
|
// @Override
|
||||||
|
// public void playViewLayout(int width, int height) {
|
||||||
|
// Log.e("播放器的宽高", "宽:" + width + " 高:" + height);
|
||||||
|
// ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||||
|
// int mScreenWdith = util.getScreenWdith();
|
||||||
|
// Log.e("播放器的宽高", "mScreenWdith:" + mScreenWdith + " mScreenheight :" + mScreenWdith * 720 / 960);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
//守护相关
|
//守护相关
|
||||||
mLiveGuardInfo = new LiveGuardInfo();
|
mLiveGuardInfo = new LiveGuardInfo();
|
||||||
int guardNum = Integer.parseInt(data.getEnterRoomInfo().getGuardNums());
|
int guardNum = Integer.parseInt(data.getEnterRoomInfo().getGuardNums());
|
||||||
@ -1830,7 +1839,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
* @param time
|
* @param time
|
||||||
*/
|
*/
|
||||||
public void upDataPkScore(JSONArray pkScores, int time) {
|
public void upDataPkScore(JSONArray pkScores, int time) {
|
||||||
if (mLivePlayViewHolder != null) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
String liveId = mLiveBean.getUid();
|
String liveId = mLiveBean.getUid();
|
||||||
JSONObject liveModel = null;
|
JSONObject liveModel = null;
|
||||||
//调整数据
|
//调整数据
|
||||||
@ -1844,7 +1853,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
pkScores.remove(index);
|
pkScores.remove(index);
|
||||||
pkScores.add(0, liveModel);
|
pkScores.add(0, liveModel);
|
||||||
mLivePlayViewHolder.upDataPkScore(pkScores, time);
|
mLiveRoomViewHolder.upDataPkScore(pkScores, time);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1855,4 +1864,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeDetailView() {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.removeDetailView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxWidth="50dp"
|
android:maxWidth="50dp"
|
||||||
|
android:clickable="true"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
@ -110,6 +111,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
|
android:clickable="true"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
android:paddingBottom="4.33dp"
|
android:paddingBottom="4.33dp"
|
||||||
android:text="我方"
|
android:text="我方"
|
||||||
@ -134,6 +136,7 @@
|
|||||||
android:background="@drawable/background_pk_time"
|
android:background="@drawable/background_pk_time"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:clickable="true"
|
||||||
android:maxWidth="50dp"
|
android:maxWidth="50dp"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
@ -193,6 +196,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxWidth="50dp"
|
android:maxWidth="50dp"
|
||||||
|
android:clickable="true"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:paddingTop="4.33dp"
|
android:paddingTop="4.33dp"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user