Merge remote-tracking branch 'origin/dev_6.7.0' into dev_6.7.0

This commit is contained in:
余前卫 2024-06-14 14:40:51 +08:00
commit 002f0ad654
13 changed files with 216 additions and 99 deletions

View File

@ -882,6 +882,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
//加载整蛊 //加载整蛊
if(mLiveRoomViewHolder!=null){ if(mLiveRoomViewHolder!=null){
mLiveRoomViewHolder.initPrankProgress(); mLiveRoomViewHolder.initPrankProgress();
mLiveRoomViewHolder.sendMsgPrank();
} }
} }

View File

@ -62,7 +62,6 @@ public class ComboAdapter extends RecyclerView.Adapter<ComboAdapter.MyViewHolder
combo_item_combo = itemView.findViewById(R.id.combo_item_combo); combo_item_combo = itemView.findViewById(R.id.combo_item_combo);
combo_item_icon = itemView.findViewById(R.id.combo_item_icon); combo_item_icon = itemView.findViewById(R.id.combo_item_icon);
} }
} }
private OnItemClickListener onItemClickListener; private OnItemClickListener onItemClickListener;

View File

@ -6,6 +6,7 @@ import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR; import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG; import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS; import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE; import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@ -520,7 +521,13 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
if (!StringUtil.isEmpty(bean.getBubble())) { if (!StringUtil.isEmpty(bean.getBubble())) {
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
} }
} else { } else if(bean.getType() == TYPE_TO_ANCHOR_PRANK){
String str1 = "<font color='#ff1a1a'>娛樂整蠱</font>";
String str2 = "<font color='#0d0d0d'>全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!</font>";
String str3 = "<font color='#3384ff'>>>立即前往>></font>";
mTextView.setText(Html.fromHtml(str1+str2+str3));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else{
if (bean.getBubble() != null && !bean.getBubble().equals("")) { if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡 //加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);

View File

@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.PrankProgressBean; import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.MarqueeTextView; import com.yunbao.common.views.weight.MarqueeTextView;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -22,16 +23,23 @@ import com.yunbao.live.views.LiveRoomViewHolder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder> { public class PrankAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<PrankProgressBean.PrankList> mList = new ArrayList<>(); private List<PrankProgressBean.PrankList> mList = new ArrayList<>();
private Context mContext; private Context mContext;
private boolean isAn; private boolean isAn;
public static final int TYPE_GIFT = 1;
public static final int TYPE_COMBO = 2;
private int viewType1 = TYPE_GIFT;
public PrankAdapter(Context context){ public PrankAdapter(Context context){
mContext = context; mContext = context;
} }
public void setViewType(int viewType) {
this.viewType1 = viewType;
}
public void setList(List<PrankProgressBean.PrankList> list){ public void setList(List<PrankProgressBean.PrankList> list){
mList.clear(); mList.clear();
@ -48,38 +56,51 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
@NonNull @NonNull
@Override @Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_prank_progress, parent, false)); if (viewType1 ==TYPE_GIFT){
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_prank_progress, parent, false));
}else{
return new MyComboViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_combo_vote, parent, false));
}
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
PrankProgressBean.PrankList data = mList.get(position); PrankProgressBean.PrankList data = mList.get(position);
holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id())); if(viewHolder instanceof MyViewHolder){
holder.prank_item_subscript.setText(String.valueOf(data.getCompleted_num())); MyViewHolder holder = (MyViewHolder) viewHolder;
holder.prank_item_prank_name.setText(data.getPrank_content()); holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id()));
holder.prank_item_gift_name.setText(WordUtil.isNewZh() ? data.getGift_name() : data.getGift_name_en()); holder.prank_item_subscript.setText(String.valueOf(data.getCompleted_num()));
holder.prank_item_now_progress.setText(String.valueOf(data.getSend_num())); holder.prank_item_prank_name.setText(data.getPrank_content());
holder.prank_item_total_progress.setText("/"+ data.getGift_num()); holder.prank_item_gift_name.setText(WordUtil.isNewZh() ? data.getGift_name() : data.getGift_name_en());
ImgLoader.display(mContext,data.getGift_icon(),holder.prank_item_icon); holder.prank_item_now_progress.setText(String.valueOf(data.getSend_num()));
holder.prank_item_progress.setMax(data.getGift_num()); holder.prank_item_total_progress.setText("/"+ data.getGift_num());
holder.prank_item_progress.setProgress(data.getSend_num()); ImgLoader.display(mContext,data.getGift_icon(),holder.prank_item_icon);
holder.an_prank_name.setText(WordUtil.isNewZh() ? data.getGift_name() : data.getGift_name_en()); holder.prank_item_progress.setMax(data.getGift_num());
holder.an_prank_remove.setOnClickListener(new View.OnClickListener() { holder.prank_item_progress.setProgress(data.getSend_num());
@Override holder.an_prank_name.setText(data.getPrank_content());
public void onClick(View view) { holder.an_prank_remove.setOnClickListener(new View.OnClickListener() {
onItemClickListener.onItemDel(data.getGift_id()); @Override
public void onClick(View view) {
onItemClickListener.onItemDel(data.getGift_id());
}
});
if(isAn){
holder.anLayout.setVisibility(View.VISIBLE);
holder.progressLayout.setVisibility(View.GONE);
holder.nameLayout.setVisibility(View.GONE);
}else{
holder.anLayout.setVisibility(View.GONE);
holder.progressLayout.setVisibility(View.VISIBLE);
holder.nameLayout.setVisibility(View.VISIBLE);
} }
});
if(isAn){
holder.anLayout.setVisibility(View.VISIBLE);
holder.progressLayout.setVisibility(View.GONE);
holder.nameLayout.setVisibility(View.GONE);
}else{ }else{
holder.anLayout.setVisibility(View.GONE); MyComboViewHolder holder = (MyComboViewHolder) viewHolder;
holder.progressLayout.setVisibility(View.VISIBLE); holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id()));
holder.nameLayout.setVisibility(View.VISIBLE); holder.combo_item_prank_name.setText(data.getPrank_content());
ImgLoader.display(mContext,data.getGift_icon(),holder.combo_item_icon);
holder.combo_item_combo.setText(String.valueOf(data.getSend_num()));
} }
} }
@ -116,6 +137,20 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
} }
} }
class MyComboViewHolder extends RecyclerView.ViewHolder{
private TextView combo_item_prank_name,combo_item_combo;
private ImageView combo_item_icon;
public MyComboViewHolder(@NonNull View itemView){
super(itemView);
combo_item_prank_name = itemView.findViewById(R.id.combo_item_prank_name);
combo_item_combo = itemView.findViewById(R.id.combo_item_combo);
combo_item_icon = itemView.findViewById(R.id.combo_item_icon);
}
}
private OnItemClickListener onItemClickListener; private OnItemClickListener onItemClickListener;
public interface OnItemClickListener { public interface OnItemClickListener {

View File

@ -31,6 +31,7 @@ public class LiveChatBean {
public static final int BLIND_BOX = 409;//盲盒礼物消息 public static final int BLIND_BOX = 409;//盲盒礼物消息
public static final int TYPE_TO_USER_MSG = 500;//指定信息 public static final int TYPE_TO_USER_MSG = 500;//指定信息
public static final int TYPE_TO_ANCHOR_PRANK = 501;//整蠱-開播提示語
private String id; private String id;
private String userNiceName; private String userNiceName;

View File

@ -85,7 +85,7 @@ public class LivePrankAddGiftNumberDialog extends AbsDialogPopupWindow {
ViewClicksAntiShake.clicksAntiShake(mBtnNumber, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(mBtnNumber, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() { DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER,4, new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
try { try {

View File

@ -249,6 +249,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mBtnAddGift.setVisibility(View.VISIBLE); mBtnAddGift.setVisibility(View.VISIBLE);
mGiftNotDate.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE);
} }
ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!");
} }
}); });
mPrankBtn.setTag(0); mPrankBtn.setTag(0);

