[Modify]免费礼物弹窗和金币明细逻辑

This commit is contained in:
wushaocheng
2022-12-16 15:55:36 +08:00
parent 6683a484e2
commit 628250f093
11 changed files with 105 additions and 63 deletions

View File

@@ -1204,11 +1204,13 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
fun onRoomFreeGiftEvent(event: RoomFreeGiftEvent) { fun onRoomFreeGiftEvent(event: RoomFreeGiftEvent) {
event.giftFreeInfo?.let { event.giftFreeInfo?.let {
if (roomFreeGiftDialog?.isShowing == true) { if (UIUtils.isTopActivity(context as Activity?) && isResumed) {
roomFreeGiftDialog?.dismiss() if (roomFreeGiftDialog?.isShowing == true) {
roomFreeGiftDialog?.dismiss()
}
roomFreeGiftDialog = RoomFreeGiftDialog(context, it)
roomFreeGiftDialog?.show()
} }
roomFreeGiftDialog = RoomFreeGiftDialog(context, it)
roomFreeGiftDialog?.show()
} }
} }

View File

@@ -41,8 +41,6 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
private lateinit var rvDelegate: RVDelegate<MemberSettlement> private lateinit var rvDelegate: RVDelegate<MemberSettlement>
private lateinit var roomPopupWindow: PopupWindow
private var settlementList: List<MemberSettlement>? = null private var settlementList: List<MemberSettlement>? = null
private var hallVoList: List<HallVo>? = null private var hallVoList: List<HallVo>? = null
@@ -88,12 +86,6 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
} }
private fun initListener() { private fun initListener() {
binding.tvBelongRoom.setOnClickListener {
// showRoomPopup()
}
// binding.ivRoomDown.setOnClickListener {
// showRoomPopup()
// }
binding.llDate.setOnClickListener { binding.llDate.setOnClickListener {
val builder = TimePickerGoldDialog.Builder() val builder = TimePickerGoldDialog.Builder()
.setType(Type.YEAR_MONTH_DAY) .setType(Type.YEAR_MONTH_DAY)

View File

@@ -11,11 +11,9 @@ class GoldDetailAdapter :
override fun convert(helper: BaseViewHolder, item: MemberSettlement) { override fun convert(helper: BaseViewHolder, item: MemberSettlement) {
helper.setText(R.id.tv_user_name, item.nick ?: "--") helper.setText(R.id.tv_user_name, item.nick ?: "--")
.setText(R.id.tv_hall_name, item.hallName ?: "--")
.setText(R.id.tv_have_exchange, item.exchangeGolds.toString()) .setText(R.id.tv_have_exchange, item.exchangeGolds.toString())
.setText(R.id.tv_settlement, item.settlementGolds.toString()) .setText(R.id.tv_settlement, item.settlementGolds.toString())
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.avatar) ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.avatar)
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_hall_avatar), item.hallAvatar)
} }
} }

View File

@@ -1,21 +1,33 @@
package com.yizhuan.erban.earn.adapter; package com.yizhuan.erban.earn.adapter
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R; import com.yizhuan.erban.R
import com.yizhuan.xchat_android_core.earn.bean.HallVo; import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.xchat_android_core.earn.bean.HallVo
import org.jetbrains.annotations.NotNull; class GoldRoomAdapter : BaseQuickAdapter<HallVo, BaseViewHolder>(R.layout.item_gold_room) {
public class GoldRoomAdapter extends BaseQuickAdapter<HallVo, BaseViewHolder> { //选择的位置
var selPosition = 0
//临时记录上次选择的位置
var temp =-1
public GoldRoomAdapter() { override fun convert(helper: BaseViewHolder, item: HallVo) {
super(R.layout.item_gold_room_popwindow); helper.setText(R.id.tv_content, item.hallName)
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_hall_avatar), item.ownerAvatar)
helper.itemView.isSelected = helper.layoutPosition==selPosition
helper.itemView.setOnClickListener {
helper.itemView.isSelected =true
//将旧的位置保存下来,用于后面把旧的位置颜色变回来
temp = selPosition
//设置新的位置
selPosition = helper.layoutPosition
//更新旧位置
notifyItemChanged(temp)
}
} }
@Override }
protected void convert(@NotNull BaseViewHolder helper, HallVo item) {
helper.setText(R.id.tv_content, item.getHallName());
}
}

View File

