diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java index d1bec042e..322fff5fe 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -69,6 +69,14 @@ public class LiveChatBean { return WordUtil.isNewZh() ? giftName : giftname_en; } + public String getGiftname_en() { + return giftname_en; + } + + public void setGiftname_en(String giftname_en) { + this.giftname_en = giftname_en; + } + public LiveChatBean setGiftName(String giftName) { this.giftName = giftName; return this; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 73a762e69..8be0ec603 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -310,14 +310,14 @@ public class SocketRyClient { String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); if(jsonObject.get("is_complete")!=null){ String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 - String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 - String gift_name = WordUtil.isNewZh()?jsonObject.get("gift_name").getAsString():jsonObject.get("gift_name_en").getAsString(); //礼物名称 - String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 - String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 if(is_complete.equals("1")){ + String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 + String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 + String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 LiveChatBean chatBean = new LiveChatBean(); chatBean.setUserNiceName(user_name); - chatBean.setGiftName(gift_name); + chatBean.setGiftName(jsonObject.get("gift_name").getAsString()); + chatBean.setGiftname_en(jsonObject.get("gift_name_en").getAsString()); chatBean.setHot_num(gift_count); chatBean.setContent(prank_content); chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); @@ -328,7 +328,7 @@ public class SocketRyClient { systemChatMessage2(content); } } - if("完成1次!".equals(jsonObject.get("msg").getAsString())){ + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)&&"完成1次!".equals(jsonObject.get("msg").getAsString())){ Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); toast.show(); } 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 9e1815217..69c23c515 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -298,14 +298,14 @@ public class SocketSwClient { String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); if(jsonObject.get("is_complete")!=null){ String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 - String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 - String gift_name = WordUtil.isNewZh()?jsonObject.get("gift_name").getAsString():jsonObject.get("gift_name_en").getAsString(); //礼物名称 - String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 - String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 if(is_complete.equals("1")){ + String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 + String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 + String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 LiveChatBean chatBean = new LiveChatBean(); chatBean.setUserNiceName(user_name); - chatBean.setGiftName(gift_name); + chatBean.setGiftName(jsonObject.get("gift_name").getAsString()); + chatBean.setGiftname_en(jsonObject.get("gift_name_en").getAsString()); chatBean.setHot_num(gift_count); chatBean.setContent(prank_content); chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); @@ -316,7 +316,7 @@ public class SocketSwClient { systemChatMessage2(content); } } - if("完成1次!".equals(jsonObject.get("msg").getAsString())){ + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)&&"完成1次!".equals(jsonObject.get("msg").getAsString())){ Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); toast.show(); } 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 ce0cc5831..4c0ba4014 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1718,16 +1718,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if(prankAnisShow){ prankAdapter.showAnView(completedList,prankAnisShow); prank_group_turntable.setText(R.string.prank_progress); - prank_group_title.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); if (!completedList.isEmpty()){ limitItem(1,Math.min(completedList.size(), 4)); }else { recycler_prank.setVisibility(View.GONE); } + prank_group_title.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + prank_group_turntable.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + }else{ prankAdapter.showAnView(prankAndComboList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); - prank_group_title.setText(WordUtil.isNewZh()?"整蠱進度":"To do"); recycler_prank.setVisibility(View.VISIBLE); limitItem(1,Math.min(prankAndComboList.size(), 4)); } @@ -1777,7 +1779,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //初始化整蛊列表进度 public void initPrankProgress(){ - prankAnisShow = false; //默认展示整蛊列表 // LogUtils.e("yqw=====>主播id:"+mLiveUid); //获取整蛊列表 LiveNetManager.get(mContext).getPrankProgressList(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { @@ -1790,7 +1791,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis prankAndComboList.addAll(data.getPrank_list()); completedList.clear(); completedList.addAll(data.getCompleted_list()); - setPrankList(data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status()); + setPrankList(true,data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status()); } @Override @@ -1840,7 +1841,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis completedList.clear(); completedList.addAll(completeds); - setPrankList(Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status"))); + setPrankList(false,Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status"))); } }catch (Exception e){ LogUtils.e("yqw=====>转换错误:"+e.getMessage()); @@ -1878,29 +1879,55 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } //设置整蛊礼物数据 - private void setPrankList(int status,int mPrankType,int prankTurntableStatus){ + private void setPrankList(boolean isShow,int status,int mPrankType,int prankTurntableStatus){ this.mPrankType =mPrankType; // LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE)); if (prankTurntableStatus == 1 && lt_trickery.getVisibility() == View.GONE){ - if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ - return; + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); } - prank_group_turntable_icon.setVisibility(View.VISIBLE); }else { prank_group_turntable_icon.setVisibility(View.GONE); } // LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status); if (status == 1){ - prank_group.setVisibility(View.VISIBLE); - initPrankAdapter(); - if (mPrankType == 1){//礼物 + if(isShow){ + prank_group.setVisibility(View.VISIBLE); + } + //主播可能打开整蛊功能,但是不设置整蛊礼物,这里会是空列表 + if (!prankAndComboList.isEmpty()){ + initPrankAdapter(); + recycler_prank.setAdapter(prankAdapter); + if (mPrankType == 1){//礼物 // sortByCompletionRate(prankAndComboList); - prankAdapter.setViewType(PrankAdapter.TYPE_GIFT); - prankAdapter.setList(prankAndComboList); - }else { //连击 + prankAdapter.setViewType(PrankAdapter.TYPE_GIFT); + //prankAdapter.setList(prankAndComboList); + if(prankAnisShow){ + prankAdapter.showAnView(completedList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + prank_group_turntable.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + if (!completedList.isEmpty()){ + limitItem(1,Math.min(completedList.size(), 4)); + }else { + recycler_prank.setVisibility(View.GONE); + } + + }else{ + prankAdapter.showAnView(prankAndComboList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + limitItem(1,Math.min(prankAndComboList.size(), 4)); + } + }else { //连击 // sortBySendNum(prankAndComboList); - prankAdapter.setViewType(PrankAdapter.TYPE_COMBO); - prankAdapter.setList(prankAndComboList); + prank_group_title.setText(R.string.combo_vote); + prankAdapter.setViewType(PrankAdapter.TYPE_COMBO); + prankAdapter.setList(prankAndComboList); + limitItem(2,Math.min(prankAndComboList.size(), 4)); + } + }else { + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.GONE); } if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ @@ -1908,7 +1935,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onClick(View view) { if(mPrankType!=1){ -return; + return; } prank_group.setVisibility(View.GONE); prank_small_icon.setVisibility(View.VISIBLE); @@ -1922,6 +1949,7 @@ return; prank_group_turntable.setVisibility(View.GONE); } prank_group_bottom_icon.setVisibility(View.GONE); + switchGifDrawable(!completedList.isEmpty()); }else{ switchGifDrawable(false); if(mPrankType==1){ @@ -1932,14 +1960,6 @@ return; prank_group_turntable.setVisibility(View.GONE); prank_group_top_icon.setVisibility(View.GONE); } - recycler_prank.setAdapter(prankAdapter); - //主播可能打开整蛊功能,但是不设置整蛊礼物,这里会是空列表 - if (!prankAndComboList.isEmpty()){ - limitItem(mPrankType,Math.min(prankAndComboList.size(), 4)); - }else { - prank_group.setVisibility(View.GONE); - prank_small_icon.setVisibility(View.GONE); - } }else { prank_group.setVisibility(View.GONE); prank_small_icon.setVisibility(View.GONE); diff --git a/live/src/main/res/layout/dialog_live_select_gift_wrap.xml b/live/src/main/res/layout/dialog_live_select_gift_wrap.xml index 30b0ada96..81c9be96d 100644 --- a/live/src/main/res/layout/dialog_live_select_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_select_gift_wrap.xml @@ -27,7 +27,7 @@ android:layout_marginTop="16dp" android:layout_marginEnd="16dp" android:layout_marginBottom="8dp" - android:background="@drawable/bg_live_prank_gift_add" + android:background="@drawable/bg_live_prank_turntable_save" android:gravity="center" android:text="@string/live_gift_dialog_select_add" android:textColor="#FFF"