塔罗牌公屏消息

This commit is contained in:
huangjian
2021-01-21 15:32:40 +08:00
parent efde73af0d
commit 3d80ccd003
11 changed files with 114 additions and 32 deletions

View File

@@ -98,6 +98,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomNoticeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.TarotMsgBean;
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
@@ -793,6 +795,9 @@ public class MessageView extends FrameLayout {
if (second == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_MSG) {
setRedPackageMsg(chatRoomMessage, tvContent);
}
} else if (first == CustomAttachment.CUSTOM_MESS_TAROT) {
clearBackground(tvContent);
setTarotMsg(chatRoomMessage, tvContent);
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
@@ -805,6 +810,20 @@ public class MessageView extends FrameLayout {
}
}
private void setTarotMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
TarotAttachment attachment = (TarotAttachment) chatRoomMessage.getAttachment();
if (attachment.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS) {
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
SpannableBuilder text = new SpannableBuilder(tvContent)
.append("恭喜 ", new ForegroundColorSpan(textColor))
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
.append(" 在塔罗占卜中运气爆发,收获", new ForegroundColorSpan(textColor))
.append(tarotMsgBean.getDrawGoldNum() + "金币", new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
}
}
/**
* 提示已经加入的话题的通知
*
@@ -2595,6 +2614,10 @@ public class MessageView extends FrameLayout {
EventBus.getDefault().post(new FollowRoomEvent());
PraiseModel.get().setFollowRoomSuccessRoomTip(JavaUtil.str2long(chatRoomMessage.getFromAccount()));
});
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MESS_TAROT) {
if (attachment instanceof TarotAttachment) {
account = ((TarotAttachment) attachment).getTarotMsgBean().getUid() + "";
}
}
}
if (TextUtils.isEmpty(account)) return;

View File

@@ -37,7 +37,6 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.erban.base.BaseActivity;
import com.yizhuan.erban.ui.im.RouterHandler;
import com.yizhuan.erban.ui.webview.event.CloseWebViewEvent;
import com.yizhuan.erban.ui.webview.event.ShowNavEvent;
import com.yizhuan.erban.ui.webview.event.TaroPayResultEvent;
import com.yizhuan.erban.ui.widget.ShareDialog;
@@ -158,7 +157,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
initView();
initData();
setListener();
ShowWebView(url);
showWebView(url);
RxBus.get().toFlowable(ShareH5Event.class)
.compose(bindUntilEvent(ActivityEvent.DESTROY))
.subscribeOn(Schedulers.newThread())
@@ -390,7 +389,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
}
}
public void ShowWebView(String url) {
public void showWebView(String url) {
Logger.d("ShowWebView--------" + url);
if (!TextUtils.isEmpty(url)) {
Map<String, String> map = new HashMap<>();
@@ -442,7 +441,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRecieveNeedRefreshWebView(WebViewRefreshEvent event) {
if (!StringUtil.isEmpty(url)) {
ShowWebView(url);
showWebView(url);
}
}
@@ -451,13 +450,6 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
webView.evaluateJavascript("renderByStatus(" + event.getStatus() + ")", null);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void closeWebViewEvent(CloseWebViewEvent event) {
if (event != null) {
finish();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void showNavEvent(ShowNavEvent event) {
if (event != null) {
@@ -507,6 +499,8 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
@Subscribe(threadMode = ThreadMode.MAIN)
public void onTaroPayResultEvent(TaroPayResultEvent event) {
finish();
if (webView != null) {
webView.evaluateJavascript("taroPayResultCallback(" + event.getResult() + ")", null);
}
}
}

View File

@@ -26,8 +26,6 @@ import com.yizhuan.erban.public_chat_hall.activity.PublicChatHallHomeActivity;
import com.yizhuan.erban.ui.im.RouterHandler;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.pay.ChargeActivity;
import com.yizhuan.erban.ui.webview.event.CloseDialogWebViewEvent;
import com.yizhuan.erban.ui.webview.event.CloseWebViewEvent;
import com.yizhuan.erban.ui.webview.event.H5NotifyClientEvent;
import com.yizhuan.erban.ui.webview.event.ShowNavEvent;
import com.yizhuan.erban.ui.webview.event.TaroPayResultEvent;
@@ -114,7 +112,7 @@ public class JSInterface {
@JavascriptInterface
public void openChargePage() {
if (context != null) {
ChargeActivity.start(context,true);
ChargeActivity.start(context, true);
}
}
@@ -272,7 +270,7 @@ public class JSInterface {
*/
@JavascriptInterface
public void closeWebView() {
EventBus.getDefault().post(new CloseWebViewEvent());
if (mActivity != null) mActivity.finish();
}
/**
@@ -454,7 +452,7 @@ public class JSInterface {
} else if (audit == RPSDK.AUDIT.AUDIT_FAIL) {
// 认证不通过
result = 1;
} else if (audit == RPSDK.AUDIT.AUDIT_NOT) {
} else if (audit == RPSDK.AUDIT.AUDIT_NOT) {
// 未认证,用户取消
result = -1;
} else if (audit == RPSDK.AUDIT.AUDIT_EXCEPTION) {
@@ -502,7 +500,7 @@ public class JSInterface {
@JavascriptInterface
public void closeDialogWebView() {
if (mActivity!=null) mActivity.finish();
if (mActivity instanceof DialogWebViewActivity) mActivity.finish();
}
/**
@@ -516,6 +514,7 @@ public class JSInterface {
@JavascriptInterface
public void checkResultFinish(int result) {
EventBus.getDefault().post(new TaroPayResultEvent().setResult(result));
if (mActivity instanceof DialogWebViewActivity) mActivity.finish();
}
}

View File

@@ -1,8 +0,0 @@
package com.yizhuan.erban.ui.webview.event;
import lombok.Data;
@Data
public class CloseWebViewEvent {
}

View File

@@ -292,7 +292,7 @@ public class XChatConstants {
/**
* Referer (DEBUG)
*/
public static final String KEY_REFERER_DEBUG = "http://120.79.211.243/";
public static final String KEY_REFERER_DEBUG = "http://api.uat.zhongjialx.com/";
/**
* Referer (RELEASE)

View File

@@ -726,7 +726,8 @@ public final class IMNetEaseManager {
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FOLLOW_ROOM
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT
|| customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_KICK_MIC
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_KICK_MIC
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MESS_TAROT
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MONSTER_HUNTING
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_MINI_WORLD) {
addMessages(msg);

View File

@@ -534,6 +534,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
attachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT, CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS);
break;
default:
break;
}

View File

@@ -366,8 +366,9 @@ public class CustomAttachment implements MsgAttachment {
//推送消息
public static final int CUSTOM_MSG_PUSH_NOTIFIFICATION = 70;
public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM = 701;// 推送进入房间
// public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_CHAT_ROOM = 702;// 推送进入聊天页
// public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_DYNAMIC_MSG = 703;// 推送进入动态消息
public static final int CUSTOM_MESS_TAROT = 71; //塔罗牌充值消息
public static final int CUSTOM_MESS_TAROT_SUCCESS = 711; //塔罗牌充值中奖消息
public CustomAttachment() {

View File

@@ -0,0 +1,37 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
public class TarotAttachment extends CustomAttachment {
private TarotMsgBean tarotMsgBean;
public TarotAttachment(int first, int second) {
super(first, second);
}
public TarotMsgBean getTarotMsgBean() {
return tarotMsgBean;
}
public void setTarotMsgBean(TarotMsgBean tarotMsgBean) {
this.tarotMsgBean = tarotMsgBean;
}
@Override
protected void parseData(JSONObject data) {
tarotMsgBean = new Gson().fromJson(data.toJSONString(), TarotMsgBean.class);
}
@Override
protected JSONObject packData() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("chargeProdId", tarotMsgBean.getChargeProdId());
jsonObject.put("chargeProdName", tarotMsgBean.getChargeProdName());
jsonObject.put("drawGoldNum", tarotMsgBean.getDrawGoldNum());
jsonObject.put("nick", tarotMsgBean.getNick());
jsonObject.put("roomUid", tarotMsgBean.getRoomUid());
jsonObject.put("uid", tarotMsgBean.getUid());
return jsonObject;
}
}

View File

@@ -0,0 +1,31 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import lombok.Data;
@Data
public class TarotMsgBean {
/**
* 中奖用户uid
**/
private long uid;
/**
* 中奖用户昵称
**/
private String nick;
/**
* 中奖的房间uid
**/
private long roomUid;
/**
* 中奖的产品ID
**/
private String chargeProdId;
/**
* 中奖的产品名称
**/
private String chargeProdName;
/**
* 中奖的金币数量
**/
private long drawGoldNum;
}

View File

@@ -20,5 +20,5 @@ with_jenkins=false
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
ndk_abi_filters=arm
version_name=2.1.1
version_code=211
version_name=5.1.1
version_code=511