@@ -572,6 +572,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
GiftInfo giftInfo = giftInfoVm.data; GiftInfo giftInfo = giftInfoVm.data;
sendGiftButton.setEnabled(true); sendGiftButton.setEnabled(true);
switch (giftInfo.getConsumeType()) { switch (giftInfo.getConsumeType()) {
case GiftInfo.CONSUME_TYPE_FREE_GIFT:
case GiftInfo.CONSUME_TYPE_GOLD: case GiftInfo.CONSUME_TYPE_GOLD:
setTvGoldText(); setTvGoldText();
break; break;

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_white" android:state_selected="true" />
<item android:color="@color/color_F0F5F6" />
</selector>

View File

@@ -174,17 +174,44 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/mRecyclerViewRoom" android:id="@+id/mRecyclerViewRoom"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2"
android:overScrollMode="never"
android:scrollbars="none"
android:background="@color/color_F0F5F6" android:background="@color/color_F0F5F6"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.recyclerview.widget.RecyclerView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mRecyclerView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> android:layout_weight="8">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mRecyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/tv_bottom_message"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_bottom_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_50"
android:layout_marginBottom="@dimen/dp_40"
android:text="@string/room_diamond_message"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mRecyclerView" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>

View File

@@ -2,9 +2,9 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_marginBottom="@dimen/dp_16"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_16"
tools:background="@color/color_white"> tools:background="@color/color_white">
<com.yizhuan.erban.common.widget.CircleImageView <com.yizhuan.erban.common.widget.CircleImageView
@@ -28,67 +28,65 @@
android:textColor="@color/color_1F1A4E" android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_10" android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_hall_name" app:layout_constraintEnd_toStartOf="@+id/tv_diamond_pay_record"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_user_avatar" app:layout_constraintTop_toBottomOf="@+id/iv_user_avatar"
tools:text="@string/layout_item_clan_income_01" /> tools:text="@string/layout_item_clan_income_01" />
<com.yizhuan.erban.common.widget.RectRoundImageView
android:id="@+id/iv_hall_avatar"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/default_cover"
app:borderRadius="8dp"
app:layout_constraintEnd_toEndOf="@+id/tv_hall_name"
app:layout_constraintStart_toStartOf="@+id/tv_hall_name"
app:layout_constraintTop_toTopOf="parent"
app:type="round" />
<TextView <TextView
android:id="@+id/tv_hall_name" android:id="@+id/tv_diamond_pay_record"
android:layout_width="60dp" android:layout_width="80dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:ellipsize="end"
android:gravity="center" android:gravity="center"
android:lines="1"
android:textColor="@color/color_1F1A4E" android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_10" android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/iv_user_avatar"
app:layout_constraintEnd_toStartOf="@+id/tv_have_exchange" app:layout_constraintEnd_toStartOf="@+id/tv_have_exchange"
app:layout_constraintStart_toEndOf="@+id/tv_user_name" app:layout_constraintStart_toEndOf="@+id/tv_user_name"
app:layout_constraintTop_toBottomOf="@+id/iv_hall_avatar" app:layout_constraintTop_toTopOf="@+id/iv_user_avatar"
tools:text="@string/layout_item_clan_income_01" /> tools:text="1,000,000,000" />
<TextView <TextView
android:id="@+id/tv_have_exchange" android:id="@+id/tv_have_exchange"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/color_1F1A4E" android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
android:textStyle="bold" android:textStyle="bold"
android:gravity="center" app:layout_constraintBottom_toBottomOf="@+id/iv_user_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_settlement" app:layout_constraintEnd_toStartOf="@+id/tv_settlement"
app:layout_constraintStart_toEndOf="@+id/tv_hall_name" app:layout_constraintStart_toEndOf="@+id/tv_diamond_pay_record"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="@+id/iv_user_avatar"
tools:text="1,000,000,000" /> tools:text="1,000,000,000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/have_converted"
android:textColor="@color/color_B3B3C3"
android:textSize="@dimen/sp_10"
app:layout_constraintEnd_toEndOf="@+id/tv_have_exchange"
app:layout_constraintStart_toStartOf="@+id/tv_have_exchange"
app:layout_constraintTop_toBottomOf="@+id/tv_have_exchange" />
<TextView <TextView
android:id="@+id/tv_settlement" android:id="@+id/tv_settlement"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="22dp" android:layout_marginEnd="22dp"
android:gravity="center"
android:textColor="@color/color_1F1A4E" android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
android:textStyle="bold" android:textStyle="bold"
android:gravity="center" app:layout_constraintBottom_toBottomOf="@+id/iv_user_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_have_exchange" app:layout_constraintStart_toEndOf="@+id/tv_have_exchange"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="@+id/iv_user_avatar"
tools:text="1,000,000,000" /> tools:text="1,000,000,000" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -5015,5 +5015,7 @@
<string name="dialog_free_gift_top">今天觀看直播滿%s啦,送你一個禮物</string> <string name="dialog_free_gift_top">今天觀看直播滿%s啦,送你一個禮物</string>
<string name="dialog_free_gift_bottom_text">每天觀看直播達到特定時長,即可獲得一個"%s",每日上限%d個,禮物當日生效</string> <string name="dialog_free_gift_bottom_text">每天觀看直播達到特定時長,即可獲得一個"%s",每日上限%d個,禮物當日生效</string>
<string name="dialog_free_gift_know">我知道啦</string> <string name="dialog_free_gift_know">我知道啦</string>
<string name="room_diamond_message">當前房間總計鑽石流水:%s鉆</string>
<string name="have_converted">已兌:%s</string>
</resources> </resources>

View File

@@ -6,4 +6,6 @@ import lombok.Data
data class HallVo( data class HallVo(
val hallId: Long, val hallId: Long,
val hallName: String, val hallName: String,
val ownerUid: Long,
val ownerAvatar: String
) )

View File

@@ -430,4 +430,5 @@
<string name="impl_customization_defaultrecentcustomization_07">[機器人消息]</string> <string name="impl_customization_defaultrecentcustomization_07">[機器人消息]</string>
<string name="impl_customization_defaultrecentcustomization_08">[自定義消息] </string> <string name="impl_customization_defaultrecentcustomization_08">[自定義消息] </string>
<string name="xchat_android_core_file_filemodel_01"> 為空或者該文件不存在!</string> <string name="xchat_android_core_file_filemodel_01"> 為空或者該文件不存在!</string>
</resources> </resources>