feat:初步移植piko的新版贵族中心(返利+购买)
@@ -29,4 +29,6 @@ public interface IPagerNavigator {
|
||||
* ViewPager内容改变时需要先调用此方法,自定义的IPagerNavigator应当遵守此约定
|
||||
*/
|
||||
void notifyDataSetChanged();
|
||||
|
||||
int getCurrentIndex();
|
||||
}
|
||||
|
@@ -303,6 +303,11 @@ public class CircleNavigator extends View implements IPagerNavigator {
|
||||
mCircleClickListener = circleClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentIndex() {
|
||||
return mCurrentIndex;
|
||||
}
|
||||
|
||||
public interface OnCircleClickListener {
|
||||
void onClick(int index);
|
||||
}
|
||||
|
@@ -483,6 +483,11 @@ public class CommonNavigator extends FrameLayout implements IPagerNavigator, Nav
|
||||
mScrollView.setFadingEdgeLength(fadingLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentIndex() {
|
||||
return mNavigatorHelper.getCurrentIndex();
|
||||
}
|
||||
|
||||
public interface NavigatorSelectedListener {
|
||||
void navigatorSelected(int position);
|
||||
}
|
||||
|
@@ -9,8 +9,10 @@ import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.activity.viewModels
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.example.module_base.support.billing.IBillingResult
|
||||
import com.example.module_base.support.billing.IBillingService
|
||||
@@ -34,6 +36,7 @@ import com.chwl.app.ui.utils.RVDelegate
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.chwl.app.vip.adapter.VipAuthAdapter
|
||||
import com.chwl.app.vip.adapter.VipMagicIndicatorAdapter
|
||||
import com.chwl.app.vip.adapter.VipRebateAdapter
|
||||
import com.chwl.app.vip.dialog.SelectPayTypeDialog
|
||||
import com.chwl.app.vip.dialog.VipRemainTimeDialog
|
||||
import com.chwl.core.auth.AuthModel
|
||||
@@ -46,6 +49,8 @@ import com.chwl.core.vip.bean.VipInfo
|
||||
import com.chwl.core.utils.extension.toast
|
||||
import com.chwl.core.vip.VipOpenEvent
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -71,14 +76,16 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
private lateinit var rvDelegate: RVDelegate<VipAuthInfo>
|
||||
private val vipViewModel: VipViewModel by viewModels()
|
||||
private var billingManager: IBillingService? = null
|
||||
private var googleChargeBean: ChargeBean? = null//google
|
||||
private var chargeInfo: ChargeBean? = null//official
|
||||
private var currentChargeInfo: ChargeBean? = null
|
||||
private var chargeList: List<ChargeBean>? = null
|
||||
private val rebateAdapter = VipRebateAdapter()
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun init() {
|
||||
EventBus.getDefault().register(this)
|
||||
initWhiteTitleBar(getString(R.string.vip_center))
|
||||
|
||||
initView()
|
||||
initObserve()
|
||||
binding.ivTimeHelp.setOnClickListener {
|
||||
VipRemainTimeDialog.newInstance().show(this)
|
||||
}
|
||||
@@ -118,8 +125,8 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
|
||||
vipViewModel.myVipInfoLiveData.observe(this) {
|
||||
it?.let {
|
||||
binding.llMyVipInfo.isVisible = true
|
||||
binding.tvOpenVip.isVisible = false
|
||||
binding.layoutLevelInfo.isVisible = true
|
||||
binding.layoutLevelProgress.isVisible = true
|
||||
binding.tvNotOpen.text =
|
||||
"${getString(R.string.me_current_power_value)}${it.currScore}"
|
||||
binding.tvCurrValue.text = "${getString(R.string.me_current)}${it.currScore}"
|
||||
@@ -161,11 +168,10 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
}
|
||||
|
||||
} ?: run {
|
||||
binding.llMyVipInfo.isVisible = false
|
||||
binding.tvOpenVip.isVisible = true
|
||||
binding.layoutLevelInfo.isVisible = false
|
||||
binding.layoutLevelProgress.isVisible = false
|
||||
binding.slAuth.isVisible = true
|
||||
binding.tvNotOpen.text = getString(R.string.me_no_aristocracy_yet)
|
||||
initBilling()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,10 +180,12 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
if (it.comingSoon == 2) {
|
||||
binding.llNotOpen.isVisible = true
|
||||
binding.slAuth.isVisible = false
|
||||
binding.layoutBottomPanel.isVisible = false
|
||||
loadSVGA(binding.ivNotOpenIcon, it.vipLogo)
|
||||
} else {
|
||||
binding.slAuth.isVisible = true
|
||||
binding.llNotOpen.isVisible = false
|
||||
binding.layoutBottomPanel.isVisible = true
|
||||
val myVipInfo = vipViewModel.myVipInfoLiveData.value
|
||||
binding.ivMyLevel.isInvisible = it.vipLevel != myVipInfo?.vipLevel
|
||||
binding.tvNotOpen.isInvisible =
|
||||
@@ -187,6 +195,8 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
"${it.ownAuthTypes?.size ?: 0}/${vipViewModel.authInfosLiveData.value?.size ?: 0}"
|
||||
authAdapter.setVipInfo(it)
|
||||
authAdapter.notifyDataSetChanged()
|
||||
loadRebateData(it)
|
||||
refreshOpenVipState()
|
||||
}
|
||||
} ?: run {
|
||||
getString(R.string.me_failed_to_get_aristocrat_data).toast()
|
||||
@@ -203,60 +213,12 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
}
|
||||
|
||||
binding.tvOpenVip.setOnClickListener {
|
||||
if ((googleChargeBean?.productDetails?.getOneTimePurchaseOfferDetails()
|
||||
?.getPriceAmountMicros() ?: "0") == "0"
|
||||
) {
|
||||
toast(getString(R.string.Recharge_failure))
|
||||
return@setOnClickListener
|
||||
}
|
||||
SelectPayTypeDialog.newInstance(
|
||||
googleChargeBean?.productDetails?.getOneTimePurchaseOfferDetails()
|
||||
?.getFormattedPrice() ?: "0",
|
||||
true,
|
||||
googleChargeBean?.getMoney() ?: 0.0
|
||||
)
|
||||
.apply {
|
||||
setOnDiamondChargeClick {
|
||||
vipViewModel.openVipWithDiamond()
|
||||
}
|
||||
setOnGoogleChargeClick {
|
||||
googleChargeBean?.let { charge ->
|
||||
buyProduct(charge.productDetails)
|
||||
}
|
||||
}
|
||||
setOnChargeClick {
|
||||
// if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
|
||||
ChargeActivity.start(this@VipMainActivity)
|
||||
// } else {
|
||||
// CommonWebViewActivity.start(
|
||||
// this@VipMainActivity, UriProvider.getOfficialPay(
|
||||
// 4,
|
||||
// DeviceUtil.getDeviceId(this@VipMainActivity)
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
}
|
||||
}
|
||||
.show(context)
|
||||
|
||||
checkBuyVip {
|
||||
buyVip()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
private fun loadData() {
|
||||
PayModel.get().getChargeList(2, AuthModel.get().currentUid)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(
|
||||
{
|
||||
chargeInfo = it.list.getOrNull(0)
|
||||
chargeInfo?.let { chargeBean ->
|
||||
binding.tvOpenVip.text =
|
||||
"${chargeBean.getMoney()}${getString(R.string.me_immediately_become_a_nobleman)}"
|
||||
}
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
}
|
||||
)
|
||||
initBilling()
|
||||
}
|
||||
|
||||
private fun initBilling() {
|
||||
@@ -279,17 +241,13 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
* 初始化推荐和派对tab
|
||||
*/
|
||||
private fun initTitleTab(vipInfos: List<VipInfo>) {
|
||||
val tagList: MutableList<String> = ArrayList()
|
||||
vipInfos.forEach {
|
||||
tagList.add(it.vipName)
|
||||
}
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.isEnablePivotScroll = true
|
||||
commonNavigator.isFollowTouch = false
|
||||
val magicIndicatorAdapter =
|
||||
VipMagicIndicatorAdapter(
|
||||
context,
|
||||
tagList
|
||||
vipInfos
|
||||
)
|
||||
magicIndicatorAdapter.setOnItemSelectListener(this)
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
@@ -337,45 +295,40 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
override fun onBillingClientSetupFinished() {
|
||||
Log.i(TAG, "onBillingClientSetupFinished")
|
||||
PayModel.get().getChargeList(2, AuthModel.get().currentUid)
|
||||
PayModel.get().vipList
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(
|
||||
{
|
||||
val chargeInfo = it.list.getOrNull(0)
|
||||
chargeInfo?.let { chargeBean ->
|
||||
val productKeys: MutableList<String> = ArrayList()
|
||||
productKeys.add(chargeBean.getChargeProdId())
|
||||
billingManager?.querySkuDetailsAsync(productKeys,
|
||||
object : IBillingService.ProductDetailsResponseListener {
|
||||
override fun onProductDetailsResponse(
|
||||
billingResult: IBillingResult,
|
||||
productDetails: List<IProductDetails>
|
||||
) {
|
||||
if (!billingResult.isResponseOk()) {
|
||||
Log.w(
|
||||
TAG,
|
||||
"Unsuccessful query for Error code: " + billingResult.getResponseCode()
|
||||
)
|
||||
} else if (productDetails.isNotEmpty()) {
|
||||
val showChargeList: MutableList<ChargeBean> = ArrayList()
|
||||
val list = it
|
||||
loadChargeList(list)
|
||||
val productKeys = ArrayList<String>()
|
||||
list.forEach {
|
||||
productKeys.add(it.getChargeProdId())
|
||||
}
|
||||
billingManager?.querySkuDetailsAsync(productKeys,
|
||||
object : IBillingService.ProductDetailsResponseListener {
|
||||
override fun onProductDetailsResponse(
|
||||
billingResult: IBillingResult,
|
||||
productDetails: List<IProductDetails>
|
||||
) {
|
||||
if (!billingResult.isResponseOk()) {
|
||||
Log.w(
|
||||
TAG,
|
||||
"Unsuccessful query for Error code: " + billingResult.getResponseCode()
|
||||
)
|
||||
} else if (productDetails.isNotEmpty()) {
|
||||
for (item in list) {
|
||||
for (skuDetails in productDetails) {
|
||||
if (skuDetails.getProductId() == chargeBean.getChargeProdId()) {
|
||||
chargeBean.productDetails = skuDetails
|
||||
showChargeList.add(chargeBean)
|
||||
if (skuDetails.getProductId() == item.getChargeProdId()) {
|
||||
item.productDetails = skuDetails
|
||||
break
|
||||
}
|
||||
}
|
||||
if (showChargeList.size > 0) {
|
||||
googleChargeBean = showChargeList[0]
|
||||
binding.tvOpenVip.text = "${
|
||||
googleChargeBean?.getMoney()
|
||||
}${getString(R.string.me_immediately_become_a_nobleman)}"
|
||||
}
|
||||
}
|
||||
loadChargeList(list)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
}
|
||||
@@ -484,8 +437,7 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
billingManager?.destroy()
|
||||
googleChargeBean = null
|
||||
chargeInfo = null
|
||||
currentChargeInfo = null
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
@@ -500,4 +452,137 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
}
|
||||
|
||||
|
||||
private fun initView() {
|
||||
binding.tvTabPrivilege.setOnClickListener {
|
||||
showPrivilegeTab()
|
||||
}
|
||||
binding.tvTabRebate.setOnClickListener {
|
||||
showRebateTab()
|
||||
}
|
||||
rebateAdapter.onGetListener = {
|
||||
vipViewModel.getVipRebate(it)
|
||||
}
|
||||
binding.rvRebate.isNestedScrollingEnabled = false
|
||||
binding.rvRebate.adapter = rebateAdapter
|
||||
}
|
||||
|
||||
private fun initObserve(){
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
vipViewModel.getVipRebateSuccessFlow.collect {
|
||||
rebateAdapter.notifyItemRangeChanged(0, rebateAdapter.itemCount, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showPrivilegeTab() {
|
||||
binding.layoutRebate.isInvisible = true
|
||||
binding.groupPrivilege.isInvisible = false
|
||||
binding.tvTabPrivilege.setBackgroundResource(R.drawable.vip_bg_tab_selected)
|
||||
binding.tvTabRebate.setBackgroundResource(R.drawable.vip_bg_tab_unselected)
|
||||
}
|
||||
|
||||
private fun showRebateTab() {
|
||||
binding.groupPrivilege.isInvisible = true
|
||||
binding.layoutRebate.isInvisible = false
|
||||
binding.tvTabPrivilege.setBackgroundResource(R.drawable.vip_bg_tab_unselected)
|
||||
binding.tvTabRebate.setBackgroundResource(R.drawable.vip_bg_tab_selected)
|
||||
}
|
||||
|
||||
private fun loadChargeList(list: List<ChargeBean>) {
|
||||
this.chargeList = list
|
||||
refreshOpenVipState()
|
||||
}
|
||||
|
||||
private fun loadRebateData(info: VipInfo) {
|
||||
binding.tvTableLevelName.text = info.vipName
|
||||
binding.tvRebateTips1.text =
|
||||
context.getString(R.string.vip_buy_tips_format).format(info.vipName)
|
||||
rebateAdapter.setNewData(info.returnProfits)
|
||||
val isNormalStatus = info.isRebate()
|
||||
binding.layoutRebate.children.forEach {
|
||||
if(it == binding.tvRebateDisableStatus){
|
||||
it.isVisible = !isNormalStatus
|
||||
}else{
|
||||
it.isVisible = isNormalStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshOpenVipState() {
|
||||
val currentVipInfo = vipViewModel.currVipInfoLiveData.value
|
||||
val myVipInfo = vipViewModel.myVipInfoLiveData.value
|
||||
if (currentVipInfo != null) {
|
||||
currentChargeInfo = chargeList?.firstOrNull {
|
||||
it.prodDesc.toIntOrNull() == currentVipInfo.vipLevel
|
||||
}
|
||||
if (currentChargeInfo != null && (myVipInfo == null || myVipInfo.vipLevel < currentVipInfo.vipLevel)) {
|
||||
binding.tvOpenVip.text =
|
||||
"${currentChargeInfo?.getMoney()} ${
|
||||
getString(R.string.vip_buy_format).format(
|
||||
currentVipInfo.vipName
|
||||
)
|
||||
}"
|
||||
binding.tvOpenVip.isVisible = true
|
||||
} else {
|
||||
binding.tvOpenVip.isVisible = false
|
||||
}
|
||||
} else {
|
||||
currentChargeInfo = null
|
||||
binding.tvOpenVip.isVisible = false
|
||||
}
|
||||
if (binding.tvOpenVip.isVisible && binding.layoutLevelProgress.isVisible) {
|
||||
binding.layoutBottomPanel.setBackgroundDrawable(binding.layoutLevelProgress.background)
|
||||
} else {
|
||||
binding.layoutBottomPanel.setBackgroundDrawable(null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkBuyVip(block: () -> Unit) {
|
||||
val myVipInfo = vipViewModel.myVipInfoLiveData.value
|
||||
val currentVipInfo = vipViewModel.currVipInfoLiveData.value
|
||||
if (currentVipInfo != null && myVipInfo != null && currentVipInfo.vipLevel > myVipInfo.vipLevel) {
|
||||
val message = context.getString(R.string.vip_buy_tips).format(
|
||||
myVipInfo.vipName,currentVipInfo.vipName
|
||||
)
|
||||
dialogManager.showOkCancelDialog(message,
|
||||
context.getString(R.string.miniworld_activity_mwteamroommessageact_07),
|
||||
context.getString(R.string.miniworld_activity_mwteamroommessageact_08),
|
||||
true
|
||||
) { block.invoke() }
|
||||
} else {
|
||||
block.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
private fun buyVip() {
|
||||
if ((currentChargeInfo?.productDetails?.getOneTimePurchaseOfferDetails()
|
||||
?.getPriceAmountMicros()
|
||||
?: "0") == "0"
|
||||
) {
|
||||
toast(getString(R.string.Recharge_failure))
|
||||
return
|
||||
}
|
||||
SelectPayTypeDialog.newInstance(
|
||||
currentChargeInfo?.productDetails?.getOneTimePurchaseOfferDetails()?.getFormattedPrice()
|
||||
?: "0",
|
||||
true,
|
||||
currentChargeInfo?.getMoney() ?: 0.0
|
||||
)
|
||||
.apply {
|
||||
setOnDiamondChargeClick {
|
||||
vipViewModel.openVipWithDiamond(
|
||||
currentChargeInfo?.getProdDesc()?.toIntOrNull() ?: -1
|
||||
)
|
||||
}
|
||||
setOnGoogleChargeClick {
|
||||
currentChargeInfo?.let { charge ->
|
||||
buyProduct(charge.productDetails)
|
||||
}
|
||||
}
|
||||
setOnChargeClick {
|
||||
ChargeActivity.start(this@VipMainActivity)
|
||||
}
|
||||
}
|
||||
.show(context)
|
||||
}
|
||||
}
|
@@ -12,7 +12,9 @@ import com.chwl.core.vip.bean.VipBroadcastInfo
|
||||
import com.chwl.core.vip.bean.VipInfo
|
||||
import com.chwl.core.utils.extension.toast
|
||||
import com.chwl.core.vip.VipModel
|
||||
import com.chwl.core.vip.bean.VipRebateInfo
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
|
||||
class VipViewModel : BaseViewModel() {
|
||||
val userId: Long by lazy {
|
||||
@@ -46,6 +48,8 @@ class VipViewModel : BaseViewModel() {
|
||||
private val _enterHideLiveData = MutableLiveData<Boolean>()
|
||||
val enterHideLiveData: LiveData<Boolean> = _enterHideLiveData
|
||||
|
||||
val getVipRebateSuccessFlow = MutableSharedFlow<VipRebateInfo>()
|
||||
|
||||
// private val _sendBroadcastLiveData = MutableLiveData<Boolean>()
|
||||
// val sendBroadcastLiveData: LiveData<Boolean> = _sendBroadcastLiveData
|
||||
|
||||
@@ -164,9 +168,17 @@ class VipViewModel : BaseViewModel() {
|
||||
_pageLiveData.value = position
|
||||
}
|
||||
|
||||
fun openVipWithDiamond() {
|
||||
fun openVipWithDiamond(vipLevel: Int) {
|
||||
safeLaunch(true) {
|
||||
VipModel.openVipWithDiamond()
|
||||
VipModel.openVipWithDiamond(vipLevel)
|
||||
}
|
||||
}
|
||||
|
||||
fun getVipRebate(rebateInfo: VipRebateInfo) {
|
||||
safeLaunch(true) {
|
||||
VipModel.getVipRebate(rebateInfo.returnProfitRecordId ?: 0L)
|
||||
rebateInfo.isReceive = true
|
||||
getVipRebateSuccessFlow.emit(rebateInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,19 +13,21 @@ import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.Common
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import com.chwl.app.vip.view.VipTabView;
|
||||
import com.chwl.core.vip.bean.VipInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VipMagicIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
private final Context mContext;
|
||||
private final List<? extends CharSequence> mTitleList;
|
||||
private final List<VipInfo> mTitleList;
|
||||
|
||||
private int textSize = 15;
|
||||
private float minScale = 1f;
|
||||
private boolean showIndicator = true;
|
||||
private OnItemSelectListener mOnItemSelectListener;
|
||||
|
||||
public VipMagicIndicatorAdapter(Context context, List<? extends CharSequence> charSequences) {
|
||||
public VipMagicIndicatorAdapter(Context context, List<VipInfo> charSequences) {
|
||||
this.mContext = context;
|
||||
this.mTitleList = charSequences;
|
||||
}
|
||||
@@ -37,22 +39,15 @@ public class VipMagicIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int i) {
|
||||
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
|
||||
scaleTransitionPagerTitleView.setNormalColor(Color.parseColor("#FFBC9E66"));
|
||||
scaleTransitionPagerTitleView.setSelectedColor(Color.parseColor("#FFFFE3AF"));
|
||||
scaleTransitionPagerTitleView.setMinScale(minScale);
|
||||
scaleTransitionPagerTitleView.setTextSize(textSize);
|
||||
scaleTransitionPagerTitleView.setGravity(Gravity.START);
|
||||
int padding = UIUtil.dip2px(context, 12);
|
||||
scaleTransitionPagerTitleView.setPadding(padding, 0, padding, 0);
|
||||
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
|
||||
scaleTransitionPagerTitleView.setOnClickListener(view -> {
|
||||
VipTabView tabView = new VipTabView(context);
|
||||
VipInfo item = mTitleList.get(i);
|
||||
tabView.setData(item.getVipName(), item.isRebate());
|
||||
tabView.setOnClickListener(view -> {
|
||||
if (mOnItemSelectListener != null) {
|
||||
mOnItemSelectListener.onItemSelect(i, scaleTransitionPagerTitleView);
|
||||
mOnItemSelectListener.onItemSelect(i, tabView.getTextView());
|
||||
}
|
||||
|
||||
});
|
||||
return scaleTransitionPagerTitleView;
|
||||
return tabView;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,68 @@
|
||||
package com.chwl.app.vip.adapter
|
||||
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.chwl.app.R
|
||||
import com.chwl.core.vip.bean.VipRebateInfo
|
||||
import com.example.lib_utils.ktx.getColorById
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/3/28 11:19
|
||||
* Desc:
|
||||
**/
|
||||
class VipRebateAdapter : BaseQuickAdapter<VipRebateInfo, BaseViewHolder>(R.layout.item_vip_rebate) {
|
||||
|
||||
var onGetListener: ((VipRebateInfo) -> Unit)? = null
|
||||
|
||||
override fun convertPayloads(
|
||||
helper: BaseViewHolder,
|
||||
item: VipRebateInfo,
|
||||
payloads: MutableList<Any>
|
||||
) {
|
||||
super.convertPayloads(helper, item, payloads)
|
||||
convertStatus(helper, item)
|
||||
}
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: VipRebateInfo) {
|
||||
if (item.profitDate == 0L) {
|
||||
helper.setText(
|
||||
R.id.tv_date, R.string.vip_rebate_now
|
||||
)
|
||||
} else {
|
||||
helper.setText(
|
||||
R.id.tv_date,
|
||||
helper.itemView.context.getString(R.string.vip_rebate_day_format)
|
||||
.format("${item.profitDate}")
|
||||
)
|
||||
}
|
||||
helper.setText(R.id.tv_num, "${item.profitAmount}")
|
||||
convertStatus(helper, item)
|
||||
helper.getView<View>(R.id.v_line).isVisible =
|
||||
(helper.absoluteAdapterPosition != itemCount - 1)
|
||||
}
|
||||
|
||||
private fun convertStatus(helper: BaseViewHolder, item: VipRebateInfo) {
|
||||
val statusView = helper.getView<TextView>(R.id.tv_status)
|
||||
val statusLayout = helper.getView<View>(R.id.layout_status)
|
||||
statusLayout.setOnClickListener(null)
|
||||
if (item.isReceive == true) {
|
||||
statusView.setBackgroundResource(R.drawable.shape_47ffffff_9dp)
|
||||
statusView.setTextColor(statusView.context.getColorById(R.color.color_B3B3C3))
|
||||
statusView.setText(R.string.vip_rebate_received)
|
||||
} else if (item.isReach == true) {
|
||||
statusView.setBackgroundResource(R.drawable.shape_f6ad3f_9dp)
|
||||
statusView.setTextColor(statusView.context.getColorById(R.color.color_white))
|
||||
statusView.setText(R.string.vip_rebate_get)
|
||||
statusLayout.setOnClickListener {
|
||||
onGetListener?.invoke(item)
|
||||
}
|
||||
} else {
|
||||
statusView.setBackgroundResource(R.drawable.shape_726041_9dp)
|
||||
statusView.setTextColor(statusView.context.getColorById(R.color.color_white))
|
||||
statusView.setText(R.string.vip_rebate_no_get)
|
||||
}
|
||||
}
|
||||
}
|
48
app/src/main/java/com/chwl/app/vip/view/VipTabView.kt
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.chwl.app.vip.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isInvisible
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/3/28 17:05
|
||||
* Desc:
|
||||
**/
|
||||
class VipTabView(context: Context) : ConstraintLayout(context), IPagerTitleView {
|
||||
|
||||
val textView: TextView
|
||||
private val rebateView: View
|
||||
private var selectedColor = Color.parseColor("#FFBC9E66")
|
||||
private var normalColor = Color.parseColor("#FFFFE3AF")
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.vip_tab_item, this)
|
||||
textView = findViewById(R.id.tv_title)
|
||||
rebateView = findViewById(R.id.iv_rebate)
|
||||
}
|
||||
|
||||
override fun onSelected(index: Int, totalCount: Int) {
|
||||
textView.setTextColor(selectedColor)
|
||||
}
|
||||
|
||||
override fun onDeselected(index: Int, totalCount: Int) {
|
||||
textView.setTextColor(normalColor)
|
||||
}
|
||||
|
||||
override fun onLeave(index: Int, totalCount: Int, leavePercent: Float, leftToRight: Boolean) {
|
||||
}
|
||||
|
||||
override fun onEnter(index: Int, totalCount: Int, enterPercent: Float, leftToRight: Boolean) {
|
||||
}
|
||||
|
||||
fun setData(title: CharSequence, isRebate: Boolean) {
|
||||
textView.text = title
|
||||
rebateView.isInvisible = !isRebate
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 151 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_bg_bottom.9.png
Normal file
After Width: | Height: | Size: 357 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_bg_tab_selected.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_bg_tab_unselected.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_ic_rebate.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_ic_tab_line_left.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/vip_ic_tab_line_right.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
9
app/src/main/res/drawable/shape_47ffffff_9dp.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="9dp" />
|
||||
|
||||
<solid android:color="#47FFFFFF" />
|
||||
|
||||
</shape>
|
9
app/src/main/res/drawable/shape_726041_9dp.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="9dp" />
|
||||
|
||||
<solid android:color="#726041" />
|
||||
|
||||
</shape>
|
7
app/src/main/res/drawable/shape_f6ad3f_9dp.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="9dp"/>
|
||||
<solid android:color="#F6AD3F"/>
|
||||
</shape>
|
13
app/src/main/res/drawable/vip_bg_cloumn_first.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#1AFFAA36" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="0px"
|
||||
android:bottomRightRadius="0px"
|
||||
android:topLeftRadius="6dp"
|
||||
android:topRightRadius="0px" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/vip_bg_cloumn_last.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#1AFFAA36" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="0px"
|
||||
android:bottomRightRadius="0px"
|
||||
android:topLeftRadius="0px"
|
||||
android:topRightRadius="6dp" />
|
||||
|
||||
</shape>
|
10
app/src/main/res/drawable/vip_bg_rebate_table.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:width="@dimen/dp_1"
|
||||
android:color="#33FFAA36" />
|
||||
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
70
app/src/main/res/layout/item_vip_rebate.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@dimen/dp_24"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textColor="#BC9E66"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_num"
|
||||
app:layout_constraintHorizontal_weight="78"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="Name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_num"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textColor="#BC9E66"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintEnd_toStartOf="@id/layout_operation"
|
||||
app:layout_constraintHorizontal_weight="97"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_date"
|
||||
tools:text="Name" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_operation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_weight="102"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_num">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:paddingHorizontal="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_13"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/shape_f6ad3f_9dp"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="@dimen/dp_8"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_8"
|
||||
tools:text="Name" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/v_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:background="#33FFAA36"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:visibility="visible" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
29
app/src/main/res/layout/vip_tab_item.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge 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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:textColor="#FFFFE3AF"
|
||||
android:textSize="@dimen/dp_15"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="Name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_rebate"
|
||||
android:layout_width="@dimen/dp_41"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:src="@drawable/vip_ic_rebate"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_title"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_title" />
|
||||
</merge>
|
@@ -5217,4 +5217,23 @@
|
||||
<string name="me_setting">設置</string>
|
||||
|
||||
<string name="all_mic">送全麦</string>
|
||||
|
||||
|
||||
<string name="vip_privilege">贵族特權</string>
|
||||
<string name="vip_rebate">返钻特權</string>
|
||||
<string name="vip_buy_tips_format">用戶直接購買%s等級,除了直接享有等級對應的所有特權,還能獲得額外返鑽。</string>
|
||||
<string name="vip_rebate_tips">具體返利日期以及返利鑽石數量如下:</string>
|
||||
<string name="vip_level_name">等級名稱</string>
|
||||
<string name="vip_rebate_date">返利日期</string>
|
||||
<string name="vip_rebate_number">返利鑽石數量</string>
|
||||
<string name="vip_rebate_operation">操作</string>
|
||||
<string name="vip_rebate_tips2">注:\n返利鑽石需在貴族開通後30天內領取完畢,逾期失效 領取後的返利鑽石可到【我的-收益記錄-鑽石明細-收入記錄】中查看。</string>
|
||||
<string name="vip_rebate_day_format">第%s天</string>
|
||||
<string name="vip_rebate_get">領取</string>
|
||||
<string name="vip_rebate_received">已領取</string>
|
||||
<string name="vip_rebate_no_get">未達到領取標準</string>
|
||||
<string name="vip_rebate_disable">當前等級不享有該特權~</string>
|
||||
<string name="vip_rebate_now">立即返利</string>
|
||||
<string name="vip_buy_tips">您當前是%s等級,確認購買更高%s等級?</string>
|
||||
<string name="vip_buy_format">購買%s等級特權</string>
|
||||
</resources>
|
@@ -5216,4 +5216,23 @@
|
||||
<string name="my_collection">我的收藏</string>
|
||||
<string name="me_setting">設置</string>
|
||||
<string name="all_mic">送全麦</string>
|
||||
|
||||
|
||||
<string name="vip_privilege">贵族特權</string>
|
||||
<string name="vip_rebate">返钻特權</string>
|
||||
<string name="vip_buy_tips_format">用戶直接購買%s等級,除了直接享有等級對應的所有特權,還能獲得額外返鑽。</string>
|
||||
<string name="vip_rebate_tips">具體返利日期以及返利鑽石數量如下:</string>
|
||||
<string name="vip_level_name">等級名稱</string>
|
||||
<string name="vip_rebate_date">返利日期</string>
|
||||
<string name="vip_rebate_number">返利鑽石數量</string>
|
||||
<string name="vip_rebate_operation">操作</string>
|
||||
<string name="vip_rebate_tips2">注:\n返利鑽石需在貴族開通後30天內領取完畢,逾期失效 領取後的返利鑽石可到【我的-收益記錄-鑽石明細-收入記錄】中查看。</string>
|
||||
<string name="vip_rebate_day_format">第%s天</string>
|
||||
<string name="vip_rebate_get">領取</string>
|
||||
<string name="vip_rebate_received">已領取</string>
|
||||
<string name="vip_rebate_no_get">未達到領取標準</string>
|
||||
<string name="vip_rebate_disable">當前等級不享有該特權~</string>
|
||||
<string name="vip_rebate_now">立即返利</string>
|
||||
<string name="vip_buy_tips">您當前是%s等級,確認購買更高%s等級?</string>
|
||||
<string name="vip_buy_format">購買%s等級特權</string>
|
||||
</resources>
|
@@ -5245,6 +5245,25 @@
|
||||
<string name="treasure_box_presenter_boxrankingpresenter_01">No data yet</string>
|
||||
<string name="treasure_box_presenter_boxrankingpresenter_02">It\'s the end</string>
|
||||
<string name="all_mic">All</string>
|
||||
|
||||
|
||||
<string name="vip_privilege">Vip privilege</string>
|
||||
<string name="vip_rebate">Rebate privilege</string>
|
||||
<string name="vip_buy_tips_format">Users who directly purchase the %s level will not only directly enjoy all the privileges corresponding to the level, but also receive additional diamond rebates.</string>
|
||||
<string name="vip_rebate_tips">The specific rebate dates and the number of rebate diamonds are as follows:</string>
|
||||
<string name="vip_level_name">Level name</string>
|
||||
<string name="vip_rebate_date">Rebate date</string>
|
||||
<string name="vip_rebate_number">Number of rebate diamonds</string>
|
||||
<string name="vip_rebate_operation">operate</string>
|
||||
<string name="vip_rebate_tips2">Note: \nThe rebate diamonds must be collected within 30 days after the noble account is activated, and they will expire after the expiration date. The rebate diamonds after collection can be viewed in [My-Income Record-Diamond Details-Income Record].</string>
|
||||
<string name="vip_rebate_day_format">Day %s</string>
|
||||
<string name="vip_rebate_get">receive</string>
|
||||
<string name="vip_rebate_received">Received</string>
|
||||
<string name="vip_rebate_no_get">Not meeting the requirements for receiving</string>
|
||||
<string name="vip_rebate_disable">The current level does not enjoy this privilege ~</string>
|
||||
<string name="vip_rebate_now">Instant rebate</string>
|
||||
<string name="vip_buy_tips">You are currently at level %s. Are you sure you want to purchase a higher level %s?</string>
|
||||
<string name="vip_buy_format">Purchase %s level privileges</string>
|
||||
</resources>
|
||||
|
||||
|
||||
|
@@ -97,23 +97,271 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_vip_main_bottom"
|
||||
android:background="@drawable/vip_bg_bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_min="601dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_not_open" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tab_privilege"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:background="@drawable/vip_bg_tab_selected"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_privilege"
|
||||
android:textColor="#333333"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:layout_marginTop="@dimen/dp_28"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_tab_rebate"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tab_rebate"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="@drawable/vip_bg_tab_unselected"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_rebate"
|
||||
android:textColor="#333333"
|
||||
android:textSize="@dimen/dp_14"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_tab_privilege"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_tab_privilege"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_tab_privilege" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tab_line_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_2"
|
||||
android:src="@drawable/vip_ic_tab_line_left"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_tab_privilege"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_tab_privilege"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_tab_privilege" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tab_line_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:src="@drawable/vip_ic_tab_line_right"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_tab_rebate"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_tab_rebate"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_tab_rebate" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_rebate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tab_rebate"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rebate_disable_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_rebate_disable"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rebate_tips_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/vip_buy_tips_format"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rebate_tips_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="@string/vip_rebate_tips"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_rebate_tips_1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_table_column_level_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_31"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/vip_bg_cloumn_first"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_level_name"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_date"
|
||||
app:layout_constraintHorizontal_weight="70"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_rebate_tips_2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_table_column_rebate_date"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="#1AFFAA36"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_rebate_date"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_num"
|
||||
app:layout_constraintHorizontal_weight="78"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_table_column_rebate_num"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="#1AFFAA36"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_rebate_number"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_operation"
|
||||
app:layout_constraintHorizontal_weight="97"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_rebate_date"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_table_column_rebate_operation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/vip_bg_cloumn_last"
|
||||
android:gravity="center"
|
||||
android:text="@string/vip_rebate_operation"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_weight="102"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_rebate_num"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_rebate"
|
||||
android:layout_width="0dp"
|
||||
android:minHeight="@dimen/dp_20"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_table_column_rebate_operation"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_table_column_rebate_date"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_table_column_rebate_date"
|
||||
tools:itemCount="4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_table_level_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#BC9E66"
|
||||
android:textSize="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rv_rebate"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_table_column_level_name"
|
||||
tools:text="Name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_table_line_level"
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="0dp"
|
||||
android:background="#33FFAA36"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rv_rebate"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_date"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_table_line_date"
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="0dp"
|
||||
android:background="#33FFAA36"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rv_rebate"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_num"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_rebate_date"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_table_line_num"
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="0dp"
|
||||
android:background="#33FFAA36"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rv_rebate"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_table_column_rebate_operation"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_table_column_rebate_num"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_table_line_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:background="#33FFAA36"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_table_column_rebate_operation"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_table_column_level_name" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_table_border"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/vip_bg_rebate_table"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rv_rebate"
|
||||
app:layout_constraintEnd_toEndOf="@id/rv_rebate"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_table_column_level_name"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_table_column_rebate_operation" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rebate_tips_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="@string/vip_rebate_tips2"
|
||||
android:textColor="#FFE3AF"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintTop_toBottomOf="@id/rv_rebate" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_privilege"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="tv_auth_num,recycler_view" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_auth_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="70dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textColor="#ffffe7cf"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bottom"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tab_privilege"
|
||||
tools:text="3/12" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@@ -121,7 +369,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginBottom="125dp"
|
||||
android:layout_marginBottom="165dp"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -134,24 +382,6 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<com.chwl.library.widget.DrawableCenterTextView
|
||||
android:id="@+id/tv_open_vip"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:background="@drawable/bg_vip_open_btn"
|
||||
android:drawableStart="@drawable/ic_vip_open_btn"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="@string/layout_activity_vip_main_03" />
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="0dp"
|
||||
@@ -164,16 +394,15 @@
|
||||
<com.chwl.app.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/magic_indicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_my_vip_info"
|
||||
android:id="@+id/layout_bottom_panel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@@ -184,16 +413,17 @@
|
||||
tools:visibility="visible">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_level_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:background="#FF302B20">
|
||||
android:background="#FF302B20"
|
||||
android:layout_height="36dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:baselineAligned="true">
|
||||
android:baselineAligned="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -290,8 +520,10 @@
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_level_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/dp_20"
|
||||
android:background="#FF252014">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -299,10 +531,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:src="@drawable/ic_vip_auth_text"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -372,6 +602,23 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.chwl.library.widget.DrawableCenterTextView
|
||||
android:id="@+id/tv_open_vip"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/bg_vip_open_btn"
|
||||
android:drawableStart="@drawable/ic_vip_open_btn"
|
||||
android:drawablePadding="3dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:text="@string/layout_activity_vip_main_03" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -2,6 +2,7 @@ package com.chwl.core.pay;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.chwl.core.pay.bean.ChargeBean;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.chwl.core.base.IModel;
|
||||
import com.chwl.core.bean.response.ServiceResult;
|
||||
@@ -43,6 +44,8 @@ public interface IPayModel extends IModel {
|
||||
|
||||
Single<ChargeListResult> getChargeList(int channelType, long uid);
|
||||
|
||||
Single<List<ChargeBean>> getVipList();
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机时候获取手机验证码
|
||||
*
|
||||
|
@@ -5,6 +5,7 @@ import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TY
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chwl.core.pay.bean.ChargeBean;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.chwl.core.XConstants;
|
||||
import com.chwl.core.R;
|
||||
@@ -187,6 +188,13 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<ChargeBean>> getVipList() {
|
||||
return api.getVipList("2")
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机时候获取手机验证码
|
||||
*
|
||||
@@ -392,6 +400,10 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
@FormUrlEncoded
|
||||
@POST("/googlePlayBilling/placeOrder")
|
||||
Single<ServiceResult<PayRecordId>> placeOrder(@Field("chargeProdId") String chargeProdId);
|
||||
|
||||
|
||||
@GET("/chargeprod/getVipList")
|
||||
Single<ServiceResult<List<ChargeBean>>> getVipList(@Query("type") String type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -38,9 +38,16 @@ object VipModel : BaseModel() {
|
||||
api.changeInvisibleInRoom(open)
|
||||
}
|
||||
|
||||
suspend fun openVipWithDiamond(): Any? =
|
||||
suspend fun openVipWithDiamond(vipLevel:Int): Any? =
|
||||
launchRequest {
|
||||
api.openVipWithDiamond(if (AvRoomDataManager.get().roomUid == 0L) null else AvRoomDataManager.get().roomUid)
|
||||
api.openVipWithDiamond(
|
||||
if (AvRoomDataManager.get().roomUid == 0L) null else AvRoomDataManager.get().roomUid,
|
||||
vipLevel)
|
||||
}
|
||||
|
||||
suspend fun getVipRebate(id: Long): Any? =
|
||||
launchRequest {
|
||||
api.getVipRebate(id)
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
@@ -96,7 +103,17 @@ object VipModel : BaseModel() {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/vip/openWithDiamond")
|
||||
suspend fun openVipWithDiamond(@Field("roomUid") roomUid: Long?): ServiceResult<Any>
|
||||
suspend fun openVipWithDiamond(@Field("roomUid") roomUid: Long?,
|
||||
@Field("vipLevel") vipLevel: Int): ServiceResult<Any>
|
||||
|
||||
/**
|
||||
* 领取返利
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/vip/returnProfit/receive")
|
||||
suspend fun getVipRebate(@Field("returnProfitRecordId") returnProfitRecordId: Long?): ServiceResult<Any>
|
||||
|
||||
}
|
||||
|
||||
|
@@ -20,8 +20,13 @@ data class VipInfo(
|
||||
var remainSeconds: Int = 0,
|
||||
var currLevel: Int = 0,
|
||||
var currScore: Int = 0,
|
||||
var nextVipName: String? = null
|
||||
var nextVipName: String? = null,
|
||||
var isReturnProfit: Int? = null,
|
||||
val returnProfits: List<VipRebateInfo>? = null
|
||||
) : Serializable {
|
||||
|
||||
fun isRebate() = isReturnProfit == 1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is VipInfo && other.vipLevel == vipLevel
|
||||
}
|
||||
|
18
core/src/main/java/com/chwl/core/vip/bean/VipRebateInfo.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.chwl.core.vip.bean
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/3/29 14:44
|
||||
* Desc:
|
||||
**/
|
||||
data class VipRebateInfo(
|
||||
val createTime: Long? = null,
|
||||
val id: Long? = null,
|
||||
var isReceive: Boolean? = null,
|
||||
val profitAmount: Long? = null,
|
||||
val profitDate: Long? = null,
|
||||
val returnProfitRecordId: Long? = null,
|
||||
val seqNo: Int? = null,
|
||||
val updateTime: Long? = null,
|
||||
val vipLevel: Int? = null,
|
||||
val isReach: Boolean? = null
|
||||
)
|