修复:

直播间关注问题,直播间关闭问题
This commit is contained in:
18401019693 2022-08-25 14:27:12 +08:00
parent c4bed12003
commit 965f6aaa75
11 changed files with 394 additions and 317 deletions

View File

@ -143,7 +143,7 @@ public interface PDLiveApi {
* @param liveuid
* @return
*/
@GET("/api/public/?service=User.setAttents")
@GET("/api/public/?service=User.slketAttents")
Observable<ResponseModel<List<SetAttentsModel>>> setAttents(
@Query("touid") String liveuid
);

View File

@ -1217,6 +1217,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveRoomViewHolder.setAttention(e.getIsAttention());
}
}
if (this instanceof LiveAudienceActivity) {
((LiveAudienceActivity) this).onFollowEvent(e);
}
}

View File

@ -171,7 +171,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
mLiveReadyViewHolder.addToParent();
mLiveReadyViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
mLiveLinkMicPresenter.setLiveUid(mLiveUid);
// mLiveLinkMicPresenter.setLiveUid(mLiveUid);
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
mLiveLinkMicPkPresenter = new LiveLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
}

View File

@ -30,6 +30,7 @@ import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog;
import com.yunbao.common.dialog.LiveChargeDialogFragment;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
@ -875,4 +876,7 @@ public class LiveAudienceActivity extends LiveActivity {
});
}
public void onFollowEvent(FollowEvent e) {
manager.onFollowEvent(e);
}
}

View File