View File

@ -1,5 +1,6 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import static com.yunbao.live.activity.LiveRyAnchorActivity.mLiveAnchorViewHolder;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import android.app.Activity; import android.app.Activity;
@ -183,6 +184,7 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LivePrankDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
@ -415,17 +417,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private RecyclerView recycler_prank; private RecyclerView recycler_prank;
private ImageView prank_group_bottom_icon,prank_group_turntable_icon,prank_small_icon; private ImageView prank_group_bottom_icon,prank_group_turntable_icon,prank_small_icon;
private PrankAdapter prankAdapter; private PrankAdapter prankAdapter;
private ComboAdapter comboAdapter;
private List<PrankProgressBean.PrankList> prankAndComboList = new ArrayList<>(); private List<PrankProgressBean.PrankList> prankAndComboList = new ArrayList<>();
private JsonElement completedList = new JsonArray(); private List<PrankProgressBean.PrankList> completedList = new ArrayList<>();
private int isPrank;
private boolean prankAnisShow; private boolean prankAnisShow;
private LinearLayout prank_top_layout;
private ImageView prank_group_top_icon;
public LiveRoomViewHolder setGuardType(int guardType) { public LiveRoomViewHolder setGuardType(int guardType) {
this.guardType = guardType; this.guardType = guardType;
return this; return this;
} }
@Override
protected int getLayoutId() {
return R.layout.view_live_room;
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) { public void onUpdata(String str) {
if ("svga_new_user_gif".equals(str)) { if ("svga_new_user_gif".equals(str)) {
@ -736,11 +743,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
sudNameHandler.postDelayed(sudNameRunnable, 10000); sudNameHandler.postDelayed(sudNameRunnable, 10000);
} }
@Override
protected int getLayoutId() {
return R.layout.view_live_room;
}
private View sudGameMin; private View sudGameMin;
public void onShowHideEvent() { public void onShowHideEvent() {
@ -1367,20 +1369,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveChatAdapter.removetItem(bean); mLiveChatAdapter.removetItem(bean);
((LiveActivity) mContext).sendChatMessage("Hi~", null, null); ((LiveActivity) mContext).sendChatMessage("Hi~", null, null);
} else if (bean.getType() == -5) { } else if (bean.getType() == -5) {
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Turntable&a=tricky"; String url = CommonAppConfig.HOST + "/h5/activity/Turntable/index.html";
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + CommonAppConfig.getInstance().getToken() +
"&active_id=6";
Log.i("tag", url); Log.i("tag", url);
Bundle bundle1 = new Bundle(); Bundle bundle1 = new Bundle();
bundle1.putString("url", url); bundle1.putString("url", url);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle1); liveHDDialogFragment.setArguments(bundle1);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); if(mContext instanceof LiveAudienceActivity){
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}else if(mContext instanceof LiveRyAnchorActivity){
liveHDDialogFragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
} else if (bean.getType() == RECOMMEND_CARD_NOTIFY) { } else if (bean.getType() == RECOMMEND_CARD_NOTIFY) {
gotoLive(bean.getMsgModel().getAnchorId()); gotoLive(bean.getMsgModel().getAnchorId());
} else if (bean.getType() == bean.STAR_CHALLENGE_UPGRADE_NOTIFY) { } else if (bean.getType() == bean.STAR_CHALLENGE_UPGRADE_NOTIFY) {
gotoLive(bean.getMsgModel().getLiveUid()); gotoLive(bean.getMsgModel().getLiveUid());
} else { } else if(bean.getType()==bean.TYPE_TO_ANCHOR_PRANK){
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() {
@Override
public void OpenAndCloseListener() {
initPrankProgress();
}
});
fragment.setmLiveUid(mLiveUid);
fragment.show(((LiveRyAnchorActivity)mContext).getSupportFragmentManager(), "LivePrankDialogFragment");
mLiveAnchorViewHolder.closeMenuRed();
}else{
showUserDialog(bean.getId()); showUserDialog(bean.getId());
} }
} }
@ -1651,6 +1669,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// dragonImmediateParticipation.setVisibility(View.GONE); // dragonImmediateParticipation.setVisibility(View.GONE);
//整蛊转盘优化更新 //整蛊转盘优化更新
prank_top_layout= (LinearLayout) findViewById(R.id.prank_top_layout);
prank_group_top_icon= (ImageView) findViewById(R.id.prank_group_top_icon);
prank_group = findViewById(R.id.prank_group);//浮窗 prank_group = findViewById(R.id.prank_group);//浮窗
prank_group_title = (TextView) findViewById(R.id.prank_group_title);//浮窗标题 prank_group_title = (TextView) findViewById(R.id.prank_group_title);//浮窗标题
recycler_prank = (RecyclerView) findViewById(R.id.recycler_prank);//列表 recycler_prank = (RecyclerView) findViewById(R.id.recycler_prank);//列表
@ -1661,18 +1681,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//点击文字转盘整蛊(跳转转盘整蛊) //点击文字转盘整蛊(跳转转盘整蛊)
prank_group_turntable.setOnClickListener(v->{ prank_group_turntable.setOnClickListener(v->{
prankAnisShow = !prankAnisShow; prankAnisShow = !prankAnisShow;
List<PrankProgressBean.PrankList> tempList = new ArrayList<>(); if(isPrank==1){
for (int i = 0; i <prankAndComboList.size(); i++) { prankAdapter.setViewType(PrankAdapter.TYPE_GIFT);
if(prankAndComboList.get(i).getCompleted_num()!=0){ }else{
tempList.add(prankAndComboList.get(i)); prankAdapter.setViewType(PrankAdapter.TYPE_COMBO);
}
} }
if(prankAnisShow){ if(prankAnisShow){
prankAdapter.showAnView(tempList,prankAnisShow); prankAdapter.showAnView(completedList,prankAnisShow);
prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"progress");
}else{ }else{
prankAdapter.showAnView(prankAndComboList,prankAnisShow); prankAdapter.showAnView(prankAndComboList,prankAnisShow);
prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do");
} }
L.e("prankAnisShow:"+prankAnisShow);
}); });
//点击收起 //点击收起
@ -1695,52 +1715,38 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
recycler_prank.setLayoutManager(new LinearLayoutManager(mContext)); recycler_prank.setLayoutManager(new LinearLayoutManager(mContext));
prankAdapter = new PrankAdapter(mContext); initPrankAdapter();
comboAdapter = new ComboAdapter(mContext);
//整蛊礼物点击
prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int giftId) {
openGiftDialog(String.valueOf(giftId));
}
@Override
public void onItemDel(int giftId) {
LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}
@Override
public void onError(String error) {
}
});
L.e("onItemDel:"+giftId);
}
});
//连击投票礼物点击
comboAdapter.addOnItemClickListener((view, giftId) -> {
// LogUtils.e("yqw=====>点击投票礼物:"+giftId);
openGiftDialog(String.valueOf(giftId));
});
} }
public void sendMsgPrank(){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
LiveChatBean bean = new LiveChatBean();
bean.setContent("开播整蛊通知");
bean.setType(LiveChatBean.TYPE_TO_ANCHOR_PRANK);
mLiveChatAdapter.insertItem(bean);
}
}, 1000);
}
//初始化整蛊列表进度 //初始化整蛊列表进度
public void initPrankProgress(){ public void initPrankProgress(){
prankAnisShow = false; //默认展示整蛊列表
// LogUtils.e("yqw=====>主播id:"+mLiveUid); // LogUtils.e("yqw=====>主播id:"+mLiveUid);
//获取整蛊列表 //获取整蛊列表
LiveNetManager.get(mContext).getPrankProgressList(mLiveUid, new com.yunbao.common.http.base.HttpCallback<PrankProgressBean>() { LiveNetManager.get(mContext).getPrankProgressList(mLiveUid, new com.yunbao.common.http.base.HttpCallback<PrankProgressBean>() {
@Override @Override
public void onSuccess(PrankProgressBean data) { public void onSuccess(PrankProgressBean data) {
// LogUtils.e("yqw=====>整蛊列表:"+data); // LogUtils.e("yqw=====>整蛊列表:"+data);
isPrank = data.getPrank_type();
prankAndComboList.clear(); prankAndComboList.clear();
prankAndComboList.addAll(data.getPrank_list()); prankAndComboList.addAll(data.getPrank_list());
completedList.clear();
completedList.addAll(data.getCompleted_list());
setPrankList(data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status()); setPrankList(data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status());
} }
@ -1781,6 +1787,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// LogUtils.e("yqw=====>整蛊礼物数据2:"+prankList.toString()); // LogUtils.e("yqw=====>整蛊礼物数据2:"+prankList.toString());
prankAndComboList.clear(); prankAndComboList.clear();
prankAndComboList.addAll(prankList); prankAndComboList.addAll(prankList);
String completedString = ctString.getString("completed_list");
List<PrankProgressBean.PrankList> completeds = GsonUtils.fromJson(completedString,new TypeToken<List<PrankProgressBean.PrankList>>() {}.getType());
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(Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status")));
} }
}catch (Exception e){ }catch (Exception e){
@ -1788,7 +1800,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
private void initPrankAdapter() {
prankAdapter = new PrankAdapter(mContext);
//整蛊礼物点击
prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int giftId) {
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
return;
}
openGiftDialog(String.valueOf(giftId));
}
@Override
public void onItemDel(int giftId) {
LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}
@Override
public void onError(String error) {
}
});
L.e("onItemDel:"+giftId);
}
});
}
//设置整蛊礼物数据 //设置整蛊礼物数据
private void setPrankList(int status,int mPrankType,int prankTurntableStatus){ private void setPrankList(int status,int mPrankType,int prankTurntableStatus){
// LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE)); // LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE));
@ -1800,21 +1841,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status); // LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status);
if (status == 1){ if (status == 1){
prank_group.setVisibility(View.VISIBLE); prank_group.setVisibility(View.VISIBLE);
if (mPrankType == 1){ initPrankAdapter();
if (mPrankType == 1){//礼物
sortByCompletionRate(prankAndComboList); sortByCompletionRate(prankAndComboList);
prankAdapter.setViewType(PrankAdapter.TYPE_GIFT);
prankAdapter.setList(prankAndComboList); prankAdapter.setList(prankAndComboList);
recycler_prank.setAdapter(prankAdapter); }else { //连击
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
prank_group_turntable.setVisibility(View.VISIBLE);
}else{
prank_group_turntable.setVisibility(View.GONE);
}
}else {
sortBySendNum(prankAndComboList); sortBySendNum(prankAndComboList);
comboAdapter.setList(prankAndComboList); prankAdapter.setViewType(PrankAdapter.TYPE_COMBO);
recycler_prank.setAdapter(comboAdapter); prankAdapter.setList(prankAndComboList);
prank_group_title.setText(R.string.combo_vote); // prank_group_title.setText(R.string.combo_vote);
} }
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
prank_top_layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.VISIBLE);
}
});
prank_group_top_icon.setVisibility(View.VISIBLE);
if(mPrankType==1){
prank_group_turntable.setVisibility(View.VISIBLE);
}
prank_group_bottom_icon.setVisibility(View.GONE);
}else{
prank_group_turntable.setVisibility(View.GONE);
prank_group_top_icon.setVisibility(View.GONE);
}
recycler_prank.setAdapter(prankAdapter);
//主播可能打开整蛊功能但是不设置整蛊礼物这里会是空列表 //主播可能打开整蛊功能但是不设置整蛊礼物这里会是空列表
if (!prankAndComboList.isEmpty()){ if (!prankAndComboList.isEmpty()){
limitItem(mPrankType,Math.min(prankAndComboList.size(), 4)); limitItem(mPrankType,Math.min(prankAndComboList.size(), 4));
@ -1828,6 +1884,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
//根据完成度排序 //根据完成度排序
private void sortByCompletionRate(List<PrankProgressBean.PrankList> items) { private void sortByCompletionRate(List<PrankProgressBean.PrankList> items) {
Collections.sort(items, (item1, item2) -> Double.compare(item2.getCompletionRate(), item1.getCompletionRate())); Collections.sort(items, (item1, item2) -> Double.compare(item2.getCompletionRate(), item1.getCompletionRate()));

View File

@ -157,7 +157,8 @@
android:layout_height="43dp" android:layout_height="43dp"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/bg_prank_coin" android:background="@drawable/bg_prank_coin"
android:ems="10" android:ems="20"
android:maxLength="20"
android:gravity="start|center" android:gravity="start|center"
android:hint="@string/live_prank_gift_add_gift_contnet_select" android:hint="@string/live_prank_gift_add_gift_contnet_select"
android:paddingStart="12dp" android:paddingStart="12dp"

View File

@ -55,7 +55,6 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/gift_add_btn"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title"> app:layout_constraintTop_toBottomOf="@+id/title">

View File

@ -109,8 +109,11 @@
<LinearLayout <LinearLayout
android:id="@+id/anLayout" android:id="@+id/anLayout"
android:layout_margin="5dp"
android:visibility="gone" android:visibility="gone"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:gravity="center_vertical" android:gravity="center_vertical"
tools:visibility="visible" tools:visibility="visible"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -118,7 +121,8 @@
<com.yunbao.common.views.weight.MarqueeTextView <com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/an_prank_name" android:id="@+id/an_prank_name"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="marquee" android:ellipsize="marquee"
android:singleLine="true" android:singleLine="true"
@ -133,6 +137,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:text="@string/prank_complete" android:text="@string/prank_complete"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_gravity="end"
android:gravity="center" android:gravity="center"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:textColor="#372B2B" android:textColor="#372B2B"

View File

@ -16,6 +16,7 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/prank_top_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
@ -33,6 +34,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:ignore="SmallSp" /> tools:ignore="SmallSp" />
<ImageView
android:id="@+id/prank_group_top_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginStart="3dp"
tools:visibility="visible"
android:scaleType="centerInside"
android:src="@mipmap/bottom_icon" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView

View File

@ -118,8 +118,8 @@
<string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string> <string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string>
<string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string> <string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string>
<string name="prank_progress">Tricky progress</string> <string name="prank_progress">Progress</string>
<string name="turntable_prank">Turntable</string> <string name="turntable_prank">To do</string>
<string name="details">Details></string> <string name="details">Details></string>
<string name="combo_vote">Combo</string> <string name="combo_vote">Combo</string>
<string name="combo_vote_more">Most first</string> <string name="combo_vote_more">Most first</string>