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 3d222bc1b..67f969d71 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1045,22 +1045,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } - public void showStart(StarChallengeStatusModel data) { + public synchronized void showStart(StarChallengeStatusModel data) { boolean upData = false; - if (mBannerList2 == null || mBannerList2.size() == 0) { - mBannerList2 = new ArrayList<>(); + if (mBannerList2 != null && mBannerList2.size() == 0) { + Log.e("PortraitLiveManager", "直接添加星级任务"); BannerBean bannerBean = new BannerBean(); bannerBean.setStart(true); bannerBean.setModel(data); mBannerList2.add(bannerBean); } else { + Log.e("PortraitLiveManager", "遍历添加星级任务"); for (BannerBean bean : mBannerList2) { if (bean.isStart()) { + Log.e("PortraitLiveManager", "更新添加星级任务"); bean.setModel(data); upData = true; } } if (!upData) { + Log.e("PortraitLiveManager", "更新添加星级任务2"); BannerBean bannerBean = new BannerBean(); bannerBean.setStart(true); bannerBean.setModel(data); @@ -1082,127 +1085,128 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis msgLayout.setVisibility(View.GONE); } - private void showBanner2() { - if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) { - Log.e("PortraitLiveManager", "加载不了"); - return; - } - btn_event2.setVisibility(View.VISIBLE); - - if (mBannerList2.size() == 1) { - - mBanner2.setAutoPlay(false) - .setPages(mBannerList2, new CustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList2 != null) { - if (p >= 0 && p < mBannerList2.size()) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - BannerBean bean = mBannerList2.get(p); - String type = ""; - StringBuffer htmlUrl = new StringBuffer(); - //判断是否是星级活动 - if (bean.isStart()) { - type = bean.getModel().getType(); - htmlUrl.append(CommonAppConfig.HOST) - .append("/") - .append(bean.getModel().getActivityUrl()) - .append("&nickname=") - .append(userInfo.getUserNicename()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&uid=") - .append(userInfo.getId()) - .append("&k=") - .append(System.currentTimeMillis()); - } 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()); - } - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + private synchronized void showBanner2() { + Log.e("PortraitLiveManager", "加载不了 mBannerList2 == null " + (mBannerList2 == null)); + Log.e("PortraitLiveManager", "加载不了 mBannerList2.size() == 0 " + (mBannerList2.size() == 0)); + Log.e("PortraitLiveManager", "加载不了 mBanner2 == null " + (mBanner2 == null)); + if (mBannerList2 != null && mBanner2 != null) { + btn_event2.setVisibility(View.VISIBLE); + if (mBannerList2.size() == 1) { + Log.e("PortraitLiveManager", "加载一个的"); + mBanner2.setAutoPlay(false) + .setPages(mBannerList2, new CustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList2 != null) { + if (p >= 0 && p < mBannerList2.size()) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + BannerBean bean = mBannerList2.get(p); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + //判断是否是星级活动 + if (bean.isStart()) { + type = bean.getModel().getType(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(bean.getModel().getActivityUrl()) + .append("&nickname=") + .append(userInfo.getUserNicename()) + .append("&token=") + .append(userInfo.getToken()) + .append("&anchorUid=") + .append(mLiveUid) + .append("&uid=") + .append(userInfo.getId()) + .append("&k=") + .append(System.currentTimeMillis()); + } 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()); + } + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } } } } - } - }) - .start(); - } else { - mBanner2.setAutoPlay(true) - .setPages(mBannerList2, new CustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList2 != null) { - if (p >= 0 && p < mBannerList2.size()) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - BannerBean bean = mBannerList2.get(p); - String type = ""; - StringBuffer htmlUrl = new StringBuffer(); - //判断是否是星级活动 - if (bean.isStart()) { - type = bean.getModel().getType(); - htmlUrl.append(CommonAppConfig.HOST) - .append("/") - .append(bean.getModel().getActivityUrl()) - .append("&nickname=") - .append(userInfo.getUserNicename()) - .append("&token=") - .append(userInfo.getToken()) - .append("&anchorUid=") - .append(mLiveUid) - .append("&uid=") - .append(userInfo.getId()) - .append("&k=") - .append(System.currentTimeMillis()); - } 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()); - } - if (TextUtils.equals(type, "1")) { - ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); - } else { - Bundle bundle = new Bundle(); - bundle.putString("url", htmlUrl.toString()); - LiveHDDialogFragment fragment = new LiveHDDialogFragment(); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }) + .start(); + } else { + mBanner2.setAutoPlay(true) + .setPages(mBannerList2, new CustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList2 != null) { + if (p >= 0 && p < mBannerList2.size()) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + BannerBean bean = mBannerList2.get(p); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + //判断是否是星级活动 + if (bean.isStart()) { + type = bean.getModel().getType(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(bean.getModel().getActivityUrl()) + .append("&nickname=") + .append(userInfo.getUserNicename()) + .append("&token=") + .append(userInfo.getToken()) + .append("&anchorUid=") + .append(mLiveUid) + .append("&uid=") + .append(userInfo.getId()) + .append("&k=") + .append(System.currentTimeMillis()); + } 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()); + } + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); + } 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(); + } } + } /** @@ -1231,14 +1235,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mBannerList2.add(bannerBean); } } - if (mBannerList2.isEmpty()) { - btn_event2.setVisibility(View.GONE); - mBanner2.setVisibility(View.GONE); - } - showBanner2(); - } else { - if (btn_event2 != null) { - btn_event2.setVisibility(View.GONE); + if (mBannerList2.size() > 0) { + if (mBanner2.isStart()) { + mBanner2.update(mBannerList2); + } else { + showBanner2(); + } } } } 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 dcf1bc40a..b8d495720 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -303,7 +303,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); CommonHttpUtil.cancel(CommonHttpConsts.GET_BALANCE); CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST); - CommonHttpUtil.cancel("StarChallengeStatus"); IMLoginManager.get(mContext).setisNewUserOne(false); //子线程执行退出操作 exitLiveRoom();