主播评级:主弹窗实现
@@ -7,6 +7,7 @@ import com.mango.core.home.bean.BannerInfo
|
|||||||
import com.mango.core.home.model.HomeModel
|
import com.mango.core.home.model.HomeModel
|
||||||
import com.mango.core.room.bean.MeCenterInfo
|
import com.mango.core.room.bean.MeCenterInfo
|
||||||
import com.mango.core.room.game.GameInfo
|
import com.mango.core.room.game.GameInfo
|
||||||
|
import com.mango.core.user.bean.AnchorGradeInfo
|
||||||
|
|
||||||
class MeViewModel : BaseViewModel() {
|
class MeViewModel : BaseViewModel() {
|
||||||
|
|
||||||
@@ -19,9 +20,8 @@ class MeViewModel : BaseViewModel() {
|
|||||||
private val _gameInfoListLiveData = MutableLiveData<List<List<GameInfo>>>()
|
private val _gameInfoListLiveData = MutableLiveData<List<List<GameInfo>>>()
|
||||||
val gameInfoListLiveData: LiveData<List<List<GameInfo>>> = _gameInfoListLiveData
|
val gameInfoListLiveData: LiveData<List<List<GameInfo>>> = _gameInfoListLiveData
|
||||||
|
|
||||||
init {
|
private val _anchorGradeInfoLiveData = MutableLiveData<AnchorGradeInfo>()
|
||||||
refreshData()
|
val anchorGradeInfoLiveData: LiveData<AnchorGradeInfo> = _anchorGradeInfoLiveData
|
||||||
}
|
|
||||||
|
|
||||||
fun refreshData() {
|
fun refreshData() {
|
||||||
getBannerInfo()
|
getBannerInfo()
|
||||||
@@ -62,6 +62,17 @@ class MeViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getAnchorGradeInfo() {
|
||||||
|
safeLaunch(
|
||||||
|
block = {
|
||||||
|
_anchorGradeInfoLiveData.value = HomeModel.getAnchorGradeInfo()
|
||||||
|
},
|
||||||
|
onError = {
|
||||||
|
_anchorGradeInfoLiveData.value = null
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun <T> transformList(
|
private fun <T> transformList(
|
||||||
data: List<T>?,
|
data: List<T>?,
|
||||||
pageSize: Int
|
pageSize: Int
|
||||||
|
@@ -0,0 +1,102 @@
|
|||||||
|
package com.mango.moshen.home.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.base.BaseDialog
|
||||||
|
import com.mango.moshen.databinding.DialogAnchorGradeBinding
|
||||||
|
import com.mango.moshen.home.MeViewModel
|
||||||
|
import com.mango.moshen.home.widget.RoundBackgroundColorSpan
|
||||||
|
import com.netease.nim.uikit.common.util.sys.TimeUtil
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import java.util.*
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
class AnchorGradeDialog : BaseDialog<DialogAnchorGradeBinding>() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun newInstance(): AnchorGradeDialog {
|
||||||
|
return AnchorGradeDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override var width: Int = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
override var height: Int = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
|
||||||
|
private val meViewModel: MeViewModel by viewModels()
|
||||||
|
|
||||||
|
private val levelArray = arrayOf("D", "C", "B", "A", "S")
|
||||||
|
|
||||||
|
private var disposable: Disposable? = null
|
||||||
|
|
||||||
|
private val anchorDrawableResIds = mapOf(
|
||||||
|
"S" to R.drawable.anchor_grade_ic_level_s,
|
||||||
|
"A" to R.drawable.anchor_grade_ic_level_a,
|
||||||
|
"B" to R.drawable.anchor_grade_ic_level_b,
|
||||||
|
"C" to R.drawable.anchor_grade_ic_level_c,
|
||||||
|
"D" to R.drawable.anchor_grade_ic_level_d
|
||||||
|
)
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult", "SetTextI18n")
|
||||||
|
override fun init() {
|
||||||
|
meViewModel.getAnchorGradeInfo()
|
||||||
|
meViewModel.anchorGradeInfoLiveData.observe(this) {
|
||||||
|
|
||||||
|
anchorDrawableResIds[it.grade.toUpperCase(Locale.getDefault())]?.let { resId ->
|
||||||
|
binding.ivCurrLevel.setImageResource(resId)
|
||||||
|
}
|
||||||
|
val nextLevel = levelArray.getOrNull(levelArray.indexOf(it.grade) + 1)
|
||||||
|
binding.tvDiamondCurrLevel.text = it.grade
|
||||||
|
binding.tvDiamondNextLevel.text = nextLevel
|
||||||
|
binding.tvReplayCurrLevel.text = it.grade
|
||||||
|
binding.tvReplayNextLevel.text = nextLevel
|
||||||
|
|
||||||
|
binding.tvDiamondTargetNum.text = it.targetDiamond.toString()
|
||||||
|
binding.pbDiamond.max = it.targetDiamond
|
||||||
|
binding.pbDiamond.progress = it.currentDiamond
|
||||||
|
binding.tvDiamondGap.text = "还差${it.targetDiamond - it.currentDiamond}钻可完成"
|
||||||
|
|
||||||
|
binding.tvReplayTargetNum.text = (it.targetReply * 100).toInt().toString()
|
||||||
|
binding.pbReplay.max = (it.targetReply * 100).toInt()
|
||||||
|
binding.pbReplay.progress = (it.currentReply * 100).toInt()
|
||||||
|
binding.tvReplayGap.text = "还差${((it.targetReply - it.currentReply) * 100).toInt()}%可完成"
|
||||||
|
disposable?.dispose()
|
||||||
|
disposable = Observable.intervalRange(0, Int.MAX_VALUE.toLong(), 0, 1, TimeUnit.SECONDS)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.compose(bindToLifecycle())
|
||||||
|
.subscribe { seconds ->
|
||||||
|
val nextRemaining = SpannableStringBuilder(
|
||||||
|
TimeUtil.getElapseTimeForAnchorGrade(it.nextRemaining - seconds.toInt())
|
||||||
|
)
|
||||||
|
for (i in nextRemaining.indices) {
|
||||||
|
if (i % 3 != 2) {
|
||||||
|
val span = RoundBackgroundColorSpan(
|
||||||
|
"#E8EAF3".toColorInt(), "#161958".toColorInt(), 8
|
||||||
|
)
|
||||||
|
nextRemaining.setSpan(
|
||||||
|
span, i, i + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvRemainingTime.text = nextRemaining
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
disposable?.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -18,6 +18,7 @@ import com.mango.core.home.event.VisitorUnreadCountEvent
|
|||||||
import com.mango.core.level.UserLevelVo
|
import com.mango.core.level.UserLevelVo
|
||||||
import com.mango.core.manager.IMNetEaseManager
|
import com.mango.core.manager.IMNetEaseManager
|
||||||
import com.mango.core.manager.RelationShipEvent
|
import com.mango.core.manager.RelationShipEvent
|
||||||
|
import com.mango.core.module_hall.hall.bean.RoleType
|
||||||
import com.mango.core.noble.NobleUtil
|
import com.mango.core.noble.NobleUtil
|
||||||
import com.mango.core.pay.PayModel
|
import com.mango.core.pay.PayModel
|
||||||
import com.mango.core.pay.event.GetWalletInfoEvent
|
import com.mango.core.pay.event.GetWalletInfoEvent
|
||||||
@@ -46,8 +47,10 @@ import com.mango.moshen.home.activity.RoomHistoryListActivity
|
|||||||
import com.mango.moshen.home.activity.VisitorListActivity
|
import com.mango.moshen.home.activity.VisitorListActivity
|
||||||
import com.mango.moshen.home.adapter.MeCenterAdapter
|
import com.mango.moshen.home.adapter.MeCenterAdapter
|
||||||
import com.mango.moshen.home.adapter.MeGameAdapter
|
import com.mango.moshen.home.adapter.MeGameAdapter
|
||||||
|
import com.mango.moshen.home.dialog.AnchorGradeDialog
|
||||||
import com.mango.moshen.home.helper.BannerHelper
|
import com.mango.moshen.home.helper.BannerHelper
|
||||||
import com.mango.moshen.home.helper.OpenRoomHelper
|
import com.mango.moshen.home.helper.OpenRoomHelper
|
||||||
|
import com.mango.moshen.module_hall.HallDataManager
|
||||||
import com.mango.moshen.skill.activity.SkillHomeActivity
|
import com.mango.moshen.skill.activity.SkillHomeActivity
|
||||||
import com.mango.moshen.skill.activity.SkillHomeActivity.Companion.start
|
import com.mango.moshen.skill.activity.SkillHomeActivity.Companion.start
|
||||||
import com.mango.moshen.ui.patriarch.PatriarchModeActivity
|
import com.mango.moshen.ui.patriarch.PatriarchModeActivity
|
||||||
@@ -92,6 +95,14 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
private var centerIndex = 0
|
private var centerIndex = 0
|
||||||
private var gameIndex = 0
|
private var gameIndex = 0
|
||||||
|
|
||||||
|
private val anchorDrawableResIds = mapOf(
|
||||||
|
"S" to R.drawable.anchor_grade_bg_me_s,
|
||||||
|
"A" to R.drawable.anchor_grade_bg_me_s,
|
||||||
|
"B" to R.drawable.anchor_grade_bg_me_s,
|
||||||
|
"C" to R.drawable.anchor_grade_bg_me_s,
|
||||||
|
"D" to R.drawable.anchor_grade_bg_me_s
|
||||||
|
)
|
||||||
|
|
||||||
override fun getRootLayoutId(): Int {
|
override fun getRootLayoutId(): Int {
|
||||||
return R.layout.fragment_me
|
return R.layout.fragment_me
|
||||||
}
|
}
|
||||||
@@ -117,6 +128,8 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
meViewModel.refreshData()
|
||||||
|
|
||||||
meViewModel.bannerLiveData.observe(viewLifecycleOwner) {
|
meViewModel.bannerLiveData.observe(viewLifecycleOwner) {
|
||||||
BannerHelper.setBanner(
|
BannerHelper.setBanner(
|
||||||
mBinding.rollView, it
|
mBinding.rollView, it
|
||||||
@@ -196,6 +209,23 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HallDataManager.get().registerHallExist(this) {
|
||||||
|
if (it == true && HallDataManager.get().roleType != RoleType.OWNER) {
|
||||||
|
meViewModel.getAnchorGradeInfo()
|
||||||
|
} else {
|
||||||
|
mBinding.tvAnchorGrade.isVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meViewModel.anchorGradeInfoLiveData.observe(this) {
|
||||||
|
it?.let {
|
||||||
|
mBinding.tvAnchorGrade.isVisible = true
|
||||||
|
anchorDrawableResIds[it.grade.toUpperCase(Locale.getDefault())]?.let { resId ->
|
||||||
|
mBinding.tvAnchorGrade.setBackgroundResource(resId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -335,7 +365,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
mBinding.flPmMode.isVisible = it.isParentMode
|
mBinding.flPmMode.isVisible = it.isParentMode
|
||||||
mBinding.meItemSkill.isVisible = !it.isParentMode
|
mBinding.meItemSkill.isVisible = !it.isParentMode
|
||||||
it.userHeadwear?.effect?.let { effect ->
|
it.userHeadwear?.effect?.let { effect ->
|
||||||
if (mBinding.ivHeadWear.tag != effect){
|
if (mBinding.ivHeadWear.tag != effect) {
|
||||||
NobleUtil.loadHeadWear(effect, mBinding.ivHeadWear)
|
NobleUtil.loadHeadWear(effect, mBinding.ivHeadWear)
|
||||||
mBinding.ivHeadWear.tag = effect
|
mBinding.ivHeadWear.tag = effect
|
||||||
}
|
}
|
||||||
@@ -490,6 +520,8 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.ll_pm_mode -> PatriarchModeActivity.start(mContext)
|
R.id.ll_pm_mode -> PatriarchModeActivity.start(mContext)
|
||||||
|
|
||||||
|
R.id.tv_anchor_grade -> AnchorGradeDialog.newInstance().show(mContext)
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
package com.mango.moshen.home.widget;
|
||||||
|
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.text.style.ReplacementSpan;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给每个文字添加方框
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RoundBackgroundColorSpan extends ReplacementSpan {
|
||||||
|
private final int mRadius;
|
||||||
|
private final int bgColor;
|
||||||
|
private final int textColor;
|
||||||
|
private final int horizontalPadding = 4;
|
||||||
|
RectF rectF = new RectF();
|
||||||
|
private int mSize;
|
||||||
|
|
||||||
|
public RoundBackgroundColorSpan(int bgColor,
|
||||||
|
int textColor,
|
||||||
|
int radius) {
|
||||||
|
super();
|
||||||
|
this.bgColor = bgColor;
|
||||||
|
this.textColor = textColor;
|
||||||
|
this.mRadius = radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSize(@NonNull Paint paint,
|
||||||
|
CharSequence text,
|
||||||
|
int start,
|
||||||
|
int end,
|
||||||
|
Paint.FontMetricsInt fm) {
|
||||||
|
mSize = (int) (paint.measureText(text, start, end) + 2 * mRadius);
|
||||||
|
return mSize + horizontalPadding * 2;//文字之间的间距
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(@NonNull Canvas canvas,
|
||||||
|
CharSequence text,
|
||||||
|
int start,
|
||||||
|
int end,
|
||||||
|
float x,
|
||||||
|
int top,
|
||||||
|
int y, int bottom,
|
||||||
|
@NonNull Paint paint) {
|
||||||
|
int defaultColor = paint.getColor();//保存文字颜色
|
||||||
|
float defaultStrokeWidth = paint.getStrokeWidth();
|
||||||
|
|
||||||
|
//绘制圆角矩形
|
||||||
|
paint.setColor(bgColor);
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
float h = paint.descent() - paint.ascent();//文字高度
|
||||||
|
float size = (mSize - h) / 2;//框的位置
|
||||||
|
|
||||||
|
rectF.set(x + size + horizontalPadding, y + paint.ascent(), x + mSize - size + horizontalPadding, y + paint.descent());
|
||||||
|
//设置文字背景矩形,x为span起始左上角相对整个TextView的x值,y为span左上角相对整个View的y值。
|
||||||
|
// paint.ascent()获得文字上边缘,paint.descent()获得文字下边缘
|
||||||
|
canvas.drawRoundRect(rectF, mRadius, mRadius, paint);
|
||||||
|
|
||||||
|
//绘制文字
|
||||||
|
paint.setColor(textColor);
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
paint.setStrokeWidth(defaultStrokeWidth);
|
||||||
|
canvas.drawText(text, start, end, x + mRadius + horizontalPadding, y, paint);//此处mRadius为文字右移距离
|
||||||
|
|
||||||
|
paint.setColor(defaultColor);//恢复画笔的文字颜色
|
||||||
|
}
|
||||||
|
}
|
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_bg.png
Normal file
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 9.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_bg_me_s.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_bg_task_text.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_bg_update_text.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_ic_level_a.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_ic_level_b.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_ic_level_c.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_ic_level_d.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/drawable-xhdpi/anchor_grade_ic_level_s.png
Normal file
After Width: | Height: | Size: 12 KiB |
22
app/src/main/res/drawable/anchor_grade_bg_pb.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 定义轨道的背景 -->
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#1a000124" />
|
||||||
|
<corners android:radius="@dimen/dp_10" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<!-- 定义轨道上已完成部分的样式 -->
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<scale android:scaleWidth="100%">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="180"
|
||||||
|
android:endColor="#FFAAAA"
|
||||||
|
android:startColor="#FF5A88" />
|
||||||
|
<corners android:radius="@dimen/dp_10" />
|
||||||
|
</shape>
|
||||||
|
</scale>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
224
app/src/main/res/layout/dialog_anchor_grade.xml
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
tools:background="@color/black_transparent_50">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="303dp"
|
||||||
|
android:layout_height="280dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/anchor_grade_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="90dp"
|
||||||
|
android:text="当前评级"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_curr_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="17dp"
|
||||||
|
android:layout_marginBottom="9dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
tools:src="@drawable/anchor_grade_ic_level_a" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_title"
|
||||||
|
android:layout_width="159dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="48dp"
|
||||||
|
android:src="@drawable/anchor_grade_bg_task_text"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diamond"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:text="收礼钻石数:"
|
||||||
|
android:textColor="#8A8CAB"
|
||||||
|
android:textSize="11sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diamond_target_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#F86099"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_diamond"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_diamond" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/pb_diamond"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="260dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="3dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="0"
|
||||||
|
android:progressDrawable="@drawable/anchor_grade_bg_pb"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_diamond" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diamond_curr_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_diamond"
|
||||||
|
tools:text="A" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diamond_gap"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_diamond_curr_level"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_diamond"
|
||||||
|
tools:text="还差3333钻可完成" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_diamond_next_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/pb_diamond"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_diamond"
|
||||||
|
tools:text="S" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_replay"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="23dp"
|
||||||
|
android:text="新用户私聊回复率:"
|
||||||
|
android:textColor="#8A8CAB"
|
||||||
|
android:textSize="11sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pb_diamond" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_replay_target_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#F86099"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_replay"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_replay" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/pb_replay"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="260dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="3dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="0"
|
||||||
|
android:progressDrawable="@drawable/anchor_grade_bg_pb"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_replay" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_replay_curr_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_replay"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/pb_replay"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_replay"
|
||||||
|
tools:text="A" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_replay_gap"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_replay"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_replay_curr_level"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_replay"
|
||||||
|
tools:text="还差3333钻可完成" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_replay_next_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/pb_replay"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/pb_replay"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/pb_replay"
|
||||||
|
tools:text="S" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_update_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="17dp"
|
||||||
|
android:src="@drawable/anchor_grade_bg_update_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pb_replay" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_remaining_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:textColor="#161958"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_update_text"
|
||||||
|
tools:text="时" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
@@ -109,7 +109,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="30dp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/me_item_skill"
|
app:layout_constraintEnd_toStartOf="@id/me_item_skill"
|
||||||
app:layout_constraintHorizontal_bias="0"
|
app:layout_constraintHorizontal_bias="0"
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_head_wear"
|
app:layout_constraintStart_toEndOf="@id/iv_head_wear"
|
||||||
@@ -238,10 +238,28 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_anchor_grade"
|
||||||
|
android:layout_width="95dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:background="@drawable/anchor_grade_bg_me_s"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center_vertical|end"
|
||||||
|
android:paddingEnd="7dp"
|
||||||
|
android:text="主播评级"
|
||||||
|
android:onClick="@{click}"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/me_item_skill"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/me_item_skill"
|
android:id="@+id/me_item_skill"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="28dp"
|
android:layout_height="28dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/shape_white_left_100dp"
|
android:background="@drawable/shape_white_left_100dp"
|
||||||
android:drawableStart="@mipmap/icon_skill_card"
|
android:drawableStart="@mipmap/icon_skill_card"
|
||||||
android:drawablePadding="5dp"
|
android:drawablePadding="5dp"
|
||||||
@@ -253,10 +271,9 @@
|
|||||||
android:text="技能卡"
|
android:text="技能卡"
|
||||||
android:textColor="@color/color_333333"
|
android:textColor="@color/color_333333"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:visibility="gone"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@ import com.mango.core.room.bean.HomeLiveTopInfo
|
|||||||
import com.mango.core.room.bean.MeCenterInfo
|
import com.mango.core.room.bean.MeCenterInfo
|
||||||
import com.mango.core.room.bean.SingleRoomSortInfo
|
import com.mango.core.room.bean.SingleRoomSortInfo
|
||||||
import com.mango.core.room.game.GameInfo
|
import com.mango.core.room.game.GameInfo
|
||||||
|
import com.mango.core.user.bean.AnchorGradeInfo
|
||||||
import com.mango.core.user.bean.UserInfo
|
import com.mango.core.user.bean.UserInfo
|
||||||
import com.mango.core.utils.net.RxHelper
|
import com.mango.core.utils.net.RxHelper
|
||||||
import com.mango.core.utils.net.launchRequest
|
import com.mango.core.utils.net.launchRequest
|
||||||
@@ -180,6 +181,11 @@ object HomeModel : BaseModel() {
|
|||||||
api.requestAnchorInfo()
|
api.requestAnchorInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getAnchorGradeInfo(): AnchorGradeInfo? =
|
||||||
|
launchRequest {
|
||||||
|
api.getAnchorGradeInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +197,7 @@ object HomeModel : BaseModel() {
|
|||||||
* @param ticket
|
* @param ticket
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@POST("/feedback")
|
@POST("feedback")
|
||||||
fun commitFeedback(
|
fun commitFeedback(
|
||||||
@Query("uid") uid: String,
|
@Query("uid") uid: String,
|
||||||
@Query("feedbackDesc") feedbackDesc: String,
|
@Query("feedbackDesc") feedbackDesc: String,
|
||||||
@@ -206,7 +212,7 @@ object HomeModel : BaseModel() {
|
|||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/user/list/new")
|
@GET("user/list/new")
|
||||||
fun loadNewUserList(
|
fun loadNewUserList(
|
||||||
@Query("page") page: String,
|
@Query("page") page: String,
|
||||||
@Query("pageSize") pageSize: String
|
@Query("pageSize") pageSize: String
|
||||||
@@ -230,7 +236,7 @@ object HomeModel : BaseModel() {
|
|||||||
* @param ticket
|
* @param ticket
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/banner")
|
@GET("home/banner")
|
||||||
suspend fun apiHomeBanner(
|
suspend fun apiHomeBanner(
|
||||||
@Query("type") type: String,
|
@Query("type") type: String,
|
||||||
@Query("uid") uid: String,
|
@Query("uid") uid: String,
|
||||||
@@ -243,7 +249,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/hotRoom")
|
@GET("home/hotRoom")
|
||||||
suspend fun getHotRoom(): ServiceResult<List<HomeRoomInfo>>
|
suspend fun getHotRoom(): ServiceResult<List<HomeRoomInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,7 +257,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/currentResource")
|
@GET("home/currentResource")
|
||||||
suspend fun getHomeResource(): ServiceResult<MutableList<ResourceInfo>>
|
suspend fun getHomeResource(): ServiceResult<MutableList<ResourceInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,7 +265,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/pickResource")
|
@GET("home/pickResource")
|
||||||
suspend fun getResourceJumpInfo(@Query("id") id: Int): ServiceResult<HomeRoomInfo>
|
suspend fun getResourceJumpInfo(@Query("id") id: Int): ServiceResult<HomeRoomInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -267,7 +273,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/tab/mapV2")
|
@GET("home/tab/mapV2")
|
||||||
suspend fun getCommonRoom(
|
suspend fun getCommonRoom(
|
||||||
@Query("tabId") tabId: Int,
|
@Query("tabId") tabId: Int,
|
||||||
@Query("pageNum") pageNum: Int,
|
@Query("pageNum") pageNum: Int,
|
||||||
@@ -290,7 +296,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/home/tagV2")
|
@GET("home/tagV2")
|
||||||
suspend fun getHomeTag(): ServiceResult<List<HomeTagInfo>>
|
suspend fun getHomeTag(): ServiceResult<List<HomeTagInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -298,7 +304,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/fans/partTabFollowList")
|
@GET("fans/partTabFollowList")
|
||||||
suspend fun getConcernsRoom(): ServiceResult<List<HomeRoomInfo>>
|
suspend fun getConcernsRoom(): ServiceResult<List<HomeRoomInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,7 +312,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/fans/fansRoomList")
|
@GET("fans/fansRoomList")
|
||||||
suspend fun getCollectRoom(
|
suspend fun getCollectRoom(
|
||||||
@Query("uid") uid: Long,
|
@Query("uid") uid: Long,
|
||||||
@Query("page") pageNum: Int,
|
@Query("page") pageNum: Int,
|
||||||
@@ -326,7 +332,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return -
|
* @return -
|
||||||
*/
|
*/
|
||||||
@GET("/single/broadcast/getMainPopularityAnchorList")
|
@GET("single/broadcast/getMainPopularityAnchorList")
|
||||||
suspend fun getHomeSingleAnchorList(): ServiceResult<List<HomeRoomInfo>>
|
suspend fun getHomeSingleAnchorList(): ServiceResult<List<HomeRoomInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,7 +340,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return -
|
* @return -
|
||||||
*/
|
*/
|
||||||
@GET("/single/broadcast/morePopularityAnchorList")
|
@GET("single/broadcast/morePopularityAnchorList")
|
||||||
suspend fun getMoreSingleAnchorList(@Query("singleRoomSortId") id: Long?): ServiceResult<List<HomeRoomInfo>>
|
suspend fun getMoreSingleAnchorList(@Query("singleRoomSortId") id: Long?): ServiceResult<List<HomeRoomInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,7 +348,7 @@ object HomeModel : BaseModel() {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("/app/bottomBar/getCurrentAppBottomBar")
|
@GET("app/bottomBar/getCurrentAppBottomBar")
|
||||||
suspend fun getMainTabList(): ServiceResult<List<MainTabInfo>>
|
suspend fun getMainTabList(): ServiceResult<List<MainTabInfo>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -369,7 +375,7 @@ object HomeModel : BaseModel() {
|
|||||||
* @param uid
|
* @param uid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@POST("/miniGame/record/miniGameList")
|
@POST("miniGame/record/miniGameList")
|
||||||
suspend fun getGameList(
|
suspend fun getGameList(
|
||||||
): ServiceResult<List<GameInfo>>
|
): ServiceResult<List<GameInfo>>
|
||||||
|
|
||||||
@@ -379,6 +385,12 @@ object HomeModel : BaseModel() {
|
|||||||
*/
|
*/
|
||||||
@GET("user/get/userCard")
|
@GET("user/get/userCard")
|
||||||
suspend fun requestAnchorInfo(): ServiceResult<AnchorInfo>
|
suspend fun requestAnchorInfo(): ServiceResult<AnchorInfo>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST("anchorGrade/get")
|
||||||
|
suspend fun getAnchorGradeInfo(): ServiceResult<AnchorGradeInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.mango.core.user.bean
|
||||||
|
|
||||||
|
data class AnchorGradeInfo(
|
||||||
|
val currentDiamond: Int = 0,
|
||||||
|
val currentReply: Double = 0.0,
|
||||||
|
val grade: String = "D",
|
||||||
|
val nextRemaining: Int = 0,
|
||||||
|
val targetDiamond: Int = 0,
|
||||||
|
val targetReply: Double = 0.0,
|
||||||
|
val uid: Int = 0
|
||||||
|
)
|
@@ -319,23 +319,16 @@ public class TimeUtil {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getElapseTimeForShow(int milliseconds) {
|
public static String getElapseTimeForAnchorGrade(int seconds) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int seconds = milliseconds / 1000;
|
|
||||||
if (seconds < 1)
|
if (seconds < 1)
|
||||||
seconds = 1;
|
seconds = 0;
|
||||||
int hour = seconds / (60 * 60);
|
int hour = seconds / (60 * 60);
|
||||||
if (hour != 0) {
|
sb.append(unitFormat(hour)).append("时");
|
||||||
sb.append(hour).append("小时");
|
|
||||||
}
|
|
||||||
int minute = (seconds - 60 * 60 * hour) / 60;
|
int minute = (seconds - 60 * 60 * hour) / 60;
|
||||||
if (minute != 0) {
|
sb.append(unitFormat(minute)).append("分");
|
||||||
sb.append(minute).append("分");
|
|
||||||
}
|
|
||||||
int second = (seconds - 60 * 60 * hour - 60 * minute);
|
int second = (seconds - 60 * 60 * hour - 60 * minute);
|
||||||
if (second != 0) {
|
sb.append(unitFormat(second)).append("秒");
|
||||||
sb.append(second).append("秒");
|
|
||||||
}
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|