@ -190,7 +190,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveReadyViewHolder.addToParent();
mLiveReadyViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
mLiveLinkMicPresenter.setLiveUid(mLiveUid);
// mLiveLinkMicPresenter.setLiveUid(mLiveUid);
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
mLivePushViewHolder.setLivePushListener(new LivePushListener() {
@Override

View File

@ -3,7 +3,6 @@ package com.yunbao.live.presenter;
import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Outline;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
@ -17,7 +16,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
@ -55,9 +53,6 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveOneDialogFragment;
import com.yunbao.live.dialog.LiveTurnTableDialogFragment4Audience;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
@ -72,7 +67,6 @@ import com.yunbao.live.socket.SocketLinkMicUtil;
import com.yunbao.live.utils.CountDownView;
import com.yunbao.live.views.AbsLiveLinkMicPlayViewHolder;
import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder;
import com.yunbao.live.views.CustomViewHolder;
import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder;
import com.yunbao.live.views.LiveLinkMicPushTxViewHolder;
@ -83,8 +77,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
/**
* Created by cxf on 2018/10/25.
* 观众和主播连麦的逻辑
@ -118,21 +110,21 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
private int mLiveSdk;
private View btnWishList;
private View btnTurnTable;
private View btnEvent;
private View btnEvent3;
private View btn_onecz_event;
private ImageView imgEvent;
private String eventUrl;
private Banner mBanner1;
public static Banner mBanner2, mBanner3;
//
public Banner mBanner3;
private List<BannerBean> mBannerList1 = new ArrayList<>();
private List<BannerBean> mBannerList3 = new ArrayList<>();
public static List<BannerBean> mBannerList2 = new ArrayList<>();
public static CountDownView date;
public static String link = "";
LinearLayout btn_event2;
//
public static LiveGiftBean bean1 = new LiveGiftBean();
String gold, experience;
@ -151,7 +143,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
}
}
} else if ("stop_svga_new_user_follow".equals(str)&& mBannerList3.size() > 1) {
} else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) {
mBannerList3.get(1).setLink("1");
mBanner3.update(mBannerList3);
@ -162,7 +154,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
}
}
} else if ("stop_new_user_gif".equals(str)&& mBannerList3.size() > 0) {
} else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) {
IMLoginManager.get(mContext).setNewUserGif(false);
mBannerList3.get(0).setLink("1");
mBanner3.update(mBannerList3);
@ -298,26 +290,13 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
btnLinkMic.setOnClickListener(this);
btnWishList.setOnClickListener(this);
btnTurnTable.setOnClickListener(this);
btnEvent = root.findViewById(R.id.btn_event);
btnEvent3 = root.findViewById(R.id.btn_event3);
mBanner1 = (Banner) root.findViewById(R.id.banner1);
mBanner2 = (Banner) root.findViewById(R.id.banner2);
mBanner3 = (Banner) root.findViewById(R.id.banner3);
btn_event2 = root.findViewById(R.id.btn_event2);
mBanner1.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
}
});
mBanner2.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
}
});
mBanner3.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
@ -397,8 +376,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveOneDialogFragment");
}
});
imgEvent = root.findViewById(R.id.img_event);
btnEvent.setOnClickListener(this);
mLinkMicTip = btnLinkMic.findViewById(R.id.link_mic_tip);
}
mLinkMicWaitString = WordUtil.getString(R.string.link_mic_wait);
@ -420,12 +398,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
}
};
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
loadWishlistData();
}
}, 500);
String turntableEnable = CommonAppConfig.getInstance().getTurnTableEnable();
getEvent();
@ -444,35 +417,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
mSocketClient = socketClient;
}
public void setLiveUid(String liveUid) {
mLiveUid = liveUid;
LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && imgEvent != null) {
for (int i = 0; i < info.length; i++) {
JSONObject obj = JSONObject.parseObject(info[i]);
if (obj.getString("is_hidden").equals("0")) {
BannerBean bannerBean = new BannerBean();
bannerBean.setImageUrl(obj.getString("img"));
bannerBean.setLink(obj.getString("link"));
bannerBean.setShow_type(obj.getString("show_type"));
mBannerList2.add(bannerBean);
}
}
if (mBannerList2.size() <= 0) {
btn_event2.setVisibility(View.GONE);
}
showBanner2();
} else {
if (btn_event2 != null) {
btn_event2.setVisibility(View.GONE);
}
}
}
});
}
/**
* 主播收到观众申请连麦的回调
@ -764,11 +708,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
anchorCloseLinkMic();
}
//打开活动窗口
else if (i == R.id.btn_event) {
Log.i("tag", eventUrl);
startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", eventUrl));
}
}
@ -799,43 +739,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
//获取心愿单列表
private void loadWishlistData() {
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
try {
JSONObject obj = JSON.parseObject(info[0]);
String giftJson = obj.getString("wishlist");
List<LiveWishlistBean> mWishlist = JSON.parseArray(giftJson, LiveWishlistBean.class);
if (btnWishList != null) {
if (mWishlist.size() > 0) {
btnWishList.setVisibility(View.GONE);
//心单
BannerBean bannerBean2 = new BannerBean();
bannerBean2.setImageUrl(obj.getString("img"));
bannerBean2.setLink("xyd");
mBannerList1.add(bannerBean2);
} else {
btnWishList.setVisibility(View.GONE);
}
}
showBanner();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void onFinish() {
}
});
}
private void onLinkMicBtnClick() {
if (((LiveActivity) mContext).isGamePlaying()) {
ToastUtil.show(R.string.live_game_cannot_link_mic);
@ -868,109 +771,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
});
}
private void showBanner() {
if (mBannerList1 == null || mBannerList1.size() == 0 || mBanner1 == null) {
return;
}
mBanner1.setAutoPlay(true)
.setPages(mBannerList1, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList1 != null) {
if (p >= 0 && p < mBannerList1.size()) {
BannerBean bean = mBannerList1.get(p);
if (bean != null) {
String link = bean.getLink();
if (link.equals("sc")) {
String url;
if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) {
url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
} else {
url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
}
// Bundle bundle = new Bundle();
// bundle.putString("url", url);
// LiveOneDialogFragment fragment = new LiveOneDialogFragment();
// fragment.setArguments(bundle);
// fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveOneDialogFragment");
ZhuangBanActivity.forward(mContext, url, false);
} else if (link.equals("zxb")) {
String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
ZhuangBanActivity.forward(mContext, url, false);
} else if (link.equals("xyd")) {
openWishListWindow();
}
}
}
}
}
})
.start();
}
private void showBanner2() {
if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) {
return;
}
if (mBannerList2.size() == 1) {
mBanner2.setAutoPlay(false)
.setPages(mBannerList2, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) {
BannerBean bean = mBannerList2.get(p);
if (bean.getShow_type().equals("1")) {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
ZhuangBanActivity.forward(mContext, url, false);
} else {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
Bundle bundle = new Bundle();
bundle.putString("url", url);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
}
})
.start();
} else {
mBanner2.setAutoPlay(true)
.setPages(mBannerList2, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) {
BannerBean bean = mBannerList2.get(p);
if (bean.getShow_type().equals("1")) {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
ZhuangBanActivity.forward(mContext, url, false);
} else {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
Bundle bundle = new Bundle();
bundle.putString("url", url);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
}
})
.start();
}
}
private void showBanner3() {
btnEvent3.setVisibility(View.VISIBLE);

View File

@ -543,7 +543,7 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
// SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override

View File

@ -3,6 +3,8 @@ package com.yunbao.live.views;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Outline;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@ -12,6 +14,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -37,12 +40,16 @@ import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ms.banner.Banner;
import com.ms.banner.BannerConfig;
import com.ms.banner.listener.OnBannerClickListener;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
@ -66,6 +73,7 @@ import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.adapter.LiveChatAdapter;
import com.yunbao.live.adapter.LiveUserAdapter;
import com.yunbao.live.bean.DrPkbean;
@ -78,6 +86,7 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.bean.WishlistItemModel;
import com.yunbao.live.custom.LiveLightView;
import com.yunbao.live.custom.RightGradual;
@ -85,6 +94,7 @@ import com.yunbao.live.custom.TopGradual;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
@ -92,7 +102,6 @@ import com.yunbao.live.presenter.LiveDanmuPresenter;
import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.socket.SocketChatUtil;
import org.greenrobot.eventbus.EventBus;
@ -104,6 +113,7 @@ import java.util.List;
import pl.droidsonroids.gif.GifImageView;
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
@ -229,7 +239,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static RelativeLayout lt_pk_line;
public WindowManager windowManager;
// public boolean isRy = false;
// public boolean isRy = false;
private Banner mBanner1, mBanner2;
private List<BannerBean> mBannerList1 = new ArrayList<>();
private List<BannerBean> mBannerList2 = new ArrayList<>();
private LinearLayout btn_event2;
private ImageView imgEvent;
private View btnEvent;
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView);
@ -243,6 +259,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void clearList() {
mBannerList2.clear();
}
//更新连麦人
public static List<String> mic_ids = new ArrayList<>();
@ -548,8 +567,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void init() {
btnEvent = findViewById(R.id.btn_event);
imgEvent = (ImageView) findViewById(R.id.img_event);
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
mBanner1 = (Banner) findViewById(R.id.banner1);
time = (TextView) findViewById(R.id.time);
mBanner2 = (Banner) findViewById(R.id.banner2);
pkText1 = (TextView) findViewById(R.id.pk_text1);
pkText2 = (TextView) findViewById(R.id.pk_text2);
pkText3 = (TextView) findViewById(R.id.pk_text3);
@ -809,9 +832,196 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST)));
mBanner1.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
}
});
mBanner2.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
}
});
loadWishlistData();
//打开活动窗口
ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", "")));
}
private void showBanner2() {
if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) {
return;
}
if (mBannerList2.size() == 1) {
mBanner2.setAutoPlay(false)
.setPages(mBannerList2, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) {
BannerBean bean = mBannerList2.get(p);
if (bean.getShow_type().equals("1")) {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
ZhuangBanActivity.forward(mContext, url, false);
} else {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
Bundle bundle = new Bundle();
bundle.putString("url", url);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
}
})
.start();
} else {
mBanner2.setAutoPlay(true)
.setPages(mBannerList2, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList2 != null) {
if (p >= 0 && p < mBannerList2.size()) {
BannerBean bean = mBannerList2.get(p);
if (bean.getShow_type().equals("1")) {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
ZhuangBanActivity.forward(mContext, url, false);
} else {
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
Bundle bundle = new Bundle();
bundle.putString("url", url);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
}
})
.start();
}
}
public void setLiveUid(String liveUid) {
mLiveUid = liveUid;
LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && imgEvent != null) {
for (int i = 0; i < info.length; i++) {
JSONObject obj = JSONObject.parseObject(info[i]);
if (obj.getString("is_hidden").equals("0")) {
BannerBean bannerBean = new BannerBean();
bannerBean.setImageUrl(obj.getString("img"));
bannerBean.setLink(obj.getString("link"));
bannerBean.setShow_type(obj.getString("show_type"));
mBannerList2.add(bannerBean);
}
}
if (mBannerList2.size() <= 0) {
btn_event2.setVisibility(View.GONE);
}
showBanner2();
} else {
if (btn_event2 != null) {
btn_event2.setVisibility(View.GONE);
}
}
}
});
}
//获取心愿单列表
private void loadWishlistData() {
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
try {
JSONObject obj = JSON.parseObject(info[0]);
String giftJson = obj.getString("wishlist");
List<LiveWishlistBean> mWishlist = JSON.parseArray(giftJson, LiveWishlistBean.class);
if (mWishlist.size() > 0) {
//心单
BannerBean bannerBean2 = new BannerBean();
bannerBean2.setImageUrl(obj.getString("img"));
bannerBean2.setLink("xyd");
mBannerList1.add(bannerBean2);
}
showBanner();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void onFinish() {
}
});
}
private void showBanner() {
if (mBannerList1 == null || mBannerList1.size() == 0 || mBanner1 == null) {
return;
}
mBanner1.setAutoPlay(true)
.setPages(mBannerList1, new CustomViewHolder())
.setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int p) {
if (mBannerList1 != null) {
if (p >= 0 && p < mBannerList1.size()) {
BannerBean bean = mBannerList1.get(p);
if (bean != null) {
String link = bean.getLink();
if (link.equals("sc")) {
String url;
if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) {
url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
} else {
url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
}
ZhuangBanActivity.forward(mContext, url, false);
} else if (link.equals("zxb")) {
String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
ZhuangBanActivity.forward(mContext, url, false);
} else if (link.equals("xyd")) {
openWishListWindow();
}
}
}
}
}
})
.start();
}
/**
* 观众打开主播的心愿单窗口
*/
public void openWishListWindow() {
LiveWishListDialogFragment4Audience fragment = new LiveWishListDialogFragment4Audience();
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid);
fragment.setArguments(bundle);
if (mContext instanceof LiveAudienceActivity) {
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience");
}
}
/**
* 初始化心愿单列表轮播
*/
@ -1302,7 +1512,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
logger.logEvent("FB_Follow", null);
AdjustEvent adjustEvent1 = new AdjustEvent("oess6a");
Adjust.trackEvent(adjustEvent1);
SocketChatUtil.sendSystemMessage(mLiveUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
// SocketChatUtil.sendSystemMessage(mLiveUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
LiveActivity.sendSystemMessage(
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
}
@ -1347,6 +1557,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 退出直播间
*/
private void close() {
if (mContext instanceof LiveAudienceActivity) {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed();
}
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed();
}
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAnchorActivity) mContext).onBackPressed();
}
} else if (mContext instanceof LiveRyAnchorActivity) {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
}
// if (isRy == false) {
// if (forAct == 1) {
// //是否关注0==没关注
@ -1366,23 +1613,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// ((LiveAnchorActivity) mContext).onBackPressed();
// }
// } else {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
// if (forAct == 1) {
// //是否关注0==没关注
// if (isAttention == 0) {
// if (isStayRoomfive) {
// showFollowDialog(mNameText, mAvatarUrl, mContext);
// } else {
// LiveRyAnchorActivity.backIndex = 1;
// ((LiveRyAnchorActivity) mContext).onBackPressed();
// }
// } else {
// LiveRyAnchorActivity.backIndex = 1;
// ((LiveRyAnchorActivity) mContext).onBackPressed();
// }
// } else {
// LiveRyAnchorActivity.backIndex = 1;
// ((LiveRyAnchorActivity) mContext).onBackPressed();
// }
// }
}

