[Modify]金幣明細功能開發

This commit is contained in:
wushaocheng
2022-12-19 19:46:32 +08:00
parent 723668f55a
commit 8c5b45d8c0
14 changed files with 254 additions and 59 deletions

View File

@@ -275,7 +275,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
//获取免费礼物详情
mvpPresenter?.queryFreeFlower()
}
@CallSuper
@@ -1214,6 +1213,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
}
}
/**
* 底部按鈕點擊處理
*/

View File

@@ -2,6 +2,10 @@ package com.yizhuan.erban.earn.activity
import android.content.Context
import android.content.Intent
import android.text.style.ForegroundColorSpan
import android.view.animation.AccelerateInterpolator
import android.view.animation.Animation
import android.view.animation.RotateAnimation
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
@@ -17,7 +21,9 @@ import com.yizhuan.erban.earn.adapter.GoldRoomAdapter
import com.yizhuan.erban.module_hall.hall.view.dialog.TimePickerGoldDialog
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.erban.ui.widget.recyclerview.decoration.ColorDecoration
import com.yizhuan.xchat_android_core.earn.bean.MemberSettlement
import com.yizhuan.erban.utils.SpannableBuilder
import com.yizhuan.xchat_android_core.earn.bean.HallMemberGoldFlowInfo
import com.yizhuan.xchat_android_core.earn.bean.HallMemberGoldFlowTotalInfo
/**
* 金币明细
@@ -30,9 +36,9 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
private val mGoldDetailAdapter: GoldDetailAdapter by lazy { GoldDetailAdapter() }
private val mGoldRoomAdapter: GoldRoomAdapter by lazy { GoldRoomAdapter() }
private lateinit var rvDelegate: RVDelegate<MemberSettlement>
private lateinit var rvDelegate: RVDelegate<HallMemberGoldFlowInfo>
private var settlementList: List<MemberSettlement>? = null
private var settlementList: Map<Long, HallMemberGoldFlowTotalInfo>? = null
companion object {
@@ -52,7 +58,7 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
private fun initView() {
earnRecordModel.initCurrentDay()
rvDelegate = RVDelegate.Builder<MemberSettlement>()
rvDelegate = RVDelegate.Builder<HallMemberGoldFlowInfo>()
.setLayoutManager(LinearLayoutManager(context))
.setRecyclerView(binding.mRecyclerView)
.setEmptyView(
@@ -103,10 +109,16 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
}
mGoldRoomAdapter.setOnItemClickListener { adapter, view, position ->
val settlementList =
settlementList?.filter { it.hallName == mGoldRoomAdapter.data[position].hallName }
?.toMutableList()
mGoldDetailAdapter.setNewData(settlementList)
// val settlementList =
// settlementList?.filter { it.hallName == mGoldRoomAdapter.data[position].hallName }
// ?.toMutableList()
val settlementList: HallMemberGoldFlowTotalInfo? =
settlementList?.get(mGoldRoomAdapter.data[position].hallId)
mGoldDetailAdapter.setNewData(settlementList?.hallMember)
}
binding.llArrow.setOnClickListener {
}
}
@@ -116,15 +128,47 @@ class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>(),
earnRecordModel.memberSettleLiveData.observe(this) {
it?.let {
binding.tvTotalGold.text = String.format(it.total.toString())
settlementList = it.memberSettlement
settlementList = it.hallMemberMap
mGoldRoomAdapter.setNewData(it.hallVoList)
if (it.hallVoList.isNotEmpty()) {
val settlementList =
settlementList?.filter { settlementList -> settlementList.hallName == it.hallVoList[0].hallName }
?.toMutableList()
rvDelegate.setNewData(settlementList)
} else {
rvDelegate.setNewData(it.memberSettlement)
// val settlementList =
// settlementList?.filter { settlementList -> settlementList.hallName == it.hallVoList[0].hallId }
// ?.toMutableList()
val settlementList: HallMemberGoldFlowTotalInfo? =
settlementList?.get(it.hallVoList[0].hallId)
rvDelegate.setNewData(settlementList?.hallMember)
val text = SpannableBuilder()
.append(
getString(R.string.room_diamond_message),
ForegroundColorSpan(
ContextCompat.getColor(
context,
R.color.color_1F1A4E
)
)
)
.append(
getString(
R.string.diamond_string,
(settlementList?.total ?: 0).toString()
),
ForegroundColorSpan(
ContextCompat.getColor(
context,
R.color.color_DE9F0C
)
)
)
.append(
getString(R.string.diamond_name),
ForegroundColorSpan(
ContextCompat.getColor(
context,
R.color.color_1F1A4E
)
)
)
binding.tvBottomMessage.text = text.build()
}
}
}

View File

@@ -4,16 +4,19 @@ import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.xchat_android_core.earn.bean.MemberSettlement
import com.yizhuan.xchat_android_core.earn.bean.HallMemberGoldFlowInfo
import com.yizhuan.xchat_android_library.utils.FormatUtils
class GoldDetailAdapter :
BaseQuickAdapter<MemberSettlement, BaseViewHolder>(R.layout.item_gold_detail) {
BaseQuickAdapter<HallMemberGoldFlowInfo, BaseViewHolder>(R.layout.item_gold_detail) {
override fun convert(helper: BaseViewHolder, item: MemberSettlement) {
helper.setText(R.id.tv_user_name, item.nick ?: "--")
override fun convert(helper: BaseViewHolder, item: HallMemberGoldFlowInfo) {
helper.setText(R.id.tv_user_name, item.gnick ?: "--")
.setText(R.id.tv_have_exchange, item.exchangeGolds.toString())
.setText(R.id.tv_settlement, item.settlementGolds.toString())
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.avatar)
.setText(R.id.tv_settlement, item.remainGolds.toString())
.setText(R.id.tv_diamond_pay_record, FormatUtils.formatToShortDown(item.giftDiamonds))
.setText(R.id.tv_have_change, item.giftGolds.toString())
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.gavatar)
}
}

View File

@@ -138,6 +138,7 @@
android:textStyle="bold" />
<LinearLayout
android:id="@+id/ll_arrow"
android:orientation="vertical"
android:layout_marginStart="@dimen/dp_3"
android:layout_width="wrap_content"

View File

@@ -63,6 +63,7 @@
tools:text="1,000,000,000" />
<TextView
android:id="@+id/tv_have_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
@@ -80,7 +81,7 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="22dp"
android:gravity="center"
android:textColor="@color/color_1F1A4E"
android:textColor="@color/color_DD9E0B"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/iv_user_avatar"

View File

@@ -637,5 +637,7 @@
<color name="color_CBB788">#CBB788</color>
<color name="color_F4F0FE">#F4F0FE</color>
<color name="color_ACB8D9">#ACB8D9</color>
<color name="color_DD9E0B">#DD9E0B</color>
<color name="color_DE9F0C">#DE9F0C</color>
</resources>

View File

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

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
@@ -68,6 +69,10 @@ public class IncomeStatisticsActivity extends BaseMvpActivity<IIncomeStatisticsV
TextView tvYear;
@BindView(R.id.tv_total)
TextView tvTotal;
@BindView(R.id.ll_day_list)
LinearLayout llDayList;
@BindView(R.id.ll_gold_list)
LinearLayout llGoldList;
private long hallId;
public static void start(Context context, long hallId) {
@@ -154,6 +159,8 @@ public class IncomeStatisticsActivity extends BaseMvpActivity<IIncomeStatisticsV
@Override
public void onPageSelected(int position) {
if (position != 2) {
llDayList.setVisibility(View.VISIBLE);
llGoldList.setVisibility(View.GONE);
// 切换日,周
mCurrentType = position;
IncomeStatisticsPresenter presenter = getMvpPresenter();
@@ -168,6 +175,9 @@ public class IncomeStatisticsActivity extends BaseMvpActivity<IIncomeStatisticsV
day = presenter.getDayFormat();
getIncomeTotal(day, presenter.getmStartTimeStr(), presenter.getmEndTimeStr());
}
}else {
llDayList.setVisibility(View.GONE);
llGoldList.setVisibility(View.VISIBLE);
}
}

View File

@@ -109,47 +109,169 @@
</RelativeLayout>
<RelativeLayout
<LinearLayout
android:id="@+id/ll_day_list"
android:layout_width="match_parent"
android:layout_height="33dp"
android:layout_marginTop="25dp"
android:layout_height="48dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="@dimen/dp_15"
android:paddingEnd="@dimen/dp_40"
android:background="@color/color_F0F5F6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_normal_c6c6e9"
android:textSize="13dp"
android:layout_marginStart="20dp"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12"
android:text="@string/layout_activity_income_statistics_04" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_normal_c6c6e9"
android:textSize="13dp"
android:layout_marginStart="68dp"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12"
android:text="@string/layout_activity_income_statistics_05" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_normal_c6c6e9"
android:layout_marginStart="150dp"
android:textSize="13dp"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12"
android:text="@string/layout_activity_income_statistics_06" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_normal_c6c6e9"
android:layout_marginStart="232dp"
android:textSize="13dp"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12"
android:text="@string/layout_activity_income_statistics_07" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_gold_list"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/color_F0F5F6"
android:gravity="center_vertical"
android:paddingStart="@dimen/dp_15"
android:paddingEnd="@dimen/dp_15">
<TextView
android:id="@+id/tvBelongRoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/layout_activity_income_statistics_04"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/member"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/diamond_pay_list"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" />
<LinearLayout
android:id="@+id/ll_arrow"
android:orientation="vertical"
android:layout_marginStart="@dimen/dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@mipmap/ic_arrow_gray_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:src="@mipmap/ic_arrow_black_bottom"
android:layout_marginTop="@dimen/dp_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/have_exchange_gold"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settleable_gold_coin"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_12" />
<LinearLayout
android:orientation="vertical"
android:layout_marginStart="@dimen/dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@mipmap/ic_arrow_gray_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:src="@mipmap/ic_arrow_black_bottom"
android:layout_marginTop="@dimen/dp_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"

View File

@@ -7,5 +7,5 @@ import java.math.BigDecimal
data class ClanHallMemberIncomeTotalInfo(
val total: BigDecimal,
val hallVoList: List<HallVo>,
val memberSettlement: List<MemberSettlement>
val hallMemberMap:Map<Long, HallMemberGoldFlowTotalInfo>
)

View File

@@ -0,0 +1,16 @@
package com.yizhuan.xchat_android_core.earn.bean
import lombok.Data
@Data
data class HallMemberGoldFlowInfo(
val uid: Long,
val erbanNo: Long,
val gnick: String? = null,
val gavatar: String? = null,
val hallId: Long,
val giftDiamonds: Double,//钻石
val giftGolds: Double,//金币收益
val exchangeGolds: Double,//已兑换金币
val remainGolds: Double//可结算金币
)

View File

@@ -0,0 +1,10 @@
package com.yizhuan.xchat_android_core.earn.bean
import lombok.Data
import java.math.BigDecimal
@Data
data class HallMemberGoldFlowTotalInfo(
val total: Double,
val hallMember: List<HallMemberGoldFlowInfo>//昵称
)

View File

@@ -1,17 +0,0 @@
package com.yizhuan.xchat_android_core.earn.bean
import lombok.Data
import java.math.BigDecimal
@Data
data class MemberSettlement(
val uid: Long,
val nick: String? = null,//昵称
val avatar: String? = null,//头像
val exchangeGolds: BigDecimal,//兑换金币数
val settlementGolds: BigDecimal,//结算金币数
val hallId: Long,
val hallOwnerUid: Long,
val hallAvatar: String? = null,//房间头像
val hallName: String? = null//房间名
)

View File

@@ -134,7 +134,7 @@ object EarnModel : BaseModel() {
/**
* @return
*/
@GET("/clanGoldSettlement/hallMemberTotalList")
@GET("/clanGoldFlow/clanTotalList")
suspend fun getMemberSettlement(
@Query("startTime") startTime: String,
@Query("endTime") endTime: String