新增H5网页跳转直播间并打开礼物栏选中礼物功能
This commit is contained in:
parent
e89e82483b
commit
a5b0ee757c
@ -54,7 +54,8 @@ public class LiveBean implements Parcelable {
|
||||
private String recommendCardIconSizeThree = "";
|
||||
@SerializedName("red_packet_status")
|
||||
private int redPacketStatus;
|
||||
|
||||
@SerializedName("giftId")
|
||||
private String giftId;
|
||||
private Map<String,String> params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框
|
||||
|
||||
public String getRecommendCardIconSizeTwo() {
|
||||
@ -66,6 +67,14 @@ public class LiveBean implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public void setGiftId(String giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
public String getRecommendCardIcon() {
|
||||
if (TextUtils.isEmpty(recommendCardIconSizeThree)) {
|
||||
if (!TextUtils.isEmpty(recommendCardIconSizeTwo)) {
|
||||
@ -444,6 +453,7 @@ public class LiveBean implements Parcelable {
|
||||
this.recommendCardtype = in.readString();
|
||||
this.recommendCardIconSizeTwo = in.readString();
|
||||
this.recommendCardIconSizeThree = in.readString();
|
||||
this.giftId = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -488,6 +498,7 @@ public class LiveBean implements Parcelable {
|
||||
dest.writeString(this.recommendCardtype);
|
||||
dest.writeString(this.recommendCardIconSizeTwo);
|
||||
dest.writeString(this.recommendCardIconSizeThree);
|
||||
dest.writeString(this.giftId);
|
||||
}
|
||||
|
||||
public static final Creator<LiveBean> CREATOR = new Creator<LiveBean>() {
|
||||
|
@ -17,13 +17,16 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.ReportCommunityBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.VideoBean;
|
||||
import com.yunbao.common.bean.VideoListBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
@ -253,6 +256,49 @@ public class JavascriptInterfaceUtils {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转直播并打开礼物栏选中礼物
|
||||
* @param liveId 直播间id
|
||||
* @param giftId 礼物id
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void androidMethodLookToLiveGift(String liveId,String giftId){
|
||||
LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
liveBean.setGiftId(giftId);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
|
||||
if (!"".endsWith(Constants.mStream)) {
|
||||
|
||||
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||
return;
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
|
||||
} else {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
}
|
||||
androidGoBack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void androidMethodLookToLive(String liveId) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
@ -550,28 +596,32 @@ public class JavascriptInterfaceUtils {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("clickLogOffAccount"));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidFansGroupBuy(String id){
|
||||
public void androidFansGroupBuy(String id) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidFansGroupBuy").setUserId(id));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidFansGroupPack(){
|
||||
public void androidFansGroupPack() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidFansGroupPack"));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidFansGroupInfo(){
|
||||
public void androidFansGroupInfo() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidFansGroupInfo"));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl,int isAnchor ) {
|
||||
RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0,isAnchor==1);
|
||||
public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl, int isAnchor) {
|
||||
RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0, isAnchor == 1);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void wearOrCancelFanMedal(){
|
||||
public void wearOrCancelFanMedal() {
|
||||
HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo")
|
||||
.params("uid", IMLoginManager.get(mContext).getUserInfo().getId())
|
||||
.params("token", IMLoginManager.get(mContext).getUserInfo().getToken())
|
||||
@ -587,8 +637,9 @@ public class JavascriptInterfaceUtils {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidCancelAnchorAttention(){
|
||||
public void androidCancelAnchorAttention() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidCancelAnchorAttention"));
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
import com.yunbao.share.ui.SharePopDialog;
|
||||
|
||||
@ -393,9 +394,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mLiveTypeVal = 0;
|
||||
}
|
||||
mLiveType = liveType;
|
||||
String giftId=mLiveBean.getGiftId();
|
||||
String json = GsonUtils.toJson(data);
|
||||
mLiveBean = GsonUtils.fromJson(json, LiveBean.class);
|
||||
mLiveBean.setUserNiceName(data.getUserNicename());
|
||||
mLiveBean.setGiftId(giftId);
|
||||
mLiveUid = mLiveBean.getUid();
|
||||
mStream = mLiveBean.getStream();
|
||||
mAncherName = mLiveBean.getUserNiceName();
|
||||
@ -729,6 +732,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
if (e.isLiveEnd()) {
|
||||
manager.removeLiveEnd();
|
||||
}
|
||||
if (LiveRoomViewHolder.mHandler != null) {
|
||||
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
if (liveBean != null) {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
|
||||
|
@ -57,4 +57,9 @@ public class GiftTitleAdapter extends RecyclerView.Adapter {
|
||||
index = -1;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setTitleIndex(int i) {
|
||||
index=i;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
Bus.getOff(this);
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void initView() {
|
||||
gitBackground = mRootView.findViewById(R.id.git_background2);
|
||||
@ -204,19 +205,19 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
levelingLayout.setVisibility(View.VISIBLE);
|
||||
updateOverlayVisibility();
|
||||
blindBox.setOnTouchListener((v, event) -> {
|
||||
if(event.getAction()==MotionEvent.ACTION_UP) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
v.performClick();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
namingLayout.setOnTouchListener((v, event) -> {
|
||||
if(event.getAction()==MotionEvent.ACTION_UP) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
v.performClick();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
operateImage.setOnTouchListener((v, event) -> {
|
||||
if(event.getAction()==MotionEvent.ACTION_UP) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
v.performClick();
|
||||
}
|
||||
return true;
|
||||
@ -274,7 +275,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
||||
StringBuffer htmlUrl = new StringBuffer();
|
||||
htmlUrl.append(CommonAppConfig.HOST)
|
||||
.append("/h5/info/index.html?uid=")
|
||||
.append("/h5/blindBoxInfo/index.html?uid=")
|
||||
.append(userInfo.getId())
|
||||
.append("&token=")
|
||||
.append(userInfo.getToken())
|
||||
@ -419,6 +420,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
liveGiftList.getJSONObject(i).getString("name"),
|
||||
mStream, mLiveUid, mWishGiftId));
|
||||
transaction.commit();
|
||||
giftTitleAdapter.setTitleIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -811,7 +814,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
if (!TextUtils.isEmpty(liveGiftModel.getOperateImage())) {
|
||||
operateImage.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage);
|
||||
}else {
|
||||
} else {
|
||||
operateImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,7 @@ import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
|
||||
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGameDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGiftPopup;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
@ -3941,6 +3942,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
voteManager.setCreateVoteModel(voteModel);
|
||||
}
|
||||
|
||||
public void openGiftDialog(String giftId) {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
|
||||
.setmLiveUid(mLiveUid)
|
||||
.setmStream(mStream)
|
||||
.setPk(false)
|
||||
.setLiveGuardInfo(null)
|
||||
.setmWishGiftId(giftId)
|
||||
.setUname("0"));//setUname==by
|
||||
}
|
||||
|
||||
|
||||
private static class LiveRoomHandler extends Handler {
|
||||
|
||||
|
@ -64,6 +64,7 @@ import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RandomUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.formatBigNum;
|
||||
import com.yunbao.common.views.weight.LiveFloatView;
|
||||
@ -284,7 +285,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
Log.e("ImgLoader1", data.getAvatar());
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.clearData();
|
||||
@ -447,6 +447,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists());
|
||||
//设置靓号
|
||||
mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum());
|
||||
if(!StringUtil.isEmpty(mLiveBean.getGiftId())){
|
||||
mLiveRoomViewHolder.openGiftDialog(mLiveBean.getGiftId());
|
||||
}
|
||||
List<BannerBean> bannerBeans = new ArrayList<>();
|
||||
//心愿单
|
||||
// if (data.getWishList().getWishList().size() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user