feat:调整首页派对-礼物消息-房间上锁的处理

This commit is contained in:
Max
2023-12-27 17:39:01 +08:00
parent 3e1ab090aa
commit 35032c1f8e
6 changed files with 34 additions and 14 deletions

View File

@@ -1,6 +1,8 @@
package com.nnbc123.app.home.adapter
import android.view.View
import android.widget.ImageView
import androidx.core.view.isVisible
import com.nnbc123.app.R
import com.nnbc123.app.ui.utils.load
import com.nnbc123.app.ui.utils.loadAvatar
@@ -14,6 +16,8 @@ import com.zhpan.bannerview.BaseViewHolder
* Desc:
**/
class HomePartyMessageAdapter : BaseBannerAdapter<GiftServiceMsgVo>() {
var clickListener: ((GiftServiceMsgVo) -> Unit)? = null
override fun bindData(
holder: BaseViewHolder<GiftServiceMsgVo>,
item: GiftServiceMsgVo,
@@ -27,6 +31,11 @@ class HomePartyMessageAdapter : BaseBannerAdapter<GiftServiceMsgVo>() {
holder.findViewById<ImageView>(R.id.iv_avatar_send).loadAvatar(item.senderAvatar)
holder.findViewById<ImageView>(R.id.iv_avatar_receiver).loadAvatar(item.receiverAvatar)
holder.findViewById<ImageView>(R.id.iv_gift).load(item.giftPicUrl)
val arrowView = holder.findViewById<View>(R.id.iv_arrow)
arrowView.isVisible = !item.isLock
arrowView.setOnClickListener {
clickListener?.invoke(item)
}
}
override fun getLayoutId(viewType: Int): Int {

View File

@@ -85,20 +85,18 @@ class PartyFragment : BaseBindingFragment<HomePartyFragmentBinding>() {
private fun initHotMessage() {
val adapter = HomePartyMessageAdapter()
mBinding.hotMessage.apply {
setOrientation(ViewPager2.ORIENTATION_VERTICAL)
setAdapter(adapter)
registerLifecycleObserver(lifecycle)
setUserInputEnabled(false)
setOnPageClickListener { _, position ->
adapter.getItem(position)?.let {
adapter.clickListener = {
StatisticManager.Instance().onEvent(
StatisticsProtocol.EVENT_HOMEPAGE_INFORM_CLICK,
it.roomUid.toString()
)
AVRoomActivity.start(mContext, it.roomUid)
}
}
mBinding.hotMessage.apply {
setOrientation(ViewPager2.ORIENTATION_VERTICAL)
setAdapter(adapter)
registerLifecycleObserver(lifecycle)
setUserInputEnabled(false)
}.create()
viewModel.giftServiceLiveData.observe(viewLifecycleOwner) {
if (it.isSuccess && !it.data.isNullOrEmpty()) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -104,16 +104,20 @@
app:layout_constraintEnd_toStartOf="@id/iv_arrow"
app:layout_constraintStart_toEndOf="@id/iv_gift"
app:layout_constraintTop_toTopOf="parent"
tools:text="x11" />
app:layout_goneMarginEnd="@dimen/dp_12"
tools:text="x1111111111" />
<ImageView
android:id="@+id/iv_arrow"
android:layout_width="@dimen/dp_12"
android:layout_height="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_12"
android:layout_width="@dimen/dp_22"
android:layout_height="@dimen/dp_22"
android:layout_marginEnd="@dimen/dp_7"
android:scaleType="centerInside"
android:src="@drawable/home_ic_hot_message_arrow"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -14,6 +14,15 @@ public class GiftServiceMsgVo {
private String giftName;
private int giftNum;
private String giftPicUrl;
private boolean lock;
public boolean isLock() {
return lock;
}
public void setLock(boolean lock) {
this.lock = lock;
}
public long getRoomUid() {
return roomUid;