diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index f7a1e1060..77a7fe126 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -143,7 +143,7 @@ public interface PDLiveApi { * @param liveuid * @return */ - @GET("/api/public/?service=User.setAttents") + @GET("/api/public/?service=User.slketAttents") Observable>> setAttents( @Query("touid") String liveuid ); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index c2af9d68e..989383251 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -1217,6 +1217,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL mLiveRoomViewHolder.setAttention(e.getIsAttention()); } } + if (this instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) this).onFollowEvent(e); + } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index a9bee7241..c87ad778b 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -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); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 3714e0bb2..3dc791d29 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -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); + } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 2cc99572a..5654ff869 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -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 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index 87846ad27..d8d428d34 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -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 mBannerList1 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); - public static List 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 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); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 4d98df654..78a5ba87e 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -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 diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 8e9c3929c..47157cf4f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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 mBannerList1 = new ArrayList<>(); + private List 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 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 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,30 +1557,34 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 退出直播间 */ private void close() { -// if (isRy == false) { -// 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 (forAct == 1) { - //是否关注0==没关注 - if (isAttention == 0) { - if (isStayRoomfive) { - showFollowDialog(mNameText, mAvatarUrl, mContext); + 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(); @@ -1379,10 +1593,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveRyAnchorActivity.backIndex = 1; ((LiveRyAnchorActivity) mContext).onBackPressed(); } - } else { - LiveRyAnchorActivity.backIndex = 1; - ((LiveRyAnchorActivity) mContext).onBackPressed(); } +// if (isRy == false) { +// 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 (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(); +// } // } } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 166437e91..9bb9bdb43 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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()); + } + } + + } } diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index a37447338..a87799079 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -85,47 +85,6 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + android:src="@mipmap/img_guardian_empty" + app:riv_oval="true" /> + app:autoPlay="true" /> - + + android:outAnimation="@anim/anim_marquee_out" />