From 86c5334ab4f6a7667454997704eddf63c5cac008 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 27 Mar 2023 14:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E7=AD=89=E7=BA=A7=E5=85=A5=E5=9C=BA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/NewLevelModel.java | 2 +- common/src/main/res/values/strings.xml | 1 + .../live/views/LiveAudienceViewHolder.java | 2 +- .../yunbao/live/views/LiveRoomViewHolder.java | 120 +++++++++++++++++- .../live/views/PortraitLiveManager.java | 60 +++++++-- live/src/main/res/drawable/background_100.xml | 9 ++ live/src/main/res/drawable/background_30.xml | 9 ++ live/src/main/res/drawable/background_50.xml | 9 ++ live/src/main/res/drawable/background_60.xml | 9 ++ live/src/main/res/drawable/background_80.xml | 9 ++ live/src/main/res/drawable/bg_100_leave.xml | 8 ++ live/src/main/res/drawable/bg_30_leave.xml | 8 ++ live/src/main/res/drawable/bg_50_leave.xml | 8 ++ live/src/main/res/drawable/bg_60_leave.xml | 8 ++ live/src/main/res/drawable/bg_80_leave.xml | 8 ++ .../main/res/layout/view_enter_room_leave.xml | 48 +++++++ live/src/main/res/layout/view_live_room.xml | 11 +- 17 files changed, 312 insertions(+), 17 deletions(-) create mode 100644 live/src/main/res/drawable/background_100.xml create mode 100644 live/src/main/res/drawable/background_30.xml create mode 100644 live/src/main/res/drawable/background_50.xml create mode 100644 live/src/main/res/drawable/background_60.xml create mode 100644 live/src/main/res/drawable/background_80.xml create mode 100644 live/src/main/res/drawable/bg_100_leave.xml create mode 100644 live/src/main/res/drawable/bg_30_leave.xml create mode 100644 live/src/main/res/drawable/bg_50_leave.xml create mode 100644 live/src/main/res/drawable/bg_60_leave.xml create mode 100644 live/src/main/res/drawable/bg_80_leave.xml create mode 100644 live/src/main/res/layout/view_enter_room_leave.xml diff --git a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java index b477eba85..b68dff545 100644 --- a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java @@ -23,7 +23,7 @@ public class NewLevelModel extends BaseModel { @SerializedName("colour") private String colour; @SerializedName("live_icon") - private String liveIcon; + private String liveIcon = "https://downs.yaoulive.com/level1/img_1-9.png"; public static NewLevelModel objectFromData(String str) { diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 027a49417..f2933b3b4 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1086,6 +1086,7 @@ 註冊並登錄 開通貴族,尊享超多特權! 說點什麽吧... + %s 来了 diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index aecc2ae8a..2ea107897 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -451,7 +451,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { LiveChatBean lvBean = new LiveChatBean(); lvBean.setType(-2); lvBean.setId(url); - lvBean.setAttention(isattention == 0); + lvBean.setAttention(isattention != 0); LiveRoomViewHolder.insertChat(lvBean, 1); Log.i("chatMgs", liveUid + "|" + mLiveUid); } 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 f82402c29..546b41a8d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -6,7 +6,9 @@ import static com.yunbao.live.views.LivePushRyViewHolder.btn_close; import android.app.Activity; import android.app.Dialog; import android.content.Context; +import android.graphics.Color; import android.graphics.Outline; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; @@ -23,7 +25,9 @@ import android.view.ViewOutlineProvider; import android.view.WindowManager; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; +import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; +import android.view.animation.TranslateAnimation; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; @@ -106,6 +110,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.AbsViewHolder; +import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.common.views.weight.FullServiceNotificationView; import com.yunbao.common.views.weight.NobleNoticeView; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -148,6 +153,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LoadDian9TuUtil; import org.greenrobot.eventbus.EventBus; @@ -296,12 +302,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private List mBannerList2 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); private List mBannerList4 = new ArrayList<>(); - private LinearLayout btn_event2, btn_event3, btn_event4; + private LinearLayout btn_event2, btn_event3, btn_event4, enterRoomLeave2; private ImageView imgEvent; private View btnEvent; private LinearLayout lt_trickery; private TextView tv_trickery_time; - + private FrameLayout enterRoomLeave, enterRoomBg; private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; @@ -684,6 +690,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis imgEvent = (ImageView) findViewById(R.id.img_event); btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event4 = (LinearLayout) findViewById(R.id.btn_event4); + enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave); + enterRoomBg = (FrameLayout) findViewById(R.id.enter_room_bg); + enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2); mBanner1 = (Banner) findViewById(R.id.banner1); time = (TextView) findViewById(R.id.time); mBanner2 = (Banner) findViewById(R.id.banner2); @@ -1241,6 +1250,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mBannerList4.clear(); updataCleanMic(); initStarChallengeStatus(); + enterRoomLeave.setVisibility(View.GONE); } public void clearChat() { @@ -3464,8 +3474,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .start(); } + /** + * 新版UI隐藏活动轮播入口 + */ private void showBanner4() { - btn_event4.setVisibility(View.VISIBLE); + btn_event4.setVisibility(View.GONE); if (mBannerList4 == null || mBannerList4.size() == 0 || mBanner4 == null) { return; } @@ -4211,14 +4224,113 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void changeMessageLandscape(int landscape) { RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams enterRoomParams = (RelativeLayout.LayoutParams) enterRoomLeave.getLayoutParams(); if (landscape == 2) { params1.height = DpUtil.dp2px(200); - + enterRoomParams.bottomMargin = -DpUtil.dp2px(65); } else { params1.height = DpUtil.dp2px(310); + enterRoomParams.bottomMargin = -DpUtil.dp2px(70); } mChatRecyclerView.setLayoutParams(params1); + enterRoomLeave.setLayoutParams(enterRoomParams); + + } + + public void showHighGrade(LiveUserGiftBean model) { + ImageView imageView = (ImageView) findViewById(R.id.image_view); + ClipPathCircleImage imageAvatar = (ClipPathCircleImage) findViewById(R.id.image_avatar); + TextView userName = (TextView) findViewById(R.id.user_name); + userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName())); + ImgLoader.display(mContext, model.getAvatar(), imageAvatar); + int level = model.getLevel(); + if (level < 50) { + enterRoomLeave.setBackgroundResource(R.drawable.background_30); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_30_leave); + } else if (level > 49 && level < 60) { + enterRoomLeave.setBackgroundResource(R.drawable.background_50); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_50_leave); + } else if (level > 59 && level < 80) { + enterRoomLeave.setBackgroundResource(R.drawable.background_60); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_60_leave); + } else if (level > 79 && level < 90) { + enterRoomLeave.setBackgroundResource(R.drawable.background_80); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_80_leave); + } else if (level > 99) { + enterRoomLeave.setBackgroundResource(R.drawable.background_100); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_100_leave); + } + + new LiveTextRender().getLiveLevelImage(mContext, model.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, imageView); + } + + @Override + public void onLoadFailed() { + + } + }); + enterRoomLeave.post(() -> { + enterRoomLeave.setVisibility(View.VISIBLE); + TranslateAnimation animationTranslate = new TranslateAnimation(enterRoomLeave.getMeasuredWidth(), 0, 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration(500); + animationSet1.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + enterRoomLeave.startAnimation(animationSet1); + + }); + + + } + + /** + * 隐藏高等级入场提示 + */ + public void hideHighGrade() { + if (enterRoomLeave.getVisibility() == View.GONE) return; + TranslateAnimation animationTranslate = new TranslateAnimation(0, -(enterRoomLeave.getMeasuredWidth() + DpUtil.dp2px(6)), 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration(100); + animationSet1.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + enterRoomLeave.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + enterRoomLeave.startAnimation(animationSet1); + } } 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 2442b4f0d..b262fcd02 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -203,6 +203,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe ininView(); } + /** * 初始化布局 */ @@ -249,6 +250,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void run() { loading.setVisibility(View.GONE); + enterRoomLeaveHandler.post(enterRoomLeaveRunnable); } }; @@ -335,7 +337,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }); mLiveRoomViewHolder.resetView(); - + enterRoomModel.clear(); + enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable); mLiveRoomViewHolder.setAvatar(data.getAvatar()); mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor()); mLiveRoomViewHolder.setName(data.getUserNiceName()); @@ -410,13 +413,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum()); List bannerBeans = new ArrayList<>(); //心愿单 - if (data.getWishList().getWishList().size() > 0) { - BannerBean bannerModel = new BannerBean(); - bannerModel.setShow_type("2"); - bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); - bannerModel.setImageUrl(data.getWishList().getImg()); - bannerBeans.add(bannerModel); - } +// if (data.getWishList().getWishList().size() > 0) { +// BannerBean bannerModel = new BannerBean(); +// bannerModel.setShow_type("2"); +// bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); +// bannerModel.setImageUrl(data.getWishList().getImg()); +// bannerBeans.add(bannerModel); +// } //活动列表 if (data.getLiveRoomActivityModels().size() > 0) { @@ -1005,15 +1008,54 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + //高等级用户进入房间排序列表 + private List enterRoomModel = new ArrayList<>(); + private Handler enterRoomLeaveHandler = new Handler(); + private Runnable enterRoomLeaveRunnable = new Runnable() { + @Override + public void run() { + + if (enterRoomModel.size() > 0) { + if (mLiveRoomViewHolder != null) { + LiveUserGiftBean model = enterRoomModel.get(0); + mLiveRoomViewHolder.showHighGrade(model); + enterRoomModel.remove(0); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mLiveRoomViewHolder.hideHighGrade(); + enterRoomLeaveHandler.post(enterRoomLeaveRunnable); + } + }, 3000); + } + + } else { + enterRoomLeaveHandler.postDelayed(enterRoomLeaveRunnable, 200); + } + } + }; + @Override public void onEnterRoom(LiveEnterRoomBean bean) { if (mLiveRoomViewHolder != null) { + if (!bean.getUserBean().getCar().getWords().equals("")) { bean.getLiveChatBean().setContent(bean.getUserBean().getCar().getWords()); } - mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1); + mLiveRoomViewHolder.onEnterRoom(bean); + LiveChatBean liveChatBean = bean.getLiveChatBean(); + LiveUserGiftBean liveUserGiftBean = bean.getUserBean(); + int level = liveUserGiftBean.getLevel(); + if (level >= 10) { + //高等级飘屏 + liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName()); + enterRoomModel.add(liveUserGiftBean); + } else { + mLiveRoomViewHolder.insertChat(liveChatBean, 1); + } } + // } @Override diff --git a/live/src/main/res/drawable/background_100.xml b/live/src/main/res/drawable/background_100.xml new file mode 100644 index 000000000..4487ea7e8 --- /dev/null +++ b/live/src/main/res/drawable/background_100.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_30.xml b/live/src/main/res/drawable/background_30.xml new file mode 100644 index 000000000..60d5931c6 --- /dev/null +++ b/live/src/main/res/drawable/background_30.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_50.xml b/live/src/main/res/drawable/background_50.xml new file mode 100644 index 000000000..8123a9ea2 --- /dev/null +++ b/live/src/main/res/drawable/background_50.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_60.xml b/live/src/main/res/drawable/background_60.xml new file mode 100644 index 000000000..c68d95213 --- /dev/null +++ b/live/src/main/res/drawable/background_60.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_80.xml b/live/src/main/res/drawable/background_80.xml new file mode 100644 index 000000000..d5cb5217c --- /dev/null +++ b/live/src/main/res/drawable/background_80.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_100_leave.xml b/live/src/main/res/drawable/bg_100_leave.xml new file mode 100644 index 000000000..ffeadf36c --- /dev/null +++ b/live/src/main/res/drawable/bg_100_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_30_leave.xml b/live/src/main/res/drawable/bg_30_leave.xml new file mode 100644 index 000000000..e61d5b00e --- /dev/null +++ b/live/src/main/res/drawable/bg_30_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_50_leave.xml b/live/src/main/res/drawable/bg_50_leave.xml new file mode 100644 index 000000000..427d677fa --- /dev/null +++ b/live/src/main/res/drawable/bg_50_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_60_leave.xml b/live/src/main/res/drawable/bg_60_leave.xml new file mode 100644 index 000000000..22ff20029 --- /dev/null +++ b/live/src/main/res/drawable/bg_60_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_80_leave.xml b/live/src/main/res/drawable/bg_80_leave.xml new file mode 100644 index 000000000..3c3fa30ee --- /dev/null +++ b/live/src/main/res/drawable/bg_80_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_enter_room_leave.xml b/live/src/main/res/layout/view_enter_room_leave.xml new file mode 100644 index 000000000..9d9b34e20 --- /dev/null +++ b/live/src/main/res/layout/view_enter_room_leave.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index e3eee3bb8..e9985e9fa 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -6,7 +6,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="45dp" - android:paddingTop="15dp"> @@ -215,7 +214,15 @@ - +