From 4ae1b12be05ada8103487ef352f90aab6d2a7cb5 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 13 Apr 2023 15:45:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/live/views/LiveRoomViewHolder.java | 99 ++++++++++++++++++- live/src/main/res/layout/view_live_room.xml | 20 +++- 2 files changed, 112 insertions(+), 7 deletions(-) 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 c27cf7de2..1858253e3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -353,7 +353,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private TextView mAnchorSayText; private ImageView mAnchorSayHide; //----!主播说组件---// - private Banner topBanner1;//心愿单&联系方式 + private Banner topBanner1, topBanner2;//心愿单&联系方式 public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; private String mAnchorName;//主播名字 @@ -1032,6 +1032,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mRedVal = (TextView) findViewById(R.id.pk_rank_red_val); mBlueVal = (TextView) findViewById(R.id.pk_rank_blue_val); topBanner1 = (Banner) findViewById(R.id.top_banner1); + topBanner2 = (Banner) findViewById(R.id.top_banner2); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -1345,6 +1346,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); } }); + topBanner2.setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); + } + }); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); @@ -1500,6 +1507,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis // initStarChallengeStatus(); enterRoomLeave.setVisibility(View.GONE); topBanner1.setVisibility(View.GONE); + topBanner2.setVisibility(View.GONE); + } public void clearChat() { @@ -4272,6 +4281,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); new Handler().postDelayed(new Runnable() { @Override public void run() { @@ -4295,6 +4305,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis topBanner1.setVisibility(View.GONE); } else { topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); } } }, 500); @@ -4315,6 +4326,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis topBanner1.setVisibility(View.GONE); } else { topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); } } @@ -4727,7 +4739,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void hideAnchorSayAndCallAnchor() { mAnchorSay.setVisibility(View.GONE); -// topBanner1.setVisibility(View.GONE); + topBanner1.setVisibility(View.GONE); + if (topBanner1.getVisibility() == View.GONE && mTopBannerList != null && !mTopBannerList.isEmpty()) { + Log.i("女神说", "mTopBannerList: " + mTopBannerList.size()); + for (BannerBean bean : mTopBannerList) { + Log.i("女神说", "BannerBean: " + bean); + } + topBanner2.setVisibility(View.VISIBLE); + } } public void showAnchorSayAndCallAnchor() { @@ -4744,6 +4763,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis Log.i("女神说", "BannerBean: " + bean); } topBanner1.setVisibility(View.VISIBLE); + topBanner2.setVisibility(View.GONE); } } @@ -4776,6 +4796,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mTopBannerList.set(1, bannerBean); } topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); } } @@ -4862,6 +4883,79 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }) .start(); + topBanner2.setAutoPlay(true) + .setPages(mTopBannerList, new TopBannerCustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int position) { + if (datas.size() > 0) { + if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { + Dialog loading = DialogUitl.loadingDialog(mContext); + loading.show(); + LiveNetManager.get(mContext) + .getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + if (data.getIsGet() == 1) { + new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, mAnchorName, data.getLink()) + .setOnDismissListener(dialog -> loading.dismiss()) + .showDialog(); + return; + } + LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); + fragment.setOnDismissListener(dialog -> checkNewLetter() + ); + fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500)); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putString(Constants.LIVE_STREAM, mStream); + bundle.putString(Constants.LIVE_WISH_GIFTID, data.getGiftId() + ""); + bundle.putBoolean("isContactGift", true); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); + } + + @Override + public void onError(String error) { + loading.dismiss(); + } + }); + + } else { + BannerBean bean = mTopBannerList.get(position); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + String type = ""; + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(bean.getLink()) + .append(bean.getLink().contains("?") ? "&uid=" : "?uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()) + .append("&anchorUid=") + .append(mLiveUid) + .append("&liveUid=") + .append(mLiveUid) + .append("&t=") + .append(System.currentTimeMillis()) + .append("&g=Appapi&m=Wish&a=index"); + if (TextUtils.equals(type, "1")) { + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); + } else { + Bundle bundle = new Bundle(); + bundle.putString("url", htmlUrl.toString()); + LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } + } + } + + } + }) + .start(); updateCallMe(); } @@ -4878,6 +4972,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR); mTopBannerList.add(0, call); topBanner1.update(mTopBannerList); + topBanner2.update(mTopBannerList); } } diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 9984147f0..dd202c7ad 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -662,7 +662,7 @@ android:layout_below="@id/open_sidebar" android:layout_alignParentRight="true" android:layout_marginTop="16dp" - android:layout_marginRight="5dp" + android:layout_marginRight="9dp" android:background="@drawable/bg_live_other_ico" android:gravity="center"> @@ -702,7 +702,7 @@ android:layout_height="76dp" android:layout_below="@+id/live_rank_pk" android:layout_alignParentRight="true" - android:layout_marginTop="50dp" + android:layout_marginTop="20dp" android:layout_marginRight="5dp" app:delay_time="5000" app:indicator_height="8dp" @@ -2063,8 +2063,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" - android:layout_marginTop="230dp" - android:layout_marginRight="7dp" + android:layout_marginTop="120dp" + android:layout_marginRight="19dp" android:orientation="vertical"> + + - \ No newline at end of file +