From c4d378daba20879354cc8e8e9cbd7051e1479106 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Fri, 31 May 2024 20:59:16 +0800 Subject: [PATCH] =?UTF-8?q?fix[=E5=A3=B0=E6=9C=9B=E5=8D=87=E7=BA=A7-?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/manager/RandomPkManager.java | 2 +- .../live/activity/LiveSwAnchorActivity.java | 5 +- .../presenter/LiveSwLinkMicPkPresenter.java | 162 +- .../yunbao/live/socket/SocketSwClient.java | 9 +- .../live/views/LivePlaySwViewHolder.java | 48 +- .../live/views/LivePushSwViewHolder.java | 2 +- .../yunbao/live/views/LiveRoomViewHolder.java | 1662 ++++++++--------- .../live/views/PortraitLiveManager.java | 53 +- .../src/main/res/layout/view_live_play_sw.xml | 4 +- 9 files changed, 1002 insertions(+), 945 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java index ebb586b0a..e0bd21378 100644 --- a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java +++ b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java @@ -343,7 +343,7 @@ public class RandomPkManager { @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + //ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java index b958b1432..b9e1fe394 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java @@ -165,6 +165,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl private boolean mPaused; String mBeautySdkType; public static int isDRPK = 0; + public static int DRPKing = 0; // 0 多人PK前 1 多人PK中 2多人PK后 public static boolean PKing = false; public static int pk_nub; public static int backIndex = 0;//0=未判断,1=已判断 @@ -405,6 +406,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl LiveSwLinkMicPkPresenter.mApplyUid = CommonAppConfig.getInstance().getUid(); btn_start_dr_pk.setVisibility(View.VISIBLE); // dr_pk_view.setVisibility(View.VISIBLE); + L.eSw("ac2222222222222222222"); final SocketSendBean msg1 = new SocketSendBean() .param("_method_", SOCKET_LIVE_DRPK) .param("action", 9) @@ -872,6 +874,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl MicUserManager.get().removeAllMicUserList(); PKing = false; isDRPK = 0; + DRPKing = 0; endLive(); RandomPkManager.getInstance().release(); } @@ -1345,7 +1348,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onError(Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); + //ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); } else { diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index 5a95abddb..427d5384e 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -3,6 +3,7 @@ package com.yunbao.live.presenter; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; +import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing; import static com.yunbao.live.activity.LiveSwAnchorActivity.PKing; import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder; @@ -158,6 +159,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { private List drPkbeans = new ArrayList<>(); + private JSONArray pkScores; //PK分数 + public LiveSwLinkMicPkPresenter setDRInitiator(boolean DRInitiator) { this.DRInitiator = DRInitiator; return this; @@ -475,6 +478,98 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1); } } + if (DRPKing == 1) { + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + setMyDrPkDetailsView(); + for (int j = 0; j < drPkbeans.size(); j++) { + if (j == 0) { + L.eSw("j == 0:" + j); + //设置多人PK数据 + if (detailsView2 != null) { + livePushSwViewHolder.dr2_preview.removeView(detailsView2); + } + detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); + detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2); + linearGrade2 = detailsView2.findViewById(R.id.linear_grade2); + textPkName2 = detailsView2.findViewById(R.id.text_pk_name2); + imageGrade2 = detailsView2.findViewById(R.id.image_grade2); + textGrade2 = detailsView2.findViewById(R.id.text_grade2); + imageGrade2.setTag(String.valueOf(drPkbeans.get(0).getId())); + textPkName2.setText(drPkbeans.get(0).getUser_nicename()); + livePushSwViewHolder.dr2_preview.addView(detailsView2); + detailsLinearLayout2.setVisibility(View.GONE); + linearGrade2.setVisibility(View.GONE); + } else if (j == 1) { + L.eSw("j == 1:" + j); + if (detailsView4 != null) { + livePushSwViewHolder.dr4_preview.removeView(detailsView4); + } + detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); + detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4); + linearGrade4 = detailsView4.findViewById(R.id.linear_grade4); + textPkName4 = detailsView4.findViewById(R.id.text_pk_name4); + imageGrade4 = detailsView4.findViewById(R.id.image_grade4); + textGrade4 = detailsView4.findViewById(R.id.text_grade4); + imageGrade4.setTag(String.valueOf(drPkbeans.get(1).getId())); + textPkName4.setText(drPkbeans.get(1).getUser_nicename()); + livePushSwViewHolder.dr4_preview.addView(detailsView4); + detailsLinearLayout4.setVisibility(View.GONE); + linearGrade4.setVisibility(View.GONE); + } else if (j == 2) { + L.eSw("j == 2:" + j); + + if (detailsView4 != null) { + livePushSwViewHolder.dr4_preview.removeView(detailsView4); + } + detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); + detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4); + linearGrade4 = detailsView4.findViewById(R.id.linear_grade4); + textPkName4 = detailsView4.findViewById(R.id.text_pk_name4); + imageGrade4 = detailsView4.findViewById(R.id.image_grade4); + textGrade4 = detailsView4.findViewById(R.id.text_grade4); + imageGrade4.setTag(String.valueOf(drPkbeans.get(2).getId())); + textPkName4.setText(drPkbeans.get(2).getUser_nicename()); + livePushSwViewHolder.dr4_preview.addView(detailsView4); + detailsLinearLayout4.setVisibility(View.GONE); + linearGrade4.setVisibility(View.GONE); + + if (detailsView3 != null) { + livePushSwViewHolder.dr3_preview.removeView(detailsView3); + } + detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null); + detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3); + linearGrade3 = detailsView3.findViewById(R.id.linear_grade3); + textPkName3 = detailsView3.findViewById(R.id.text_pk_name3); + imageGrade3 = detailsView3.findViewById(R.id.image_grade3); + textGrade3 = detailsView3.findViewById(R.id.text_grade3); + imageGrade3.setTag(String.valueOf(drPkbeans.get(1).getId())); + textPkName3.setText(drPkbeans.get(1).getUser_nicename()); + livePushSwViewHolder.dr3_preview.addView(detailsView3); + detailsLinearLayout3.setVisibility(View.GONE); + linearGrade3.setVisibility(View.GONE); + + + ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success"); + } + } + int removeUid = 0; + for (int k = 0; k < pkScores.size(); k++) { + JSONObject score = pkScores.getJSONObject(k); + String userID = score.getString("id"); + if(userID.equals(uid)){ + removeUid = k; + } + } + pkScores.remove(removeUid); + upDataPkScore(pkScores,"-1",0); + } + }, 1000); + } + + + SWManager.get().setDrPkNumClarity(drPkbeans.size()); if (drPkbeans.size() == 1) { mLiveAnchorViewHolder.closeEndPkBt(); @@ -520,7 +615,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { dRjoinOtherRoom(u); //展示结束连麦按钮 mLiveAnchorViewHolder.showEndPkBt(); - mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid()); } /** @@ -578,6 +672,9 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { /*---------------------------------------------------------------- */ final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 2) //回复PK申请 2 .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", bean.getId()).param("uid", CommonAppConfig.getInstance().getUid()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); + if (bean.isRandomPk()) { + msg1.param("random_pk", "1"); + } if (RandomPkManager.getInstance().isRankModel()) { L.eSw("排位赛"); msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png"); @@ -711,6 +808,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); Log.e("ry", "退出多人OKKK" + inputStreamList.size()); isDRPK = 0; + DRPKing = 1; runOnUiThread(new Runnable() { @Override public void run() { @@ -1159,6 +1257,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { //多人PK接受申请画 加入副房间 public void dRjoinOtherRoom(UserBean u) { + L.eSw("dRjoinOtherRoom UserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBean "); setMyDrPkDetailsView(); HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() { @Override @@ -1601,11 +1700,13 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { * 更新Pk分数 */ public void upDataPkScore(JSONArray pkScores, String uid, int time) { + this.pkScores = pkScores; + L.eSw("更新Pk分数 upDataPkScore time:" + time + " " + pkScores); String userID1 = (String) imageGrade1.getTag(); String userID2 = (String) imageGrade2.getTag(); String userID4 = (String) imageGrade4.getTag(); - if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE) { + if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE &&!"-1".equals(uid)) { mHandler.removeMessages(WHAT_PK_TIME2); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushSwViewHolder.timeTitle.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(123); @@ -1699,7 +1800,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { } } } - } else { + } else if(pkScoreSize == 4){ String userID3 = (String) imageGrade3.getTag(); detailsLinearLayout1.setVisibility(View.VISIBLE); @@ -1803,6 +1904,61 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener { } } + }else{ + detailsLinearLayout1.setVisibility(View.VISIBLE); + detailsLinearLayout2.setVisibility(View.VISIBLE); + + linearGrade1.setVisibility(View.VISIBLE); + linearGrade2.setVisibility(View.VISIBLE); + //拿到原始数据 + for (int i = 0; i < pkScores.size(); i++) { + JSONObject score = pkScores.getJSONObject(i); + String userID = score.getString("id"); + long userScore = score.getLong("score"); + if (TextUtils.equals(userID, userID1)) { + textGrade1.setText(String.valueOf(userScore)); + if (!score.containsKey("paiming")) { + ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1); + } else { + int ranking = score.getIntValue("paiming"); + switch (ranking) { + case 1: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1); + break; + case 2: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade1); + break; + case 3: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade1); + break; + case 4: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade1); + break; + } + } + } else if (TextUtils.equals(userID, userID2)) { + textGrade2.setText(String.valueOf(userScore)); + if (!score.containsKey("paiming")) { + ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2); + } else { + int ranking = score.getIntValue("paiming"); + switch (ranking) { + case 1: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2); + break; + case 2: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade2); + break; + case 3: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade2); + break; + case 4: + ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade2); + break; + } + } + } + } } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java index 26ed804b5..c1512f98d 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -3,6 +3,7 @@ package com.yunbao.live.socket; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER; import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK; +import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import android.app.Activity; @@ -314,14 +315,12 @@ public class SocketSwClient { mListener.onLinkDRMicPkApply(u); } else if (action3 == 2) { //收到对方同意多人PK邀请 - if ("0".equals(map.getString("msgtype"))) { - return; - } UserBean u = new UserBean(); // u.setUserNiceName(map.getString("uname")); u.setId(map.getString("pkuid")); L.eSw("action3 == 2:" + u.getId()); L.eSw("收到对方同意多人PK邀请"); + DRPKing = 0; mListener.onLinkDRMicPkApplyOk(u); } else if (action3 == 6) {//开始Pk if (LiveRoomViewHolder.mHandler != null) { @@ -333,6 +332,7 @@ public class SocketSwClient { // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)); } + DRPKing = 1; } else if (action3 == 5) {//结束PK // endDRGif(); LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); @@ -353,6 +353,7 @@ public class SocketSwClient { LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); }*/ isDRPK = 1; + DRPKing = 0; if (livePushSwViewHolder == null) { if ("4".equals(map.getString("msgtype"))) { return; @@ -1355,7 +1356,7 @@ public class SocketSwClient { .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()) .param("msgtype", 2).param("uid", CommonAppConfig.getInstance().getUid()) .param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()) - .param("is_auto ", "1") + .param("is_auto", "1") .param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()) .param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.create(); diff --git a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java index 0f4e2b5e8..8ce62f8a6 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java @@ -8,9 +8,11 @@ import android.content.Context; import android.graphics.Color; import android.media.AudioManager; import android.os.Build; +import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; @@ -224,7 +226,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null); IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null); - MicedUserManager.get().removeMiscUser(CommonAppConfig.getInstance().getUid()); + MicedUserManager.get().removeMiscUser(CommonAppConfig.getInstance().getUid()); } @Override @@ -238,17 +240,17 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { } }); //进入主播房间 - swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken,liveUid, SWAuManager.getChannelName(liveUid)); + swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, liveUid, SWAuManager.getChannelName(liveUid)); } @Override public void removeLiveUid(String uid) { //先结束PK - if(drMicUserList!=null){ + if (drMicUserList != null) { List tempList = new ArrayList<>(); int index = -1; - for (int i = 0; i = Build.VERSION_CODES.TIRAMISU) { - permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO}; - } else { - permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}; + String[] permissions; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO}; + } else { + permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}; + } + LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() { + @Override + public void run() { + L.eSw("将自己设置成给主播,和主播连麦"); + joinLiveMic(); + isShowInvitation = false; } - LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() { - @Override - public void run() { - L.eSw("将自己设置成给主播,和主播连麦"); - joinLiveMic(); - isShowInvitation = false; - } - }); + }); } @Override @@ -963,7 +967,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { } } - public void endLiveMicUser(){ + public void endLiveMicUser() { endLiveMic(); } diff --git a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java index 08a8dde82..03924503e 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java @@ -197,7 +197,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX btn_close.setVisibility(View.GONE);//隐藏连麦按钮 EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); closeButtonGone(); - + L.eSw("ac333333333333333333333"); SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid()); seed_msg.create(); Log.i("seed", seed_msg.mResult.toString()); 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 cf305a878..77b177e03 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -441,14 +441,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if ("svga_new_user_gif".equals(str)) { if (fastMsgRecyclerView == null) return; - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - fastMsgRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) fastMsgRecyclerView.getLayoutParams(); params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3; fastMsgRecyclerView.setLayoutParams(params1); } else if ("stop_svga_new_user_gif".equals(str)) { if (fastMsgRecyclerView == null) return; - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - fastMsgRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) fastMsgRecyclerView.getLayoutParams(); params1.rightMargin = 0; fastMsgRecyclerView.setLayoutParams(params1); } else if ("showBanner".equals(str)) { @@ -548,9 +546,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager,boolean isSw) { + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager, boolean isSw) { super(context, parentView); - this.isSw =isSw; + this.isSw = isSw; Contexts = context; this.forAct = forActivity; // this.isRy = isRys; @@ -661,8 +659,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bean.setContent(model.getMsg()); bean.setUserNiceName(model.getUserName()); - bean.setAtUserName(model.getXydgiftname()) - .setLevel(model.getLevel()); + bean.setAtUserName(model.getXydgiftname()).setLevel(model.getLevel()); bean.setType(LiveChatBean.XYD_COMPLETE); mLiveChatAdapter.insertItem(bean); xydCompleteModels.add(model); @@ -692,9 +689,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void setSudName(String sudName, SudGameDateModel sudGameDateModel) { sud_text_name = (TextView) findViewById(R.id.sud_text_name); sud_layout_name = (LinearLayout) findViewById(R.id.sud_layout_name); - sud_text_name.setText(WordUtil.isNewZh() ? - String.format("主播创建了【%s】房间,快来与主播同玩~", sudName) : - String.format("The anchor has created a 【%s】 room. Come and play with the anchor~", sudName)); + sud_text_name.setText(WordUtil.isNewZh() ? String.format("主播创建了【%s】房间,快来与主播同玩~", sudName) : String.format("The anchor has created a 【%s】 room. Come and play with the anchor~", sudName)); sud_layout_name.setVisibility(View.VISIBLE); ViewClicksAntiShake.clicksAntiShake(sud_layout_name, new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -875,10 +870,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis dr_pk_end_gif.setVisibility(View.VISIBLE); visibility = false; RequestOptions options = new RequestOptions().skipMemoryCache(true);//配置 - Glide.with(mContext).asGif() - .apply(options)//应用配置 - .load(WordUtil.isNewZh() ? R.mipmap.drpkend : R.mipmap.drpkend_en) - .listener(new RequestListener() { + Glide.with(mContext).asGif().apply(options)//应用配置 + .load(WordUtil.isNewZh() ? R.mipmap.drpkend : R.mipmap.drpkend_en).listener(new RequestListener() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { return false; @@ -890,12 +883,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis resource.setLoopCount(1);//只播放一次 } //发送延时消息,通知动画结束 - mHandler.sendEmptyMessageDelayed(1, - 3000); + mHandler.sendEmptyMessageDelayed(1, 3000); return false; } - }) - .into(dr_pk_end_gif); + }).into(dr_pk_end_gif); } @@ -1310,8 +1301,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis chat_view = (RelativeLayout) findViewById(R.id.chat_view); int topMargin = mScreenWdith * 720 / 960 + 210; - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) - chat_view.getLayoutParams(); + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) chat_view.getLayoutParams(); params.topMargin = topMargin; chat_view.setLayoutParams(params); @@ -1321,8 +1311,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis msgLayout.setLayoutParams(msgLayoutLayoutParams); voteManager.setMarginPosition(topMargin + DpUtil.dp2px(50)); - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - mChatRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); params1.topMargin = DpUtil.dp2px(65); mChatRecyclerView.setLayoutParams(params1); @@ -1350,8 +1339,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ((LiveActivity) mContext).sendChatMessage("Hi~", null, null); } else if (bean.getType() == -5) { String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Turntable&a=tricky"; - url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); Log.i("tag", url); Bundle bundle1 = new Bundle(); bundle1.putString("url", url); @@ -1470,18 +1458,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis liveAudienceActivity.pausePlay(); if (code == 1008) {//余额不足 liveAudienceActivity.setCoinNotEnough(true); - DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.live_coin_not_enough), false, - new DialogUitl.SimpleCallback2() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - RouteUtil.forwardMyCoin(mContext); - } + DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.live_coin_not_enough), false, new DialogUitl.SimpleCallback2() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + RouteUtil.forwardMyCoin(mContext); + } - @Override - public void onCancelClick() { - liveAudienceActivity.exitLiveRoom(); - } - }); + @Override + public void onCancelClick() { + liveAudienceActivity.exitLiveRoom(); + } + }); } } } @@ -1513,11 +1500,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis // ft_hot_add = (FrameLayout) findViewById(R.id.ft_hot_add); // img_hot_gif = (ImageView) findViewById(R.id.img_hot_gif); findViewById(R.id.ft_hot_add).setOnClickListener(this); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_sidebar), () -> Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.SIDEBAR))); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_sidebar), () -> Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SIDEBAR))); //点击心愿单 - ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST))); + ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST))); mBanner1.setOutlineProvider(new ViewOutlineProvider() { @Override @@ -1644,7 +1629,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private Runnable timeRunnable = new Runnable() { @Override public void run() { - Log.i("红包", "run: 红包倒计时 "+redTimeCountdown); + Log.i("红包", "run: 红包倒计时 " + redTimeCountdown); if (redTimeCountdown > 1) { timeHandler.postDelayed(timeRunnable, 1000); redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown))); @@ -1653,9 +1638,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis redTimeCountdown = 0; timeHandler.removeCallbacks(timeRunnable); StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append(mRedPacketModel.getRedPacketRemain()) - .append("/") - .append(mRedPacketModel.getRedPacketQuantity()); + stringBuffer.append(mRedPacketModel.getRedPacketRemain()).append("/").append(mRedPacketModel.getRedPacketQuantity()); redSchedule.setText(stringBuffer.toString()); openRedPacket.setText(String.format(mContext.getString(R.string.open_red_packet), mRedPacketModel.getRedPacketCount() + "")); redPacketCountdown.setVisibility(View.GONE); @@ -1670,24 +1653,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private Runnable anchorTimeRunnable = new Runnable() { @Override public void run() { - Log.i("红包", "anchorTimeRunnable run: "+mCountdown); + Log.i("红包", "anchorTimeRunnable run: " + mCountdown); if (mCountdown > 0) { mCountdown = mCountdown - 1; anchorTimeHandler.postDelayed(anchorTimeRunnable, 1000); Log.e("主播倒计时", String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(mCountdown))); if (mCountdown == 180) { - LiveNetManager.get(mContext). - startRedPacketRobot(mLiveUid, mStream, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(String data) { + LiveNetManager.get(mContext).startRedPacketRobot(mLiveUid, mStream, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { - } + } - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); } } else { redPacket.setVisibility(View.GONE); @@ -1695,24 +1677,24 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(110); dragonImmediateParticipation.setLayoutParams(layoutParams); - } if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { + } + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(110); dragonImmediateParticipationTime.setLayoutParams(layoutParams); } anchorTimeHandler.removeCallbacks(anchorTimeRunnable); - LiveNetManager.get(mContext). - endRedPacket(mLiveUid, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(String data) { + LiveNetManager.get(mContext).endRedPacket(mLiveUid, mRedPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { - } + } - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); } } }; @@ -1731,7 +1713,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutParams.topMargin = DpUtil.dp2px(190); dragonImmediateParticipation.setLayoutParams(layoutParams); } - if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE&&mContext instanceof LiveRyAnchorActivity) { + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE && mContext instanceof LiveRyAnchorActivity) { RelativeLayout.LayoutParams layoutParamsredPacket = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); layoutParamsredPacket.topMargin = DpUtil.dp2px(110); redPacket.setLayoutParams(layoutParamsredPacket); @@ -1740,7 +1722,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutParams.topMargin = DpUtil.dp2px(190); dragonImmediateParticipationTime.setLayoutParams(layoutParams); } - if (dragonImmediateParticipationTime.getVisibility() == View.GONE&&mContext instanceof LiveRyAnchorActivity){ + if (dragonImmediateParticipationTime.getVisibility() == View.GONE && mContext instanceof LiveRyAnchorActivity) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(110); redPacket.setLayoutParams(layoutParams); @@ -1757,9 +1739,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis redPacketQueue.setVisibility(View.VISIBLE); redPacketCountdown.setVisibility(View.GONE); StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append(mRedPacketModel.getRedPacketRemain()) - .append("/") - .append(mRedPacketModel.getRedPacketQuantity()); + stringBuffer.append(mRedPacketModel.getRedPacketRemain()).append("/").append(mRedPacketModel.getRedPacketQuantity()); redSchedule.setText(stringBuffer.toString()); openRedPacket.setText(String.format(mContext.getString(R.string.open_red_packet), mRedPacketModel.getRedPacketCount() + "")); } @@ -1776,37 +1756,28 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void onViewClicks() { if (!(mContext instanceof LiveSwAnchorActivity)) { - LiveNetManager.get(mContext) - .redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(RedPacketInfoModel data) { - if (TextUtils.equals(data.getReceiveStatus(), "0")) { - redTimeCountdown = redTimeCountdown - 1; - new XPopup.Builder(mContext) - .asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false, isFans)) - .show(); - } else if (TextUtils.equals(data.getReceiveStatus(), "1")) { - new XPopup.Builder(mContext) - .asCustom(new ResultRendPacketPopup(mContext, true, data.setRedPacketId(redPacketModel.getRedPacketId()), false)) - .show(); - } else { - if (data.getGiftModels().size() > 0) { - new XPopup.Builder(mContext) - .asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false)) - .show(); - } else { - new XPopup.Builder(mContext) - .asCustom(new ResultRendPacketPopup(mContext, true, data.setRedPacketId(redPacketModel.getRedPacketId()), false)) - .show(); - } - } + LiveNetManager.get(mContext).redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(RedPacketInfoModel data) { + if (TextUtils.equals(data.getReceiveStatus(), "0")) { + redTimeCountdown = redTimeCountdown - 1; + new XPopup.Builder(mContext).asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false, isFans)).show(); + } else if (TextUtils.equals(data.getReceiveStatus(), "1")) { + new XPopup.Builder(mContext).asCustom(new ResultRendPacketPopup(mContext, true, data.setRedPacketId(redPacketModel.getRedPacketId()), false)).show(); + } else { + if (data.getGiftModels().size() > 0) { + new XPopup.Builder(mContext).asCustom(new ResultRendPacketPopup(mContext, false, data.setRedPacketId(redPacketModel.getRedPacketId()), false)).show(); + } else { + new XPopup.Builder(mContext).asCustom(new ResultRendPacketPopup(mContext, true, data.setRedPacketId(redPacketModel.getRedPacketId()), false)).show(); } + } + } - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); } @@ -1829,9 +1800,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void setRedPacketInfoModel(RedPacketInfoModel redPacket) { - new XPopup.Builder(mContext) - .asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true, isFans)) - .show(); + new XPopup.Builder(mContext).asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true, isFans)).show(); } /** @@ -1880,19 +1849,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 获取当前直播间星级 */ private void initStarChallengeStatus() { - LiveNetManager.get(mContext) - .getStarChallengeStatus(PortraitLiveManager.liveID, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(StarChallengeStatusModel data1) { - showStart(data1); - Log.e("PortraitLiveManager", data1.toString()); - } + LiveNetManager.get(mContext).getStarChallengeStatus(PortraitLiveManager.liveID, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(StarChallengeStatusModel data1) { + showStart(data1); + Log.e("PortraitLiveManager", data1.toString()); + } - @Override - public void onError(String error) { - Log.e("PortraitLiveManager", error); - } - }); + @Override + public void onError(String error) { + Log.e("PortraitLiveManager", error); + } + }); } @@ -2036,155 +2004,94 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mBannerList2 != null && mBanner2 != null) { btn_event2.setVisibility(View.VISIBLE); if (mBannerList2.size() == 1) { - mBanner2.setAutoPlay(false) - .setPages(mBannerList2, new CustomViewHolder()) - .setDelayTime(3200) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (showLoadingDialog()) { + mBanner2.setAutoPlay(false).setPages(mBannerList2, new CustomViewHolder()).setDelayTime(3200).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (showLoadingDialog()) { + return; + } + if (mBannerList2 != null) { + if (p >= 0 && p < mBannerList2.size()) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + BannerBean bean = mBannerList2.get(p); + String type = ""; + if (bean.getLink().equals("BattlePass")) { + RouteUtil.forwardBattlePass(); return; } - if (mBannerList2 != null) { - if (p >= 0 && p < mBannerList2.size()) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - BannerBean bean = mBannerList2.get(p); - String type = ""; - if (bean.getLink().equals("BattlePass")) { - RouteUtil.forwardBattlePass(); - return; - } - StringBuffer htmlUrl = new StringBuffer(); - //判断是否是星级活动 - if (bean.isStart()) { + StringBuffer htmlUrl = new StringBuffer(); + //判断是否是星级活动 + if (bean.isStart()) { - type = bean.getModel().getType(); - htmlUrl.append(CommonAppConfig.HOST) - .append("/") - .append(bean.getModel().getActivityUrl()) - .append(bean.getModel().getActivityUrl().contains("?") ? "&nickname=" : "?nickname=") - .append(userInfo.getUserNicename()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&uid=") - .append(userInfo.getId()) - .append("&k=") - .append(System.currentTimeMillis()) - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - } else { - type = bean.getShow_type(); - htmlUrl.append(bean.getLink()) - .append("?uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&t=") - .append(System.currentTimeMillis()) - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - } - if (htmlUrl.toString().contains("StarChallenge")) { - Map map_ekv = new HashMap(); - map_ekv.put("link", htmlUrl.toString()); - MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); - } - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - } - } + type = bean.getModel().getType(); + htmlUrl.append(CommonAppConfig.HOST).append("/").append(bean.getModel().getActivityUrl()).append(bean.getModel().getActivityUrl().contains("?") ? "&nickname=" : "?nickname=").append(userInfo.getUserNicename()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&uid=").append(userInfo.getId()).append("&k=").append(System.currentTimeMillis()).append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + } else { + type = bean.getShow_type(); + htmlUrl.append(bean.getLink()).append("?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&t=").append(System.currentTimeMillis()).append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + } + if (htmlUrl.toString().contains("StarChallenge")) { + Map map_ekv = new HashMap(); + map_ekv.put("link", htmlUrl.toString()); + MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); + } + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } } - }) - .start(); + } + } + }).start(); } else { - mBanner2.setAutoPlay(true) - .setPages(mBannerList2, new CustomViewHolder()) - .setDelayTime(3200) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (showLoadingDialog()) { + mBanner2.setAutoPlay(true).setPages(mBannerList2, new CustomViewHolder()).setDelayTime(3200).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (showLoadingDialog()) { + return; + } + if (mBannerList2 != null) { + if (p >= 0 && p < mBannerList2.size()) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + BannerBean bean = mBannerList2.get(p); + if (bean.getLink().equals("BattlePass")) { + RouteUtil.forwardBattlePass(); return; } - if (mBannerList2 != null) { - if (p >= 0 && p < mBannerList2.size()) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - BannerBean bean = mBannerList2.get(p); - if (bean.getLink().equals("BattlePass")) { - RouteUtil.forwardBattlePass(); - return; - } - String type = ""; - StringBuffer htmlUrl = new StringBuffer(); - //判断是否是星级活动 - if (bean.isStart()) { - type = bean.getModel().getType(); - htmlUrl.append(CommonAppConfig.HOST) - .append("/") - .append(bean.getModel().getActivityUrl()) - .append(bean.getModel().getActivityUrl().contains("?") ? "&nickname=" : "?nickname=") - .append(userInfo.getUserNicename()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&uid=") - .append(userInfo.getId()) - .append("&k=") - .append(System.currentTimeMillis()) - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + //判断是否是星级活动 + if (bean.isStart()) { + type = bean.getModel().getType(); + htmlUrl.append(CommonAppConfig.HOST).append("/").append(bean.getModel().getActivityUrl()).append(bean.getModel().getActivityUrl().contains("?") ? "&nickname=" : "?nickname=").append(userInfo.getUserNicename()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&uid=").append(userInfo.getId()).append("&k=").append(System.currentTimeMillis()).append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - } else { - type = bean.getShow_type(); - htmlUrl.append(bean.getLink()) - .append(bean.getLink().contains("?") ? "&uid=" : "?uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&liveUid=") - .append(mLiveUid) - .append("&t=") - .append(System.currentTimeMillis()) - .append("&g=Appapi&m=Wish&a=index") - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - } - if (htmlUrl.toString().contains("StarChallenge")) { - Map map_ekv = new HashMap(); - map_ekv.put("link", htmlUrl.toString()); - MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); - } - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - } - } + } else { + type = bean.getShow_type(); + htmlUrl.append(bean.getLink()).append(bean.getLink().contains("?") ? "&uid=" : "?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&liveUid=").append(mLiveUid).append("&t=").append(System.currentTimeMillis()).append("&g=Appapi&m=Wish&a=index").append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + } + if (htmlUrl.toString().contains("StarChallenge")) { + Map map_ekv = new HashMap(); + map_ekv.put("link", htmlUrl.toString()); + MobclickAgent.onEvent(mContext, "live_room_star", map_ekv); + } + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } } - }) - .start(); + } + } + }).start(); } } @@ -2276,73 +2183,67 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void showLiveRoomActivityBanner() { - LiveNetManager.get(mContext) - .getLiveRoomActivityBanner(new com.yunbao.common.http.base.HttpCallback>() { - @Override - public void onSuccess(List data) { - mBannerList4.clear(); - for (LiveRoomActivityBanner datum : data) { - if (datum.getHidden() == 1) { - continue; - } - BannerBean bean = new BannerBean(); - bean.setActivityId(datum.getActiveId()); - bean.setName(datum.getName()); - bean.setLink(datum.getLink()); - bean.setImageUrl(datum.getImg()); - bean.setShow_type(datum.getType()); - mBannerList4.add(bean); - } - showBanner4(); + LiveNetManager.get(mContext).getLiveRoomActivityBanner(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + mBannerList4.clear(); + for (LiveRoomActivityBanner datum : data) { + if (datum.getHidden() == 1) { + continue; } + BannerBean bean = new BannerBean(); + bean.setActivityId(datum.getActiveId()); + bean.setName(datum.getName()); + bean.setLink(datum.getLink()); + bean.setImageUrl(datum.getImg()); + bean.setShow_type(datum.getType()); + mBannerList4.add(bean); + } + showBanner4(); + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); + } + }); } private void showBanner() { if (mBannerList1 == null || mBannerList1.size() == 0 || mBanner1 == null) { return; } - mBanner1.setAutoPlay(true) - .setPages(mBannerList1, new CustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList1 != null) { - if (p >= 0 && p < mBannerList1.size()) { - BannerBean bean = mBannerList1.get(p); - if (bean != null) { - String link = bean.getLink(); - if (link.equals("BattlePass")) { - RouteUtil.forwardBattlePass(); - return; - } - if (link.equals("sc")) { - String url; - if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) { - url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); - } else { - url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); - } - ZhuangBanActivity.forward(mContext, url, false, 1); - } else if (link.equals("zxb")) { - String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); - ZhuangBanActivity.forward(mContext, url, false, 1); - } else if (link.equals("xyd")) { - openWishListWindow(); - } + mBanner1.setAutoPlay(true).setPages(mBannerList1, new CustomViewHolder()).setDelayTime(3000).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList1 != null) { + if (p >= 0 && p < mBannerList1.size()) { + BannerBean bean = mBannerList1.get(p); + if (bean != null) { + String link = bean.getLink(); + if (link.equals("BattlePass")) { + RouteUtil.forwardBattlePass(); + return; + } + if (link.equals("sc")) { + String url; + if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) { + url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + } else { + url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } + ZhuangBanActivity.forward(mContext, url, false, 1); + } else if (link.equals("zxb")) { + String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + ZhuangBanActivity.forward(mContext, url, false, 1); + } else if (link.equals("xyd")) { + openWishListWindow(); } } } - }) - .start(); + } + } + }).start(); } /** @@ -2426,8 +2327,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis path = "/" + path; } String url = CommonAppConfig.HOST + path; - url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; bundle.putString("url", url); bundle.putInt("height", DpUtil.dp2px(500)); bundle.putInt("show_type", 0); @@ -2450,51 +2350,47 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); textParams.leftMargin = DpUtil.dp2px(5); params.leftMargin = DpUtil.dp2px(5); - API.get().pdLiveApi(mContext).getHourChartRank(mLiveUid) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(listResponseModel -> { - List info = listResponseModel.getData().getInfo(); - if (!info.isEmpty()) { - View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); - View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); - ImageView hotPic = hotView.findViewById(R.id.wish_pic); - ImageView hourPic = hourView.findViewById(R.id.wish_pic); - mHotText = hotView.findViewById(R.id.wish_index); - mHourRank = hourView.findViewById(R.id.wish_index); - mHotText.setText("0"); - mHotText.setLayoutParams(textParams); - mHourRank.setLayoutParams(textParams); - mHotText.setGravity(Gravity.CENTER); - mHourRank.setGravity(Gravity.CENTER); - setHourRankData(info.get(0).getRank()); - hotPic.setImageResource(R.drawable.icon_time_new); - hourPic.setImageResource(R.drawable.icon_heat_new); - hotPic.setLayoutParams(params); - hourPic.setLayoutParams(params); - flipper.addView(hotView); - flipper.addView(hourView); - flipper.startFlipping(); + API.get().pdLiveApi(mContext).getHourChartRank(mLiveUid).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(listResponseModel -> { + List info = listResponseModel.getData().getInfo(); + if (!info.isEmpty()) { + View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView hotPic = hotView.findViewById(R.id.wish_pic); + ImageView hourPic = hourView.findViewById(R.id.wish_pic); + mHotText = hotView.findViewById(R.id.wish_index); + mHourRank = hourView.findViewById(R.id.wish_index); + mHotText.setText("0"); + mHotText.setLayoutParams(textParams); + mHourRank.setLayoutParams(textParams); + mHotText.setGravity(Gravity.CENTER); + mHourRank.setGravity(Gravity.CENTER); + setHourRankData(info.get(0).getRank()); + hotPic.setImageResource(R.drawable.icon_time_new); + hourPic.setImageResource(R.drawable.icon_heat_new); + hotPic.setLayoutParams(params); + hourPic.setLayoutParams(params); + flipper.addView(hotView); + flipper.addView(hourView); + flipper.startFlipping(); // flipper.setOnClickListener(view -> { // // }); - ViewClicksAntiShake.clicksAntiShake(hotView, new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - showUrlHDDialog(info.get(0).getUrl()); - } - }); - ViewClicksAntiShake.clicksAntiShake(hourView, new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - showUrlHDDialog(info.get(0).getUrl()); - } - }); - - + ViewClicksAntiShake.clicksAntiShake(hotView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + showUrlHDDialog(info.get(0).getUrl()); } - }, Throwable::printStackTrace) - .isDisposed(); + }); + ViewClicksAntiShake.clicksAntiShake(hourView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + showUrlHDDialog(info.get(0).getUrl()); + } + }); + + + } + }, Throwable::printStackTrace).isDisposed(); new LoadDian9TuUtil().loadDian9TuAssets2(mContext, hourRankLayout, "rectangle_new.png", 1); } @@ -2504,9 +2400,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis path = "/" + path; } String url = CommonAppConfig.HOST + path; - url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid - + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); + url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); bundle.putString("url", url); bundle.putInt("height", DpUtil.dp2px(500)); bundle.putInt("show_type", 0); @@ -2596,84 +2490,82 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void initRankPKInfo(String mLiveUid, String pkUid) { - LiveNetManager.get(mContext) - .getRandomPk(mLiveUid, pkUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(PkRankBean bean) { - if (bean != null) { - initPkRankView(bean); - if (!StringUtil.isEmpty(bean.getClickUrl())) { + LiveNetManager.get(mContext).getRandomPk(mLiveUid, pkUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(PkRankBean bean) { + if (bean != null) { + initPkRankView(bean); + if (!StringUtil.isEmpty(bean.getClickUrl())) { - pkRankVf.setOnClickListener(v -> { - MobclickAgent.onEvent(mContext, "live_room_sky", "天梯赛按钮"); - Bundle bundle = new Bundle(); - String path = bean.getClickUrl(); - if (!path.startsWith("/") && !path.startsWith("http")) { - path = "/" + path; - } - String url = null; - if (path.startsWith("http") || path.startsWith("/http")) { - url = path; - } else { - url = CommonAppConfig.HOST + path; - } - if (!url.contains("?")) { - url += "?"; - } else { - url += "&"; - } - url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); - bundle.putString("url", url); - bundle.putInt("height", DpUtil.dp2px(500)); - bundle.putInt("show_type", 0); - bundle.putString("roomId", mLiveUid); - LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); - liveHDDialogFragment.setArguments(bundle); - liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - }); + pkRankVf.setOnClickListener(v -> { + MobclickAgent.onEvent(mContext, "live_room_sky", "天梯赛按钮"); + Bundle bundle = new Bundle(); + String path = bean.getClickUrl(); + if (!path.startsWith("/") && !path.startsWith("http")) { + path = "/" + path; } - pkRankLayout.setVisibility(View.VISIBLE); - - liveRankPk2.setVisibility(View.VISIBLE); - mPkRankText.setText(bean.getName()); - ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); - pkUidTmp = ""; - if (StringUtil.isEmpty(bean.getPkTopImgUrl())) { - return; + String url = null; + if (path.startsWith("http") || path.startsWith("/http")) { + url = path; + } else { + url = CommonAppConfig.HOST + path; } - if (!StringUtil.isEmpty(isLadders)) { - bean.setPkTopImgUrl(isLadders); + if (!url.contains("?")) { + url += "?"; + } else { + url += "&"; } - if (Integer.parseInt(bean.getRedVal()) > 2) { - mRedVal.setVisibility(View.VISIBLE); - mRedVal.setText(bean.getRedVal() + (WordUtil.isNewZh() ? "連勝" : "Win")); - } - if (Integer.parseInt(bean.getBlueVal()) > 2) { - mBlueVal.setVisibility(View.VISIBLE); - mBlueVal.setText(bean.getBlueVal() + (WordUtil.isNewZh() ? "連勝" : "Win")); - } - mPkRankTopIcon.setVisibility(View.VISIBLE); - ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); - } - if (mRedVal.getVisibility() == View.VISIBLE) { - RelativeLayout.LayoutParams redValLayoutParams = (RelativeLayout.LayoutParams) mRedVal.getLayoutParams(); - redValLayoutParams.bottomMargin = DpUtil.dp2px(10); - mRedVal.setLayoutParams(redValLayoutParams); - } - if (mBlueVal.getVisibility() == View.VISIBLE) { - RelativeLayout.LayoutParams blueValLayoutParams = (RelativeLayout.LayoutParams) mBlueVal.getLayoutParams(); - blueValLayoutParams.bottomMargin = DpUtil.dp2px(10); - mBlueVal.setLayoutParams(blueValLayoutParams); - } + url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + bundle.putString("url", url); + bundle.putInt("height", DpUtil.dp2px(500)); + bundle.putInt("show_type", 0); + bundle.putString("roomId", mLiveUid); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle); + liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }); } + pkRankLayout.setVisibility(View.VISIBLE); - @Override - public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); - pkUidTmp = ""; + liveRankPk2.setVisibility(View.VISIBLE); + mPkRankText.setText(bean.getName()); + ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); + pkUidTmp = ""; + if (StringUtil.isEmpty(bean.getPkTopImgUrl())) { + return; } - }); + if (!StringUtil.isEmpty(isLadders)) { + bean.setPkTopImgUrl(isLadders); + } + if (Integer.parseInt(bean.getRedVal()) > 2) { + mRedVal.setVisibility(View.VISIBLE); + mRedVal.setText(bean.getRedVal() + (WordUtil.isNewZh() ? "連勝" : "Win")); + } + if (Integer.parseInt(bean.getBlueVal()) > 2) { + mBlueVal.setVisibility(View.VISIBLE); + mBlueVal.setText(bean.getBlueVal() + (WordUtil.isNewZh() ? "連勝" : "Win")); + } + mPkRankTopIcon.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); + } + if (mRedVal.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams redValLayoutParams = (RelativeLayout.LayoutParams) mRedVal.getLayoutParams(); + redValLayoutParams.bottomMargin = DpUtil.dp2px(10); + mRedVal.setLayoutParams(redValLayoutParams); + } + if (mBlueVal.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams blueValLayoutParams = (RelativeLayout.LayoutParams) mBlueVal.getLayoutParams(); + blueValLayoutParams.bottomMargin = DpUtil.dp2px(10); + mBlueVal.setLayoutParams(blueValLayoutParams); + } + } + + @Override + public void onError(String error) { + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); + pkUidTmp = ""; + } + }); } /** @@ -3067,8 +2959,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public boolean pkHandler = true; @Subscribe(threadMode = ThreadMode.MAIN) - public void setOtherInfo(LivePKRightUserInfoEvent livePKRightUserInfoEvent){ - setOtherInfo(livePKRightUserInfoEvent.getUid(),livePKRightUserInfoEvent.getuHead(),livePKRightUserInfoEvent.getuName()); + public void setOtherInfo(LivePKRightUserInfoEvent livePKRightUserInfoEvent) { + setOtherInfo(livePKRightUserInfoEvent.getUid(), livePKRightUserInfoEvent.getuHead(), livePKRightUserInfoEvent.getuName()); } //左上角显示对方主播头像及昵称 @@ -3288,19 +3180,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis participation_time.postDelayed(sendMoneyRunnable, 1000); } else { participation_time.removeCallbacks(sendMoneyRunnable); - LiveNetManager.get(mContext) - .endSendMoneyLong(mLiveUid, mSendMoneyLongModel.getSendMoneyLongKey(), - new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(SendMoneyLongModel data) { + LiveNetManager.get(mContext).endSendMoneyLong(mLiveUid, mSendMoneyLongModel.getSendMoneyLongKey(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(SendMoneyLongModel data) { - } + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); + } + }); } } }; @@ -3340,10 +3230,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis weekViewPic.setLayoutParams(params); if (!TextUtils.isEmpty(giftWallLightenNumber) && !TextUtils.isEmpty(giftWallLightenTotal)) { StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append(mContext.getString(R.string.gift_wall)) - .append(giftWallLightenNumber) - .append("/") - .append(giftWallLightenTotal); + stringBuffer.append(mContext.getString(R.string.gift_wall)).append(giftWallLightenNumber).append("/").append(giftWallLightenTotal); View giftWall = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); ImageView giftWallPic = giftWall.findViewById(R.id.wish_pic); TextView giftText = giftWall.findViewById(R.id.wish_index); @@ -3356,12 +3243,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ViewClicksAntiShake.clicksAntiShake(giftWall, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.GIFT_WALL) - .setUid(mLiveUid) - .setVoicePress(true) - .setAvatar(mAvatarUrl) - .setUname(mAnchorName)); + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_WALL).setUid(mLiveUid).setVoicePress(true).setAvatar(mAvatarUrl).setUname(mAnchorName)); } }); } @@ -3370,8 +3252,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onViewClicks() { MobclickAgent.onEvent(mContext, "live_room_week", "周星榜按钮"); - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS)); + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS)); } }); wksAndGiftWall.addView(weekView); @@ -3654,12 +3535,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void callback(Integer isAttention) { if (isAttention == 1) { - if(isSw){ - LiveActivity.sendSystemMessageSw( - CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor)); - }else{ - LiveActivity.sendSystemMessageRy( - CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor)); + if (isSw) { + LiveActivity.sendSystemMessageSw(CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor)); + } else { + LiveActivity.sendSystemMessageRy(CommonAppConfig.getInstance().getUserBean().getUserNiceName() + Contexts.getString(R.string.live_follow_anchor)); } } } @@ -3739,7 +3618,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveSwAnchorActivity.backIndex = 1; ((LiveSwAnchorActivity) mContext).onBackPressed(); } - }else if(mContext instanceof LiveRyAnchorActivity){ + } else if (mContext instanceof LiveRyAnchorActivity) { if (forAct == 1) { //是否关注0==没关注 if (isAttention == 0) { @@ -4013,8 +3892,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis setHotData(formatBigNum.formatBigNum(bean.getHot_num())); mTvMedalRank.setText(bean.getMedalRankNum()); //开通粉丝勋章成功弹窗 - if (!isAncher && bean.getMedalFirstGet() != null && bean.getMedalFirstGet().equals("1") - && bean.getUid().equals(CommonAppConfig.getInstance().getUid())) { + if (!isAncher && bean.getMedalFirstGet() != null && bean.getMedalFirstGet().equals("1") && bean.getUid().equals(CommonAppConfig.getInstance().getUid())) { ((LiveAudienceActivity) mContext).openFansMedalOkWindow(); } @@ -4026,7 +3904,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mLiveGiftAnimPresenter == null) { mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); } - mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid,mStream); + mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); mLiveGiftAnimPresenter.showGiftAnim(bean, isAncher); } @@ -4050,16 +3928,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent,boolean showB) { + public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent, boolean showB) { if (mLiveGiftAnimPresenter == null) { mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); } mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); - mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB); + mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent, showB); } - public void cancelAllAnim(){ - if(mLiveGiftAnimPresenter!=null){ + public void cancelAllAnim() { + if (mLiveGiftAnimPresenter != null) { mLiveGiftAnimPresenter.releaseServiceNotice(); } } @@ -4090,60 +3968,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis switch (bean.getNobilityid()) { case "1": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.BARON) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.BARON).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "2": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.VISCOUNT) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.VISCOUNT).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "3": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.MARQUIS) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.MARQUIS).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "4": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.DUKE) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.DUKE).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "5": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.KING) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.KING).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "6": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.EMPEROR) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.EMPEROR).setCallBack(() -> gotoLive(bean.getRoomnum())); break; case "7": - noble.setRootView(bean.getUhead(), - bean.getUname(), - bean.getAncherName(), - bean.getRoomnum()) - .setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR) - .setCallBack(() -> gotoLive(bean.getRoomnum())); + noble.setRootView(bean.getUhead(), bean.getUname(), bean.getAncherName(), bean.getRoomnum()).setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR).setCallBack(() -> gotoLive(bean.getRoomnum())); break; } } @@ -4454,8 +4297,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void setFastMessage(List greetings) { fastMsgRecyclerView.setVisibility(View.VISIBLE); fastMessageRecyclerViewAdapter.setMessage(greetings); - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - mChatRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); if (greetings.size() > 0) { params1.bottomMargin = 100; } else { @@ -4515,14 +4357,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void openGiftDialog(String giftId) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP) - .setmLiveUid(mLiveUid) - .setmStream(mStream) - .setPk(false) - .setLiveGuardInfo(null) - .setmWishGiftId(giftId) - .setUname("0"));//setUname==by + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setPk(false).setLiveGuardInfo(null).setmWishGiftId(giftId).setUname("0"));//setUname==by } public void setFansGroup(String isFans) { @@ -4640,32 +4475,27 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis return; } - mBanner3.setAutoPlay(true) - .setPages(mBannerList3, new Banner3CustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList3 != null) { - if (mBannerList3.get(p).getLink().equals("BattlePass")) { - RouteUtil.forwardBattlePass(); - return; - } - if (mBannerList3.get(p).getLink().equals("0")) { - if (p == 0) { - ((LiveAudienceActivity) mContext).openGiftWindow("" + bean1.getId(), "1"); - EventBus.getDefault().post("svga_new_user_gif"); - } else if (p == 1) { - EventBus.getDefault().post("svga_new_user_follow"); - } else if (p == 2) { - EventBus.getDefault().post("svga_new_user_double"); - } - } + mBanner3.setAutoPlay(true).setPages(mBannerList3, new Banner3CustomViewHolder()).setDelayTime(3000).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList3 != null) { + if (mBannerList3.get(p).getLink().equals("BattlePass")) { + RouteUtil.forwardBattlePass(); + return; + } + if (mBannerList3.get(p).getLink().equals("0")) { + if (p == 0) { + ((LiveAudienceActivity) mContext).openGiftWindow("" + bean1.getId(), "1"); + EventBus.getDefault().post("svga_new_user_gif"); + } else if (p == 1) { + EventBus.getDefault().post("svga_new_user_follow"); + } else if (p == 2) { + EventBus.getDefault().post("svga_new_user_double"); } } - }) - .start(); + } + } + }).start(); } /** @@ -4679,69 +4509,61 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis for (BannerBean bean : mBannerList4) { Log.i("debug", "showBanner4: " + bean.toString()); } - mBanner4.setAutoPlay(true) - .setPages(mBannerList4, new Banner4CustomViewHolder()) - .setDelayTime(2800) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { + mBanner4.setAutoPlay(true).setPages(mBannerList4, new Banner4CustomViewHolder()).setDelayTime(2800).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList4.get(p).getLink().equals("BattlePass") || mBannerList4.get(p).getType() == 888) { - RouteUtil.forwardBattlePass(); - return; - } - if (TextUtils.equals("特惠首冲", mBannerList4.get(p).getName())) { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList4.get(p).getLink().equals("BattlePass") || mBannerList4.get(p).getType() == 888) { + RouteUtil.forwardBattlePass(); + return; + } + if (TextUtils.equals("特惠首冲", mBannerList4.get(p).getName())) { - Map map_ekv = new HashMap(); - map_ekv.put("link", mBannerList4.get(p).getLink()); - MobclickAgent.onEvent(mContext, "live_room_first_charge", map_ekv); - } - Log.i("debug", "onBannerClick: " + mBannerList4.get(p).toString()); - BannerBean bean = mBannerList4.get(p); - if (showLoadingDialog()) { - return; - } - if (bean.getActivityId() == -1) {//-1写死跳活动弹窗 - Bus.get().post(new LiveAudienceEvent() - .setActivity(true) - .setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION)); - } else if (bean.getActivityId() == 0) { - openWebDialog(bean.getLink()); - } else { - LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type())); - fragment.setActivityId(bean.getActivityId()); - fragment.setRoomId(mLiveUid); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment"); - } + Map map_ekv = new HashMap(); + map_ekv.put("link", mBannerList4.get(p).getLink()); + MobclickAgent.onEvent(mContext, "live_room_first_charge", map_ekv); + } + Log.i("debug", "onBannerClick: " + mBannerList4.get(p).toString()); + BannerBean bean = mBannerList4.get(p); + if (showLoadingDialog()) { + return; + } + if (bean.getActivityId() == -1) {//-1写死跳活动弹窗 + Bus.get().post(new LiveAudienceEvent().setActivity(true).setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION)); + } else if (bean.getActivityId() == 0) { + openWebDialog(bean.getLink()); + } else { + LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type())); + fragment.setActivityId(bean.getActivityId()); + fragment.setRoomId(mLiveUid); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment"); + } + } + + + private void openWebDialog(String url) { + if (!url.startsWith("http")) { + if (url.startsWith("/")) { + url = CommonAppConfig.HOST + url; + } else { + url = CommonAppConfig.HOST + "/" + url; } + } + if (url.contains("?")) { + url += "&"; + } else { + url += "?"; + } + url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + Log.i("tag", url); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", url); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle1); + liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - - private void openWebDialog(String url) { - if (!url.startsWith("http")) { - if (url.startsWith("/")) { - url = CommonAppConfig.HOST + url; - } else { - url = CommonAppConfig.HOST + "/" + url; - } - } - if (url.contains("?")) { - url += "&"; - } else { - url += "?"; - } - url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; - Log.i("tag", url); - Bundle bundle1 = new Bundle(); - bundle1.putString("url", url); - LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); - liveHDDialogFragment.setArguments(bundle1); - liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - - } - }) - .start(); + } + }).start(); } private int nowTime = 0; @@ -4944,9 +4766,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param msgModel */ public void showFullScreen(MsgModel msgModel) { - fullScreen.setUserNameAndUserText(msgModel.getUserName(), msgModel.getTrumpetMsg()) - .setType(msgModel.getRoleType()) - .setCallBack(() -> gotoLive(msgModel.getAnchorId())); + fullScreen.setUserNameAndUserText(msgModel.getUserName(), msgModel.getTrumpetMsg()).setType(msgModel.getRoleType()).setCallBack(() -> gotoLive(msgModel.getAnchorId())); } /** @@ -4961,20 +4781,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) { + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { if (liveBean == null) { return; } if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(1) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI).setMicIng(1).setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(2) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI).setMicIng(2).setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); } else { if (MicStatusManager.getInstance().isMic(liveUid)) { MicStatusManager.getInstance().showDownMicDialog(mContext); @@ -5208,12 +5022,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void run() { BannerBean bannerBean = new BannerBean(); - bannerBean.setWishlistIcon(model.getWishlistIcon()) - .setWishlistName(model.getWishlistName()) - .setWishlistNum(model.getWishlistNum()) - .setWishlistProgress(model.getWishlistProgress()) - .setmLink(CommonAppConfig.HOST + "/index.php") - .setType(1); + bannerBean.setWishlistIcon(model.getWishlistIcon()).setWishlistName(model.getWishlistName()).setWishlistNum(model.getWishlistNum()).setWishlistProgress(model.getWishlistProgress()).setmLink(CommonAppConfig.HOST + "/index.php").setType(1); bannerBean.setShow_type("2"); mTopBannerList.add(bannerBean); LiveChatBean bean = new LiveChatBean(); @@ -5342,8 +5151,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mPkTimeCount2 == 0) { timeTitle.setVisibility(View.GONE); timeTitle.removeCallbacks(countdownRunnable); - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); + Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TIME_COUNT)); } else { timeTitle.setVisibility(View.VISIBLE); Log.e("多人Pk", "countdownRunnable mPkTimeCount:" + mPkTimeCount2); @@ -5356,51 +5164,53 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }; + public void upDataPkScore(JSONArray pkScores, int time) { - L.eSw("upDataPkScore(JSONArray pkScores, int time) {"+new Gson().toJson(pkScores)); + L.eSw("upDataPkScore(JSONArray pkScores, int time) {" + new Gson().toJson(pkScores)); isShowGif = true; - if (detailsView == null) { - L.eSw("upDataPkScore(JSONArray pkScores, int time) {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); + if (detailsView != null) { mRoot.removeView(detailsView); - 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); - } - }); } + L.eSw("upDataPkScore(JSONArray pkScores, int time) {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); + } + }); if (time > 0) { mPkTimeCount2 = time; drPKtIME = time; @@ -5490,7 +5300,142 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis showUserDialog(userId3); } }); + } + public void upDataPkScore(JSONArray pkScores) { + L.eSw("upDataPkScore(JSONArray pkScores, int time) {" + new Gson().toJson(pkScores)); + isShowGif = true; + if (detailsView == null) { + L.eSw("upDataPkScore(JSONArray pkScores, int time) {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.removeView(detailsView); + 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); + } + }); + } + Log.e("多人Pk", "upDataPkScore mPkTimeCount:" + mPkTimeCount); + if (pkScores.size() == 2) { + linearGrade3.setVisibility(View.GONE); + linearGrade4.setVisibility(View.GONE); + } else if(pkScores.size()==3){ + linearGrade4.setVisibility(View.GONE); + } + 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) { + if (pkScores.size() == 3) { + linearGrade4.setVisibility(View.VISIBLE); + textPkName4.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade4); + textGrade4.setText(String.valueOf(userScore)); + userId4 = userId; + } else { + linearGrade3.setVisibility(View.VISIBLE); + textPkName3.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade3); + textGrade3.setText(String.valueOf(userScore)); + userId3 = userId; + } + + } else if (i == 3) { + linearGrade4.setVisibility(View.VISIBLE); + textPkName4.setText(userNiceName); + ImgLoader.display(mContext, resScore, imageGrade4); + textGrade4.setText(String.valueOf(userScore)); + userId4 = userId; + } + } + + + 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); + } + }); } @@ -5519,8 +5464,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param landscape */ public void changeMessageLandscape(int landscape) { - RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) - mChatRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); RelativeLayout.LayoutParams enterRoomParams = (RelativeLayout.LayoutParams) enterRoomLeave.getLayoutParams(); if (landscape == 2) { params1.height = DpUtil.dp2px(200); @@ -5613,10 +5557,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis TextView userName = fans_enter_room_leave.findViewById(R.id.user_name); ImageView bg = fans_enter_room_leave.findViewById(R.id.bg); - userName.setText(Html.fromHtml(String.format("@%s %s", - model.getUserNiceName(), - mContext.getString(R.string.live_fans_group_enter_room) - ))); + userName.setText(Html.fromHtml(String.format("@%s %s", model.getUserNiceName(), mContext.getString(R.string.live_fans_group_enter_room)))); ImgLoader.display(mContext, model.getFansEnterRoomUrl(), bg); fans_enter_room_leave.setVisibility(View.VISIBLE); TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 0, 0, 0); @@ -5705,47 +5646,46 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveAnchorSayModel sayModel; public void initAnchorSayData() { - LiveNetManager.get(mContext) - .getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(LiveAnchorSayModel data) { - Log.i("女神说", "onSuccess: " + data); - sayModel = data; - LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); - if (preview != null) { - mAnchorSayText.setText(getText(data.getLivePreview().getContent())); - ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage); - if (preview.getIsShow() == 1) { - mAnchorSay.setVisibility(View.VISIBLE); - } else { - mAnchorSay.setVisibility(View.INVISIBLE); - } - } else { - mAnchorSay.setVisibility(View.INVISIBLE); - } - + LiveNetManager.get(mContext).getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(LiveAnchorSayModel data) { + Log.i("女神说", "onSuccess: " + data); + sayModel = data; + LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); + if (preview != null) { + mAnchorSayText.setText(getText(data.getLivePreview().getContent())); + ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage); + if (preview.getIsShow() == 1) { + mAnchorSay.setVisibility(View.VISIBLE); + } else { + mAnchorSay.setVisibility(View.INVISIBLE); } + } else { + mAnchorSay.setVisibility(View.INVISIBLE); + } - @Override - public void onError(String error) { + } + @Override + public void onError(String error) { + + } + + public String getText(String content) { + int t = 4; + float len = (float) content.length() / t; + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + for (int i = 0; i < len; i++) { + if (len - i < 1) { + sb.append(content.substring(i * t)); + } else { + sb.append(content.substring(i * t, i * t + t)).append("\n"); } - - public String getText(String content) { - int t = 4; - float len = (float) content.length() / t; - StringBuilder sb = new StringBuilder(); - sb.append("\n"); - for (int i = 0; i < len; i++) { - if (len - i < 1) { - sb.append(content.substring(i * t)); - } else { - sb.append(content.substring(i * t, i * t + t)).append("\n"); - } - } - return sb.toString(); - } - }); + } + return sb.toString(); + } + }); } public void initAnchorSay() { @@ -5769,10 +5709,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void showAnchorSayAndCallAnchor() { isHinde = false; - if (mAnchorSay.getVisibility() != View.VISIBLE && - sayModel != null && sayModel.getLivePreview() != null && - sayModel.getLivePreview().getIsShow() == 1 - ) { + if (mAnchorSay.getVisibility() != View.VISIBLE && sayModel != null && sayModel.getLivePreview() != null && sayModel.getLivePreview().getIsShow() == 1) { Log.i("女神说", "sayModel: " + sayModel); mAnchorSay.setVisibility(View.VISIBLE); } @@ -5805,12 +5742,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } BannerBean bannerBean = new BannerBean(); - bannerBean.setWishlistIcon(wishListProgress.getWishlistIcon()) - .setWishlistName(wishListProgress.getWishlistName()) - .setWishlistNum(wishListProgress.getWishlistNum()) - .setWishlistProgress(wishListProgress.getWishlistProgress()) - .setmLink(CommonAppConfig.HOST + "/index.php") - .setType(1); + bannerBean.setWishlistIcon(wishListProgress.getWishlistIcon()).setWishlistName(wishListProgress.getWishlistName()).setWishlistNum(wishListProgress.getWishlistNum()).setWishlistProgress(wishListProgress.getWishlistProgress()).setmLink(CommonAppConfig.HOST + "/index.php").setType(1); bannerBean.setShow_type("2"); if (mTopBannerList.size() == 1 || mTopBannerList.size() == 0) { mTopBannerList.add(bannerBean); @@ -5832,197 +5764,142 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis return; } topBanner1.setVisibility(View.GONE); - topBanner1.setAutoPlay(true) - .setPages(mTopBannerList, new TopBannerCustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int position) { - if (datas.size() > 0 && mTopBannerList != null && mTopBannerList.size() > 0) { - if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { - MobclickAgent.onEvent(mContext, "live_room_contact", "联系方式按钮"); - Dialog loading = DialogUitl.loadingDialog(mContext); - loading.show(); - LiveNetManager.get(mContext) - .getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + topBanner1.setAutoPlay(true).setPages(mTopBannerList, new TopBannerCustomViewHolder()).setDelayTime(3000).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int position) { + if (datas.size() > 0 && mTopBannerList != null && mTopBannerList.size() > 0) { + if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { + MobclickAgent.onEvent(mContext, "live_room_contact", "联系方式按钮"); + Dialog loading = DialogUitl.loadingDialog(mContext); + loading.show(); + LiveNetManager.get(mContext).getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(LiveAnchorCallMeModel data) { - if (data.getIsGet() == 1) { - new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()) - .setOnDismissListener(dialog -> { - checkNewLetter(); - loading.dismiss(); - }) - .showDialog(); - return; - } - new LiveContactDetailsSendGiftDialog(mContext) - .setGiftId(data.getGiftId()) - .setAnchorName(mAnchorName) - .setStream(mStream) - .setLiveUid(mLiveUid) - .setOnDismissListener(dialog1 -> { - checkNewLetter(); - }) - .showDialog(); - loading.dismiss(); - } - - @Override - public void onError(String error) { - loading.dismiss(); - } - }); - - } else { - MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮"); - BannerBean bean = mTopBannerList.get(position); - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - String type = ""; - StringBuffer htmlUrl = new StringBuffer(); - htmlUrl.append(bean.getLink()) - .append(bean.getLink().contains("?") ? "&uid=" : "?uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&liveUid=") - .append(mLiveUid) - .append("&t=") - .append(System.currentTimeMillis()) - .append("&g=Appapi&m=Wish&a=index") - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + if (data.getIsGet() == 1) { + new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()).setOnDismissListener(dialog -> { + checkNewLetter(); + loading.dismiss(); + }).showDialog(); + return; } + new LiveContactDetailsSendGiftDialog(mContext).setGiftId(data.getGiftId()).setAnchorName(mAnchorName).setStream(mStream).setLiveUid(mLiveUid).setOnDismissListener(dialog1 -> { + checkNewLetter(); + }).showDialog(); + loading.dismiss(); } + + @Override + public void onError(String error) { + loading.dismiss(); + } + }); + + } else { + MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮"); + BannerBean bean = mTopBannerList.get(position); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(bean.getLink()).append(bean.getLink().contains("?") ? "&uid=" : "?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&liveUid=").append(mLiveUid).append("&t=").append(System.currentTimeMillis()).append("&g=Appapi&m=Wish&a=index").append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } - } - }) - .start(); - topBanner2.setAutoPlay(true) - .setPages(mTopBannerList, new TopBannerCustomViewHolder(false)) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int position) { - if (datas.size() > 0) { - if (position >= mTopBannerList.size()) { - position = 0; - } - if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { - MobclickAgent.onEvent(mContext, "live_room_contact", "联系方式按钮"); - Dialog loading = DialogUitl.loadingDialog(mContext); - loading.show(); - LiveNetManager.get(mContext) - .getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + } - @Override - public void onSuccess(LiveAnchorCallMeModel data) { - if (data.getIsGet() == 1) { - new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()) - .setOnDismissListener(dialog -> { - checkNewLetter(); - loading.dismiss(); - }) - .showDialog(); - return; - } - new LiveContactDetailsSendGiftDialog(mContext) - .setGiftId(data.getGiftId()) - .setAnchorName(mAnchorName) - .setStream(mStream) - .setLiveUid(mLiveUid) - .setOnDismissListener(dialog1 -> { - checkNewLetter(); - }) - .showDialog(); - loading.dismiss(); - } + } + }).start(); + topBanner2.setAutoPlay(true).setPages(mTopBannerList, new TopBannerCustomViewHolder(false)).setDelayTime(3000).setBannerStyle(BannerConfig.NOT_INDICATOR).setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int position) { + if (datas.size() > 0) { + if (position >= mTopBannerList.size()) { + position = 0; + } + if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { + MobclickAgent.onEvent(mContext, "live_room_contact", "联系方式按钮"); + Dialog loading = DialogUitl.loadingDialog(mContext); + loading.show(); + LiveNetManager.get(mContext).getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onError(String error) { - loading.dismiss(); - } - }); - - } else { - MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮"); - BannerBean bean = mTopBannerList.get(position); - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - String type = ""; - StringBuffer htmlUrl = new StringBuffer(); - htmlUrl.append(bean.getLink()) - .append(bean.getLink().contains("?") ? "&uid=" : "?uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&liveUid=") - .append(mLiveUid) - .append("&t=") - .append(System.currentTimeMillis()) - .append("&g=Appapi&m=Wish&a=index") - .append("&isZh=") - .append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + if (data.getIsGet() == 1) { + new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()).setOnDismissListener(dialog -> { + checkNewLetter(); + loading.dismiss(); + }).showDialog(); + return; } + new LiveContactDetailsSendGiftDialog(mContext).setGiftId(data.getGiftId()).setAnchorName(mAnchorName).setStream(mStream).setLiveUid(mLiveUid).setOnDismissListener(dialog1 -> { + checkNewLetter(); + }).showDialog(); + loading.dismiss(); } - } + @Override + public void onError(String error) { + loading.dismiss(); + } + }); + + } else { + MobclickAgent.onEvent(mContext, "live_room_wish", "心愿单按钮"); + BannerBean bean = mTopBannerList.get(position); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(bean.getLink()).append(bean.getLink().contains("?") ? "&uid=" : "?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&anchorUid=").append(mLiveUid).append("&liveUid=").append(mLiveUid).append("&t=").append(System.currentTimeMillis()).append("&g=Appapi&m=Wish&a=index").append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false, 1); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } } - }) - .start(); + } + + } + }).start(); updateCallMe(); } private void updateCallMe() { - LiveNetManager.get(mContext) - .getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(LiveAnchorCallMeModel data) { - System.out.println(">>>>> 获取联系方式:" + data); - if (data.getIsShow() == 1) { - if (!isHinde) { - topBanner1.setVisibility(View.VISIBLE); - } - BannerBean call = new BannerBean(); - call.setData(data); - call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR); - mTopBannerList.add(0, call); - topBanner1.update(mTopBannerList); - topBanner2.update(mTopBannerList); - } - - + LiveNetManager.get(mContext).getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + System.out.println(">>>>> 获取联系方式:" + data); + if (data.getIsShow() == 1) { + if (!isHinde) { + topBanner1.setVisibility(View.VISIBLE); } + BannerBean call = new BannerBean(); + call.setData(data); + call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR); + mTopBannerList.add(0, call); + topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); + } - @Override - public void onError(String error) { - System.out.println("!>>>>> 获取联系方式:" + error); - } - }); + + } + + @Override + public void onError(String error) { + System.out.println("!>>>>> 获取联系方式:" + error); + } + }); } @@ -6066,19 +5943,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void updateFansMessageRed() { if (mContext instanceof LiveAudienceActivity) { - LiveNetManager.get(mContext) - .getCheckFansLevelUpgrade(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(FansCheckRed data) { - ((LiveAudienceActivity) mContext).setShowCrownRed(data.getStatus() == 1); + LiveNetManager.get(mContext).getCheckFansLevelUpgrade(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(FansCheckRed data) { + ((LiveAudienceActivity) mContext).setShowCrownRed(data.getStatus() == 1); - } + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); + } + }); } } } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 79725eff5..7f4226ec7 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -394,7 +394,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); } - mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw); + mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(), isSw); mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); @@ -957,7 +957,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveAudienceViewHolder != null) { mLiveAudienceViewHolder.removeCallbacks(); } - if(mLivePlayViewHolder!=null){ + if (mLivePlayViewHolder != null) { mLivePlayViewHolder.stopPlay2(); mLiveRoomViewHolder.cancelAllAnim(); } @@ -987,7 +987,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRyLinkMicPkPresenter.release(); mLiveRyLinkMicPkPresenter = null; } - if(mLiveSwLinkMicPkPresenter!=null){ + if (mLiveSwLinkMicPkPresenter != null) { mLiveSwLinkMicPkPresenter.clearData(); mLiveSwLinkMicPkPresenter.release(); mLiveSwLinkMicPkPresenter = null; @@ -1031,7 +1031,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe EventBus.getDefault() .post(new LiveFloatEvent() .setmLiveBean(mLiveBean) - .setmLiveSDK(isSw?2:mLiveSDK) + .setmLiveSDK(isSw ? 2 : mLiveSDK) .setmLiveType(mLiveType) .setmLiveTypeVal(mLiveTypeVal)); } @@ -1170,8 +1170,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() { @Override public void onConfirmClick(Dialog dialog) { - if(isSw){ - if(mLivePlayViewHolder!=null){ + if (isSw) { + if (mLivePlayViewHolder != null) { mLivePlayViewHolder.endLiveMic(); HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") .params("roomid", liveID) @@ -1189,7 +1189,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); } } - }else{ + } else { if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) { return; } @@ -1277,15 +1277,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (!mFirstConnectSocket) { mFirstConnectSocket = true; if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { - if(isSw){ + if (isSw) { SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); - }else{ + } else { SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); } } - if(isSw){ + if (isSw) { SocketSwChatUtil.getFakeFans(mLiveBean.getUid()); - }else{ + } else { SocketRyChatUtil.getFakeFans(mLiveBean.getUid()); } } @@ -1735,8 +1735,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onLinkDRMicPkQuit(String uid) { - L.eSw("onLinkDRMicPkQuit:"+uid); + L.eSw("onLinkDRMicPkQuit:" + uid); mLivePlayViewHolder.removeLiveUid(uid); + int removeUid = 0; + for (int k = 0; k < pkScores.size(); k++) { + JSONObject score = pkScores.getJSONObject(k); + String userID = score.getString("id"); + if (userID.equals(uid)) { + removeUid = k; + } + } + pkScores.remove(removeUid); + upDataPkScore(pkScores, -1); } /** @@ -2166,9 +2176,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮"); mLighted = true; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; - if(isSw){ + if (isSw) { SocketSwChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType); - }else{ + } else { SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType); } } @@ -2228,9 +2238,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * 更新主播映票数 */ public void sendUpdateVotesMessage() { - if(isSw){ + if (isSw) { SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); - }else{ + } else { SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); } } @@ -2354,6 +2364,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mViewPager.setCanScroll(enableScroll); } + public JSONArray pkScores; + /** * 用户端多人Pk * @@ -2362,6 +2374,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe */ public void upDataPkScore(JSONArray pkScores, int time) { L.eSw("upDataPkScore" + time); + this.pkScores = pkScores; if (mLiveRoomViewHolder != null) { String liveId = mLiveBean.getUid(); JSONObject liveModel = null; @@ -2376,8 +2389,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } pkScores.remove(index); pkScores.add(0, liveModel); - mLiveRoomViewHolder.upDataPkScore(pkScores, time); - mLivePlayViewHolder.claerDrPkInfoView(); + if (time == -1) { + mLiveRoomViewHolder.upDataPkScore(pkScores); + } else { + mLiveRoomViewHolder.upDataPkScore(pkScores, time); + mLivePlayViewHolder.claerDrPkInfoView(); + } setPkStatus(true); } //通知心愿单位置换地方 diff --git a/live/src/main/res/layout/view_live_play_sw.xml b/live/src/main/res/layout/view_live_play_sw.xml index cdcd20495..64cb1c25f 100644 --- a/live/src/main/res/layout/view_live_play_sw.xml +++ b/live/src/main/res/layout/view_live_play_sw.xml @@ -49,7 +49,7 @@