View File

@ -29,6 +29,7 @@ import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -82,7 +83,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
/**
@ -230,7 +230,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
mLiveLinkMicPresenter.setLiveUid(data.getUid());
mLiveRoomViewHolder.setLiveUid(data.getUid());
//心愿单
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
@Override
@ -1117,6 +1117,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
public void end() {
if (mLiveRoomViewHolder != null)
mLiveRoomViewHolder.clearList();
boolean canBackPressed = true;
if (mContext instanceof LiveAudienceActivity) {
canBackPressed = ((LiveAudienceActivity) mContext).canBackPressed();
@ -1145,7 +1147,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} else {
exitLiveRoom();
}
mBannerList2.clear();
}
/**
@ -1285,4 +1287,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}
public void onFollowEvent(FollowEvent e) {
if (!TextUtils.isEmpty(liveID) && liveID.equals(e.getToUid())) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.setAttention(e.getIsAttention());
}
}
}
}

View File

@ -85,47 +85,6 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event1"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="18dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.ms.banner.Banner
android:id="@+id/banner1"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginBottom="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event2"
android:layout_width="58dp"
android:layout_height="80dp"
android:layout_gravity="right"
android:layout_marginRight="15dp"
android:layout_marginBottom="45dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.ms.banner.Banner
android:id="@+id/banner2"
android:layout_width="58dp"
android:layout_height="80dp"
android:layout_marginBottom="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_onecz_event"
@ -147,24 +106,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/img_event"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/live_turntable" />
</LinearLayout>
<LinearLayout

View File

@ -9,6 +9,76 @@
android:paddingTop="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/btn_event1"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="18dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.ms.banner.Banner
android:id="@+id/banner1"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginBottom="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event2"
android:layout_width="58dp"
android:layout_height="80dp"
android:layout_gravity="right"
android:layout_marginRight="15dp"
android:layout_marginBottom="45dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.ms.banner.Banner
android:id="@+id/banner2"
android:layout_width="58dp"
android:layout_height="80dp"
android:layout_marginBottom="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/img_event"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/live_turntable" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/lin"
android:layout_width="match_parent"
@ -127,12 +197,12 @@
android:id="@+id/user_guard"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:scaleType="centerCrop"
app:riv_oval="true"
android:src="@mipmap/img_guardian_empty"/>
android:src="@mipmap/img_guardian_empty"
app:riv_oval="true" />
<com.opensource.svgaplayer.SVGAImageView
@ -141,18 +211,18 @@
android:layout_height="38dp"
android:src="@drawable/img_guardian_online"
android:visibility="gone"
app:autoPlay="true"/>
app:autoPlay="true" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_recyclerView"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginRight="-3dp"
android:overScrollMode="never" />
<ImageView
android:id="@+id/user_more"
android:layout_width="33dp"
@ -310,10 +380,10 @@
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginStart="6dp"
android:flipInterval="5000"
android:layout_marginEnd="6dp"
android:flipInterval="5000"
android:inAnimation="@anim/anim_marquee_in"
android:outAnimation="@anim/anim_marquee_out"/>
android:outAnimation="@anim/anim_marquee_out" />
</LinearLayout>
<!--粉丝团-->