feat:完成我的页面的贵族与公会状态展示
This commit is contained in:
@@ -6,8 +6,11 @@ import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.View.OnLongClickListener
|
||||
import androidx.core.view.allViews
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
@@ -16,6 +19,7 @@ import com.chwl.app.UIHelper
|
||||
import com.chwl.app.application.IReportConstants
|
||||
import com.chwl.app.application.ReportManager
|
||||
import com.chwl.app.avroom.activity.AVRoomActivity
|
||||
import com.chwl.app.avroom.fragment.RoomRankDialogUtils
|
||||
import com.chwl.app.base.BaseActivity
|
||||
import com.chwl.app.base.BaseFragment
|
||||
import com.chwl.app.databinding.FragmentMeBinding
|
||||
@@ -31,6 +35,8 @@ import com.chwl.app.ui.pay.ChargeActivity
|
||||
import com.chwl.app.ui.relation.AttentionListActivity
|
||||
import com.chwl.app.ui.relation.FansListActivity
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||
import com.chwl.app.ui.utils.load
|
||||
import com.chwl.app.ui.utils.loadAvatar
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.app.vip.VipMainActivity
|
||||
import com.chwl.app.vip.VipViewModel
|
||||
@@ -51,6 +57,7 @@ import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.core.user.event.LoginUserInfoUpdateEvent
|
||||
import com.chwl.core.utils.CoreLogger
|
||||
import com.chwl.core.utils.StarUtils
|
||||
import com.chwl.core.vip.bean.VipInfo
|
||||
import com.chwl.library.common.util.DeviceUtil
|
||||
import com.chwl.library.utils.FormatUtils
|
||||
import com.example.lib_utils.ktx.singleClick
|
||||
@@ -127,6 +134,10 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
OpenRoomHelper.openRoom(mContext as BaseActivity, RoomInfo.ROOMTYPE_GAME, it)
|
||||
}
|
||||
}
|
||||
|
||||
vipViewModel.myVipInfoLiveData.observe(viewLifecycleOwner) {
|
||||
loadVipInfo(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCenterData(list: List<MeCenterInfo>?) {
|
||||
@@ -228,7 +239,12 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
if ((clanAndHallInfo?.clan?.elderUid ?: 0L) > 0 || (clanAndHallInfo?.hall?.ownerUid
|
||||
?: 0L) > 0
|
||||
) {
|
||||
mBinding.ivAssociation.singleClick {
|
||||
if ((clanAndHallInfo?.clan?.elderUid ?: 0L) > 0) {
|
||||
mBinding.ivAssociation.loadAvatar(clanAndHallInfo?.clan?.avatar)
|
||||
} else if ((clanAndHallInfo?.hall?.ownerUid ?: 0L) > 0) {
|
||||
mBinding.ivAssociation.loadAvatar(clanAndHallInfo?.hall?.ownerAvatar)
|
||||
}
|
||||
mBinding.layoutAssociation.singleClick {
|
||||
if ((clanAndHallInfo?.clan?.elderUid ?: 0L) > 0) {
|
||||
ModuleClanActivity.start(context, clanAndHallInfo?.clan?.elderUid ?: 0L)
|
||||
} else if ((clanAndHallInfo?.hall?.ownerUid ?: 0L) > 0) {
|
||||
@@ -239,11 +255,15 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
)
|
||||
}
|
||||
}
|
||||
mBinding.layoutAssociation.setBackgroundResource(R.drawable.me_bg_association)
|
||||
mBinding.groupAssociation.isVisible = true
|
||||
} else {
|
||||
mBinding.ivAssociation.singleClick {
|
||||
mBinding.layoutAssociation.singleClick {
|
||||
//公會周榜
|
||||
context?.let { it1 -> AssociationActivity.start(it1) }
|
||||
}
|
||||
mBinding.layoutAssociation.setBackgroundResource(R.drawable.me_bg_association_not)
|
||||
mBinding.groupAssociation.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +317,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
jumpChargePage()
|
||||
}
|
||||
|
||||
R.id.iv_vip -> {
|
||||
R.id.layout_vip -> {
|
||||
VipMainActivity.start(mContext)
|
||||
//进入贵族中心埋点
|
||||
val goldWalletInfo = PayModel.get().currentWalletInfo
|
||||
@@ -330,9 +350,26 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
// )
|
||||
// }, {
|
||||
// toast(it.message)
|
||||
ChargeActivity.start(mContext)
|
||||
ChargeActivity.start(mContext)
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
private fun loadVipInfo(data: VipInfo?) {
|
||||
data?.let {
|
||||
mBinding.ivVipIcon.load(it.vipIcon)
|
||||
mBinding.tvVipName.text = it.vipName
|
||||
mBinding.tvVipTips.text =
|
||||
"${getString(R.string.me_short)}${RoomRankDialogUtils.getRoomRankValueText(it.levelUpScore - it.currScore)}${
|
||||
getString(R.string.me_power_value_escalation)
|
||||
}"
|
||||
mBinding.progressVip.max = it.levelUpScore
|
||||
mBinding.progressVip.progress = it.currScore.coerceAtMost(it.levelUpScore)
|
||||
mBinding.layoutVip.setBackgroundResource(R.drawable.me_bg_vip)
|
||||
mBinding.groupVip.isVisible = true
|
||||
} ?: run {
|
||||
mBinding.layoutVip.setBackgroundResource(R.drawable.me_bg_vip_not)
|
||||
mBinding.groupVip.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xxhdpi/me_bg_association.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/me_bg_association.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
BIN
app/src/main/res/drawable-xxhdpi/me_bg_vip.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/me_bg_vip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@@ -3,16 +3,16 @@
|
||||
<!-- 定义轨道的背景 -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#8770DC"/>
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
<solid android:color="#F3DCA3"/>
|
||||
<corners android:radius="@dimen/dp_6" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 定义轨道上已完成部分的样式 -->
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white"/>
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
<solid android:color="#FFBD3E"/>
|
||||
<corners android:radius="@dimen/dp_6" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
|
@@ -350,29 +350,174 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_vip"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_vip"
|
||||
android:onClick="@{click}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/me_bg_vip"
|
||||
android:background="@drawable/me_bg_vip_not"
|
||||
app:layout_constraintDimensionRatio="152:89"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_association"
|
||||
app:layout_constraintEnd_toStartOf="@id/layout_association"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_wallet"
|
||||
app:layout_constraintWidth_percent="0.405" />
|
||||
app:layout_constraintWidth_percent="0.405"
|
||||
tools:background="@drawable/me_bg_vip">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_association"
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_content_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.94" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_vip_icon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toTopOf="@id/progress_vip"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_vip_name"
|
||||
app:layout_constraintHeight_percent="0.45"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:background="@drawable/default_cover" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#6D381A"
|
||||
android:textSize="@dimen/dp_14"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_vip_icon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_vip_icon"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_vip_icon"
|
||||
tools:text="Name" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_vip"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/bg_me_vip_seek_bar"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_vip_tips"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_vip_icon"
|
||||
app:layout_constraintWidth_percent="0.63"
|
||||
tools:progress="50" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:textColor="#8A593D"
|
||||
android:textSize="@dimen/dp_9"
|
||||
app:layout_constraintBottom_toTopOf="@id/line_content_end"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/progress_vip"
|
||||
tools:text="Tips" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_vip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="iv_vip_icon,tv_vip_name,tv_vip_tips,progress_vip"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_association"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/me_bg_association"
|
||||
android:background="@drawable/me_bg_association_not"
|
||||
app:layout_constraintDimensionRatio="152:89"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_vip"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_vip"
|
||||
app:layout_constraintWidth_percent="0.405" />
|
||||
app:layout_constraintStart_toEndOf="@id/layout_vip"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_vip"
|
||||
app:layout_constraintWidth_percent="0.405"
|
||||
tools:background="@drawable/me_bg_association">
|
||||
|
||||
<com.chwl.app.common.widget.RectRoundImageView
|
||||
android:id="@+id/iv_association"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_association_1"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.42"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:type="circle"
|
||||
tools:src="@drawable/default_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_association_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:text="公會"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/v_association_dot"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_association" />
|
||||
|
||||
<com.chwl.app.common.widget.RectRoundImageView
|
||||
android:id="@+id/v_association_dot"
|
||||
android:layout_width="@dimen/dp_3"
|
||||
android:layout_height="@dimen/dp_3"
|
||||
android:layout_marginHorizontal="@dimen/dp_4"
|
||||
android:background="#602175"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_association_1"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_association_2"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_association_1"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_association_1"
|
||||
app:type="circle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_association_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="房間"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_association_1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/v_association_dot"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_association_1" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_association"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="iv_association,tv_association_1,tv_association_2,v_association_dot"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -381,7 +526,7 @@
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:background="@drawable/base_shape_ffffff_12dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_vip">
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_vip">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
Reference in New Issue
Block a user