add[修復BUG,新增整蛊IM消息类型]

This commit is contained in:
Martin 2024-06-14 15:40:51 +08:00
parent 002f0ad654
commit e874c2ee16
11 changed files with 123 additions and 14 deletions

View File

@ -525,6 +525,7 @@ public interface PDLiveApi {
@Query("anchor_id") String anchor_id, @Query("anchor_id") String anchor_id,
@Query("status") String status, @Query("status") String status,
@Query("prank_json") String prank_json, @Query("prank_json") String prank_json,
@Query("is_cleared") String is_cleared,
@Query("prank_type") String prank_type @Query("prank_type") String prank_type
); );

View File

@ -922,9 +922,9 @@ public class LiveNetManager {
/** /**
* 设置礼物整蛊 * 设置礼物整蛊
*/ */
public void setPrankGift(String mLiveUid, String status, String prank_json,String prank_type, HttpCallback<PrankHttpTurntableBean> callback) { public void setPrankGift(String mLiveUid, String status, String prank_json,String prank_type,String is_cleared, HttpCallback<PrankHttpTurntableBean> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.setPrank(mLiveUid, status, prank_json, prank_type) .setPrank(mLiveUid, status, prank_json, prank_type,is_cleared)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.subscribe(responseModel -> { .subscribe(responseModel -> {

View File

@ -7,6 +7,7 @@ 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_ANCHOR_PRANK;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT;
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;
@ -219,6 +220,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
LinearLayoutCompat attentionLayout; LinearLayoutCompat attentionLayout;
ClipPathCircleImage clipImage2; ClipPathCircleImage clipImage2;
LinearLayoutCompat prank_open_live_layout;
TextView prank_open_live_msg;
TextView prank_to_setting;
public Vh(View itemView) { public Vh(View itemView) {
super(itemView); super(itemView);
mBg = (LinearLayout) itemView.findViewById(R.id.bg); mBg = (LinearLayout) itemView.findViewById(R.id.bg);
@ -245,6 +250,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention); btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention);
textLeave = (ImageView) itemView.findViewById(R.id.text_leave); textLeave = (ImageView) itemView.findViewById(R.id.text_leave);
prank_open_live_layout = itemView.findViewById(R.id.prank_open_live_layout);
prank_open_live_msg = itemView.findViewById(R.id.prank_open_live_msg);
prank_to_setting = itemView.findViewById(R.id.prank_to_setting);
} }
void setData(final LiveChatBean bean, int position) { void setData(final LiveChatBean bean, int position) {
@ -255,9 +264,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG) .setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG)
.setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName()))); .setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName())));
} }
Log.e("eqwewqeweq", bean.toString()); Log.e("eqwewqeweq", bean.toString());
return true; return true;
} }
@ -522,10 +529,26 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
} }
} else if(bean.getType() == TYPE_TO_ANCHOR_PRANK){ } else if(bean.getType() == TYPE_TO_ANCHOR_PRANK){
String str1 = "<font color='#ff1a1a'>娛樂整蠱</font>"; /*String str1 = "<font color='#ff1a1a'>娛樂整蠱</font>";
String str2 = "<font color='#0d0d0d'>全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!</font>"; String str2 = "<font color='#0d0d0d'>全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!</font>";
String str3 = "<font color='#3384ff'>>>立即前往>></font>"; String str3 = "<font color='#3384ff'>>>立即前往>></font>";
mTextView.setText(Html.fromHtml(str1+str2+str3)); mTextView.setText(Html.fromHtml(str1+str2+str3));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);*/
LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params3.setMargins(0, 8, DpUtil.dp2px(80), 8);
params3.gravity = Gravity.CENTER_VERTICAL;
mBg.setLayoutParams(params3);
prank_open_live_layout.setVisibility(View.VISIBLE);
}else if(bean.getType() == TYPE_TO_ANCHOR_PRANK_GIFT){
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("<font color='#ffffff'>"+(WordUtil.isNewZh()?"整蠱來了!":"Tricky is coming")+"</font>");
stringBuffer.append(" <font color='#ECB238'>"+bean.getUserNiceName()+"</font>");
stringBuffer.append("<font color='#ffffff'>"+(WordUtil.isNewZh()?"送出":"send")+""+bean.getGiftName()+"*"+bean.getHot_num()+"】</font>");
stringBuffer.append("<font color='#ffffff'>"+(WordUtil.isNewZh()?"主播需完成":",and the anchor needs to complete ")+"</font>");
stringBuffer.append( "<font color='#ECB238'>【"+bean.getContent()+"】</font>");
mTextView.setText(Html.fromHtml(stringBuffer.toString()));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else{ }else{
if (bean.getBubble() != null && !bean.getBubble().equals("")) { if (bean.getBubble() != null && !bean.getBubble().equals("")) {

View File

@ -30,8 +30,8 @@ public class LiveChatBean {
public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知
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;//整蠱-開播提示語 public static final int TYPE_TO_ANCHOR_PRANK = 501;//整蠱-開播提示語
public static final int TYPE_TO_ANCHOR_PRANK_GIFT = 502;//整蠱-禮物
private String id; private String id;
private String userNiceName; private String userNiceName;

View File

@ -1,5 +1,7 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import static com.yunbao.live.adapter.LivePrankRecyclerAdapter.TYPE_TURNTABLE;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.graphics.Color; import android.graphics.Color;
@ -239,6 +241,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
public void onViewClicks() { public void onViewClicks() {
if ((int) mPrankBtn.getTag() == 0) { if ((int) mPrankBtn.getTag() == 0) {
clearPrankConfig(); clearPrankConfig();
setPrankConfig();
} else { } else {
giftSwitch1Btn.setTag("false"); giftSwitch1Btn.setTag("false");
giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off);
@ -248,6 +251,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mPrankBtn.setVisibility(View.VISIBLE); mPrankBtn.setVisibility(View.VISIBLE);
mBtnAddGift.setVisibility(View.VISIBLE); mBtnAddGift.setVisibility(View.VISIBLE);
mGiftNotDate.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE);
setGiftBean(recyclerAdapter.getList());
} }
ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!"); ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!");
} }
@ -282,7 +286,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mPrankRecyclerView.setVisibility(View.VISIBLE); mPrankRecyclerView.setVisibility(View.VISIBLE);
mBtnAddGift.setVisibility(View.GONE); mBtnAddGift.setVisibility(View.GONE);
mGiftNotDate.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE); recyclerAdapter.setViewType(TYPE_TURNTABLE);
mPrankBtn.setVisibility(View.VISIBLE); mPrankBtn.setVisibility(View.VISIBLE);
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
@ -411,12 +415,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
private void setGiftBean(List<PrankGiftBean> prankGiftBeans) { private void setGiftBean(List<PrankGiftBean> prankGiftBeans) {
JSONArray prankJson = getJsonObjects(prankGiftBeans); JSONArray prankJson = getJsonObjects(prankGiftBeans);
LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(), new HttpCallback<PrankHttpTurntableBean>() { LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(),"", new HttpCallback<PrankHttpTurntableBean>() {
@Override @Override
public void onSuccess(PrankHttpTurntableBean data) { public void onSuccess(PrankHttpTurntableBean data) {
initGiftData(); initGiftData();
if (WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("設置成功"); ToastUtil.show("保存成功!");
} else { } else {
ToastUtil.show("successful"); ToastUtil.show("successful");
} }
@ -499,6 +503,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
list.add(buildBean(4, bean.getTurntable4())); list.add(buildBean(4, bean.getTurntable4()));
list.add(buildBean(5, bean.getTurntable5())); list.add(buildBean(5, bean.getTurntable5()));
list.add(buildBean(6, bean.getTurntable6())); list.add(buildBean(6, bean.getTurntable6()));
recyclerAdapter.setViewType(TYPE_TURNTABLE);
recyclerAdapter.setList(list); recyclerAdapter.setList(list);
recyclerAdapter.notifyDataSetChanged(); recyclerAdapter.notifyDataSetChanged();
if (bean.getStatus() == 1) { if (bean.getStatus() == 1) {

View File

@ -4,6 +4,7 @@ import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.blankj.utilcode.util.ViewUtils.runOnUiThread; import static com.blankj.utilcode.util.ViewUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER; import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
import android.app.Activity; import android.app.Activity;
@ -14,6 +15,7 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@ -58,6 +60,7 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ToastUtils;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
@ -305,8 +308,29 @@ public class SocketRyClient {
// LogUtils.e("yqw=====>整蛊礼物列表:"+ctString); // LogUtils.e("yqw=====>整蛊礼物列表:"+ctString);
JsonObject jsonObject = jsonElement.getAsJsonObject(); JsonObject jsonObject = jsonElement.getAsJsonObject();
String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString();
if (!TextUtils.isEmpty(content)){
systemChatMessage2(content); 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")){
LiveChatBean chatBean = new LiveChatBean();
chatBean.setUserNiceName(user_name);
chatBean.setGiftName(gift_name);
chatBean.setHot_num(gift_count);
chatBean.setContent(prank_content);
chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT);
mListener.onChat(chatBean, 1);
}else{
if (!TextUtils.isEmpty(content)){
systemChatMessage2(content);
}
if("完成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();
}
} }
mListener.onUpdatePrankProgress(ctString); mListener.onUpdatePrankProgress(ctString);
} }

View File

@ -1850,7 +1850,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
sortBySendNum(prankAndComboList); sortBySendNum(prankAndComboList);
prankAdapter.setViewType(PrankAdapter.TYPE_COMBO); prankAdapter.setViewType(PrankAdapter.TYPE_COMBO);
prankAdapter.setList(prankAndComboList); prankAdapter.setList(prankAndComboList);
// prank_group_title.setText(R.string.combo_vote);
} }
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
@ -1864,9 +1863,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
prank_group_top_icon.setVisibility(View.VISIBLE); prank_group_top_icon.setVisibility(View.VISIBLE);
if(mPrankType==1){ if(mPrankType==1){
prank_group_turntable.setVisibility(View.VISIBLE); prank_group_turntable.setVisibility(View.VISIBLE);
}else{
prank_group_turntable.setVisibility(View.GONE);
} }
prank_group_bottom_icon.setVisibility(View.GONE); prank_group_bottom_icon.setVisibility(View.GONE);
}else{ }else{
if(mPrankType==1){
prank_group_title.setText(R.string.prank_progress);
}else{
prank_group_title.setText(R.string.combo_vote);
}
prank_group_turntable.setVisibility(View.GONE); prank_group_turntable.setVisibility(View.GONE);
prank_group_top_icon.setVisibility(View.GONE); prank_group_top_icon.setVisibility(View.GONE);
} }
@ -2496,7 +2502,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void setLiveUid(String liveUid) { public void setLiveUid(String liveUid) {
mLiveUid = liveUid; mLiveUid = liveUid;
LiveHttpUtil.getAnchorActiveImgStatus(mLiveUid, new HttpCallback() { /*LiveHttpUtil.getAnchorActiveImgStatus(mLiveUid, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && imgEvent != null) { if (code == 0 && imgEvent != null) {
@ -2519,7 +2525,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
} }
}); });*/
} }
//获取心愿单列表 //获取心愿单列表

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="18.5dp" />
<solid android:color="#FFB813" />
</shape>

View File

@ -232,6 +232,49 @@
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/prank_open_live_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:background="@drawable/chat_message_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/prank_open_live_msg"
android:layout_width="match_parent"
android:paddingStart="10dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:clickable="false"
android:enabled="false"
android:gravity="start"
android:text="@string/prank_open_live_msg"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/prank_to_setting"
android:layout_width="54dp"
android:layout_height="26dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="11dp"
android:text="立即前往"
android:gravity="center"
android:textColor="@color/white"
android:background="@drawable/prank_msg_goto"
android:textSize="10dp" />
</androidx.appcompat.widget.LinearLayoutCompat>
<LinearLayout <LinearLayout
android:id="@+id/xyd_complete" android:id="@+id/xyd_complete"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -144,4 +144,5 @@
<string name="alive_prank_gift_dialog_number_title">Quantity</string> <string name="alive_prank_gift_dialog_number_title">Quantity</string>
<string name="live_prank_gift_dialog_number_btn">+ Set other quantity (up to 9999)</string> <string name="live_prank_gift_dialog_number_btn">+ Set other quantity (up to 9999)</string>
<string name="alive_prank_gift_dialog_explain">Trick instructions</string> <string name="alive_prank_gift_dialog_explain">Trick instructions</string>
<string name="prank_open_live_msg">Entertainment Tricky has been newly upgraded. Go and set up Tricky content to add more fun to the live broadcast room!</string>
</resources> </resources>

View File

@ -141,4 +141,5 @@
<string name="combo_vote">連擊投票</string> <string name="combo_vote">連擊投票</string>
<string name="combo_vote_more">連擊最多優先</string> <string name="combo_vote_more">連擊最多優先</string>
<string name="alive_prank_gift_dialog_explain">整蠱說明</string> <string name="alive_prank_gift_dialog_explain">整蠱說明</string>
<string name="prank_open_live_msg">娛樂整蠱全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!</string>
</resources> </resources>