新增h5功能

This commit is contained in:
18401019693 2022-09-21 14:13:59 +08:00
parent d77721a0bc
commit 83aed0bedb
6 changed files with 74 additions and 34 deletions

View File

@ -1,6 +1,7 @@
package com.yunbao.live.bean; package com.yunbao.live.bean;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.MsgModel;
/** /**
@ -40,6 +41,41 @@ public class LiveChatBean {
private String prankIcon; private String prankIcon;
private String hot_card; private String hot_card;
private MsgModel msgModel = new MsgModel();//自定义消息体 private MsgModel msgModel = new MsgModel();//自定义消息体
@SerializedName("noble_id")
private String nobleId = "";
@SerializedName("noble_icon")
private String nobleIcon = "";
@SerializedName("bubbleSrc")
private String bubbleSrc = "";
public String getNobleId() {
return nobleId;
}
public LiveChatBean setNobleId(String nobleId) {
this.nobleId = nobleId;
return this;
}
public String getNobleIcon() {
return nobleIcon;
}
public LiveChatBean setNobleIcon(String nobleIcon) {
this.nobleIcon = nobleIcon;
return this;
}
public String getBubbleSrc() {
return bubbleSrc;
}
public LiveChatBean setBubbleSrc(String bubbleSrc) {
this.bubbleSrc = bubbleSrc;
return this;
}
public MsgModel getMsgModel() { public MsgModel getMsgModel() {
return msgModel; return msgModel;
@ -179,7 +215,7 @@ public class LiveChatBean {
@JSONField(name = "liangname") @JSONField(name = "liangname")
public void setLiangName(String liangName) { public void setLiangName(String liangName) {
if(!"0".equals(liangName)){ if (!"0".equals(liangName)) {
this.liangName = liangName; this.liangName = liangName;
} }
} }
@ -221,7 +257,6 @@ public class LiveChatBean {
} }
@JSONField(name = "medal_name") @JSONField(name = "medal_name")
public String getMedalNmae() { public String getMedalNmae() {
return medalNmae; return medalNmae;

View File

@ -659,6 +659,9 @@ public class SocketRyClient {
chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN); chatBean.setManager(obj.getIntValue("usertype") == Constants.SOCKET_USER_TYPE_ADMIN);
chatBean.setContent(WordUtil.getString(R.string.live_enter_room)); chatBean.setContent(WordUtil.getString(R.string.live_enter_room));
chatBean.setGuardType(obj.getIntValue("guard_type")); chatBean.setGuardType(obj.getIntValue("guard_type"));
chatBean.setNobleId(obj.getString("noble_id"));//貴族ID
chatBean.setNobleIcon(obj.getString("noble_icon"));//貴族圖標
chatBean.setBubbleSrc(obj.getString("bubbleSrc"));//氣泡
//增加粉丝徽章信息 //增加粉丝徽章信息
chatBean.setMedalNmae(obj.getString("medal_name")); chatBean.setMedalNmae(obj.getString("medal_name"));
FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level"));

View File

@ -1043,8 +1043,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setmChatLevel(mChatLevel) .setmChatLevel(mChatLevel)
.setmDanMuLevel(mDanMuLevel) .setmDanMuLevel(mDanMuLevel)
.setLiveBg(liveBg))); .setLiveBg(liveBg)));
EventBus.getDefault().post("close_login");
EventBus.getDefault().post("oneUesrOver");
//进入直播间 //进入直播间
AdjustEvent adjustEvent1 = new AdjustEvent("hiepcu"); AdjustEvent adjustEvent1 = new AdjustEvent("hiepcu");

View File

@ -274,36 +274,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}; };
// private void getToken() {
// // 创建一个新线程
// new Thread() {
// @Override
// public void run() {
// try {
// // 从agconnect-service.json文件中读取appId
// String appId = "106936673";
//
// // 输入token标识"HCM"
// String tokenScope = "HCM";
// String token = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, tokenScope);
// Log.i("hw", "get token: " + token);
//
// // 判断token是否为空
// if(!TextUtils.isEmpty(token)) {
// sendRegTokenToServer(token);
// }
// } catch (Exception e) {
// Log.e("hw","get token failed, " + e);
// }
// }
// }.start();
// }
// private void sendRegTokenToServer(String token) {
// PushManager.getInstance()
// .onReceiveToken(MainActivity.this, PushType.HUAWEI, token);
// Log.i("hw", "sending token to server. token:" + token);
// }
@Override @Override
protected void main() { protected void main() {

View File

@ -160,6 +160,39 @@ public class RewardActivity extends AbsActivity {
//js调用原生 //js调用原生
public class JsInteration { public class JsInteration {
@JavascriptInterface
public void androidClickToNewH5PageView(String url) {
url = CommonAppConfig.HOST + url;
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
Log.i("tag", url);
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
intent.putExtra("url", url);
intent.putExtra("isFull", false);
mContext.startActivity(intent);
}
/**
* 新跳转
*
* @param url 跳转的url
* @param title 有标题的展示标题
*/
@JavascriptInterface
public void androidClickToNewH5PageView(String url, String title) {
url = CommonAppConfig.HOST + url;
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
Log.i("tag", url);
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
intent.putExtra("url", url);
intent.putExtra("isFull", false);
intent.putExtra("title", title);
mContext.startActivity(intent);
}
@JavascriptInterface @JavascriptInterface
public void androidZBan(String svg) { public void androidZBan(String svg) {
String[] arr = svg.split("/"); String[] arr = svg.split("/");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 313 KiB