Compare commits

..

13 Commits

Author SHA1 Message Date
max
b4f26d324c feat:增加支付场景的日志输出 2024-04-02 20:18:28 +08:00
max
4a2618a76b 调整版本号 2024-04-02 17:57:14 +08:00
max
1b56fd075b fix:贵族中心适配英文:微调部分字体大小、文案 、图标 2024-04-02 17:55:44 +08:00
max
f1586fb0ac feat:设置页条目字体大小统一 2024-04-02 17:02:47 +08:00
max
66aa5a5671 fix:修复贵族中心空指针隐患 2024-04-02 16:52:35 +08:00
max
52bfc9636b feat:移除不必要的类 2024-04-02 16:52:12 +08:00
max
7c0665b9ce feat:调整贵族中心部分翻译 2024-04-02 14:22:24 +08:00
max
ecb3c46407 feat:退出登录操作 增加退出google登录 2024-04-02 11:43:23 +08:00
max
6ce3a64ea3 fix:调整贵族中心部分翻译和文本局中对齐 2024-04-02 11:30:11 +08:00
max
408ec37ff2 fix:获取google-service做非空判断 2024-04-02 10:40:25 +08:00
max
ecdbf9e9c3 feat:地区选择添加英国、美国 2024-04-02 10:39:10 +08:00
max
d8ae8a559d feat:初步移植piko的新版贵族中心(返利+购买) 2024-04-01 19:00:26 +08:00
max
2f8511ca16 feat:添加google登录 2024-04-01 16:34:24 +08:00
47 changed files with 1138 additions and 235 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,49 +0,0 @@
package com.chwl.app.ui.behavior;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
import com.google.android.material.appbar.AppBarLayout;
/**
* 此文件不能删引用到AppLayout下面的
* create by lvzebiao @2020/1/7
*/
public class FixAppBarBehavior extends AppBarLayout.Behavior {
public FixAppBarBehavior() {
}
public FixAppBarBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dxConsumed, int dyConsumed, int
dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
stopNestedScrollIfNeeded(dyUnconsumed, child, target, type);
}
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dx, int dy, int[] consumed, int type) {
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
stopNestedScrollIfNeeded(dy, child, target, type);
}
private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
if (type == ViewCompat.TYPE_NON_TOUCH) {
final int currOffset = getTopAndBottomOffset();
if ((dy < 0 && currOffset == 0)
|| (dy > 0 && currOffset == -child.getTotalScrollRange())) {
ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
}
}
}
}

View File

@@ -29,6 +29,7 @@ import com.chwl.app.common.widget.OriginalDrawStatusClickSpan;
import com.chwl.app.ui.webview.CommonWebViewActivity;
import com.chwl.core.UriProvider;
import com.coorchice.library.SuperTextView;
import com.example.module_base.support.login.ILoginService;
import com.netease.nim.uikit.StatusBarUtil;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.chwl.app.MainActivity;
@@ -271,6 +272,7 @@ public class LoginPasswordActivity extends BaseActivity {
});
});
setProtocol();
findViewById(R.id.layout_google).setOnClickListener(v -> googleLogin());
}
private void startCounter() {
@@ -312,6 +314,10 @@ public class LoginPasswordActivity extends BaseActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ILoginService loginService = AuthModel.get().getGoogleLoginService();
if (loginService != null) {
loginService.onActivityResult(requestCode, resultCode, data);
}
if (requestCode == 100 && resultCode == RESULT_OK) {
String areaCode = data.getStringExtra(AreaCodeActivity.COUNTRY_NUMBER);
if (areaCode != null) {
@@ -492,4 +498,27 @@ public class LoginPasswordActivity extends BaseActivity {
return super.onKeyDown(keyCode, event);
}
private void googleLogin(){
getDialogManager().showProgressDialog(this);
AuthModel.get().googleLogin(this)
.compose(bindUntilEvent(ActivityEvent.DESTROY))
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String result) {
getDialogManager().dismissDialog();
}
@Override
public void onError(Throwable e) {
getDialogManager().dismissDialog();
dealWithLoginError(e);
e.printStackTrace();
}
});
}
}

View File

@@ -218,7 +218,12 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
@SuppressLint("CheckResult")
@Override
public void onPurchasesUpdated(@Nullable List<? extends IPurchase> purchases) {
Log.i(TAG, "onPurchasesUpdated");
if (purchases == null) {
return;
}
for (IPurchase purchase : purchases) {
Log.d(TAG, "onPurchasesUpdated() purchase:" + purchase.getPurchaseState());
if (purchase.isPurchasedState() &&
purchase.getAccountIdentifiers() != null) {
Log.d(TAG, "onPurchasesUpdated() verifyOrder");
@@ -229,6 +234,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
purchase.getPurchaseToken())
.compose(bindToLifecycle())
.subscribe(token -> {
Log.d(TAG, "onPurchasesUpdated() verifyOrder success");
billingManager.consumeAsync(token);
// IProductDetails productDetails = null;
@@ -252,28 +258,32 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
// }
},
throwable -> {
Log.d(TAG, "onPurchasesUpdated() verifyOrder throwable:"+throwable);
if (!(throwable instanceof IgnoreException)) {
SingleToastUtil.showToast(throwable.getMessage());
}
});
}
}
Log.i(TAG, "onPurchasesUpdated");
}
@Override
public void onConsumeFinished(String token, int result) {
Log.d(TAG, "onConsumeFinished() " + result);
getMvpPresenter().loadUserInfo();
}
/*失败处理*/
public void onFailedHandle(int result) {
Log.d(TAG, "onFailedHandle() " + result);
}
/*购买商品*/
@SuppressLint("CheckResult")
public void buyProduct(IProductDetails productDetails) {
Log.d(TAG, "buyProduct()");
if (billingManager == null) {
Log.d(TAG, "buyProduct() null");
return;
}
if (productDetails != null) {

View File

@@ -29,4 +29,6 @@ public interface IPagerNavigator {
* ViewPager内容改变时需要先调用此方法自定义的IPagerNavigator应当遵守此约定
*/
void notifyDataSetChanged();
int getCurrentIndex();
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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,9 +36,9 @@ 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
import com.chwl.core.pay.PayModel
import com.chwl.core.pay.bean.ChargeBean
import com.chwl.core.pay.bean.PayRecordId
@@ -46,6 +48,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
@@ -64,21 +68,23 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
}
private const val BIND_CODE_GOLD = 200
private const val TAG = "ChargeActivity"
private const val TAG = "VipMainActivity"
}
private val authAdapter = VipAuthAdapter()
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 +124,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 +167,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 +179,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 +194,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()
@@ -202,61 +211,13 @@ 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)
binding.layoutOpenVip.setOnClickListener {
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 +240,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 +294,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 +436,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 +451,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.layoutOpenVip.isVisible = true
} else {
binding.layoutOpenVip.isVisible = false
}
} else {
currentChargeInfo = null
binding.layoutOpenVip.isVisible = false
}
if (binding.layoutOpenVip.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)
}
}

View File

@@ -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)
}
}

View File

@@ -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

View File

@@ -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)
}
}
}

View 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
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@@ -79,10 +79,9 @@
<LinearLayout
android:id="@+id/ll_account_login"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_account_login"
@@ -174,11 +173,10 @@
<LinearLayout
android:id="@+id/ll_sms_login"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_account_login"
@@ -283,7 +281,42 @@
</LinearLayout>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_login_body_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="ll_account_login,ll_sms_login" />
<FrameLayout
android:id="@+id/layout_google"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_48"
android:layout_marginStart="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_36"
android:background="@drawable/base_shape_ffffff_26dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier_login_body_bottom">
<ImageView
android:id="@+id/iv_google"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="@dimen/dp_28"
android:src="@drawable/login_ic_google" />
<TextView
android:id="@+id/tv_google"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Google"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
</FrameLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_protocol_hint"

View File

@@ -37,7 +37,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_bind_phone"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:id="@+id/iv_bind_phone_arrow"
@@ -73,7 +73,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/ui_setting_settingactivity_016"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:id="@+id/iv_login_arrow"
@@ -142,7 +142,7 @@
android:paddingRight="@dimen/dp_15"
android:text="@string/text_setting_black_management"
android:textColor="@color/text_title_color"
android:textSize="14sp"
android:textSize="@dimen/sp_14"
app:drawableEndCompat="@drawable/arrow_right" />
<View
@@ -166,7 +166,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_permission"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:layout_width="wrap_content"
@@ -198,7 +198,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_help"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:layout_width="wrap_content"
@@ -226,7 +226,7 @@
android:paddingRight="@dimen/dp_15"
android:text="@string/text_setting_community_norms"
android:textColor="@color/text_title_color"
android:textSize="14sp"
android:textSize="@dimen/sp_14"
android:visibility="gone"
app:drawableEndCompat="@drawable/arrow_right" />
@@ -254,7 +254,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_contact_us"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:layout_width="wrap_content"
@@ -288,7 +288,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_clear_cache"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:id="@+id/clear_cache_right"
@@ -322,7 +322,7 @@
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_about"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
<ImageView
android:id="@+id/arrow_right"
@@ -355,7 +355,7 @@
android:gravity="center"
android:text="@string/text_setting_logout"
android:textColor="@color/text_title_color"
android:textSize="14sp" />
android:textSize="@dimen/sp_14" />
</LinearLayout>

View 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>

View 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>

View File

@@ -893,7 +893,6 @@
<string name="privacy_setting">隱私設置</string>
<string name="notice_setting">通知提醒設置</string>
<string name="behavior_fix_app_bar">com.chwl.app.ui.behavior.FixAppBarBehavior</string>
<string name="label_search_history">搜索記錄</string>
<string name="label_room_history">進房記錄</string>
@@ -5217,4 +5216,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>

View File

@@ -893,7 +893,6 @@
<string name="privacy_setting">隱私設置</string>
<string name="notice_setting">通知提醒設置</string>
<string name="behavior_fix_app_bar">com.chwl.app.ui.behavior.FixAppBarBehavior</string>
<string name="label_search_history">搜索記錄</string>
<string name="label_room_history">進房記錄</string>
@@ -5216,4 +5215,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>

View File

@@ -883,7 +883,6 @@
<string name="privacy_setting">Privacy Setting</string>
<string name="notice_setting">Notification Setting</string>
<string name="behavior_fix_app_bar">com.chwl.app.ui.behavior.FixAppBarBehavior</string>
<string name="label_search_history">Search history</string>
<string name="label_room_history">Room entry history</string>
@@ -4295,7 +4294,7 @@
<string name="layout_activity_vip_main_04">Current Level</string>
<string name="layout_activity_vip_main_05">Vip1</string>
<string name="layout_activity_vip_main_06">Remainder:</string>
<string name="layout_activity_vip_main_07">Power Value Can Upgrade To</string>
<string name="layout_activity_vip_main_07"> Can Upgrade To </string>
<string name="layout_activity_vip_main_08">Vip2</string>
<string name="layout_activity_vip_main_09">Reached Highest Usable VIP Level</string>
<string name="layout_activity_vip_main_010">Remaining Time:</string>
@@ -5245,6 +5244,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">Privilege</string>
<string name="vip_rebate">Rebate</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">Condition not met</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>

View File

@@ -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,24 +413,24 @@
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"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:text="@string/layout_activity_vip_main_04"
android:textColor="#ffbc9e66"
android:textSize="@dimen/sp_10" />
android:textSize="@dimen/sp_9" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_curr_level_name"
@@ -209,7 +438,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:textColor="#ffffe3af"
android:textSize="@dimen/sp_12"
android:textSize="@dimen/sp_10"
tools:text="@string/layout_activity_vip_main_05" />
<LinearLayout
@@ -221,17 +450,17 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginStart="2dp"
android:text="@string/layout_activity_vip_main_06"
android:textColor="#ffbc9e66"
android:textSize="@dimen/sp_10" />
android:textSize="@dimen/sp_9" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_upgrade_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffe3af"
android:textSize="@dimen/sp_13"
android:textSize="@dimen/sp_10"
tools:text="4562" />
@@ -240,7 +469,7 @@
android:layout_height="wrap_content"
android:text="@string/layout_activity_vip_main_07"
android:textColor="#ffbc9e66"
android:textSize="@dimen/sp_10" />
android:textSize="@dimen/sp_9" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_next_level_name"
@@ -259,7 +488,7 @@
android:layout_marginStart="15dp"
android:text="@string/layout_activity_vip_main_09"
android:textColor="#ffbc9e66"
android:textSize="@dimen/sp_10" />
android:textSize="@dimen/sp_9" />
<androidx.appcompat.widget.AppCompatTextView
@@ -268,14 +497,14 @@
android:layout_marginStart="4dp"
android:text="@string/layout_activity_vip_main_010"
android:textColor="#ffbc9e66"
android:textSize="@dimen/sp_10" />
android:textSize="@dimen/sp_9" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_residue_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffe3af"
android:textSize="@dimen/sp_13"
android:textSize="@dimen/sp_10"
tools:text="@string/layout_activity_vip_main_011" />
<androidx.appcompat.widget.AppCompatImageView
@@ -283,15 +512,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_marginStart="3dp"
android:src="@drawable/ic_vip_time_help" />
</LinearLayout>
</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 +530,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 +601,33 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/layout_open_vip"
android:layout_width="300dp"
android:layout_height="44dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/bg_vip_open_btn"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_vip_open_btn" />
<TextView
android:id="@+id/tv_open_vip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:gravity="center"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp_13"
android:textStyle="bold"
tools:text="19.99 Purchase VIP$ level privileges" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -20,6 +20,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:gravity="center"
android:textColor="#ff9f8052"
android:textSize="14dp"
tools:text="@string/layout_item_vip_auth_01" />

View File

@@ -5,8 +5,13 @@ import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.chwl.library.utils.constant.PackageNameConstants;
import com.example.module_base.support.google.IGoogleService;
import com.example.module_base.support.login.ILoginService;
import com.example.module_base.support.login.LoginSDKException;
import com.example.module_base.support.login.PlatformInfo;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nim.uikit.common.util.string.StringUtil;
@@ -314,6 +319,129 @@ public class AuthModel extends BaseModel implements IAuthModel {
});
}
@Override
public Single<String> googleLogin(Activity activity) {
return Single.create((SingleOnSubscribe<PlatformInfo>) e -> {
ILoginService loginService = getGoogleLoginService();
if (loginService == null) {
e.onError(new Throwable(ResUtil.getString(R.string.bean_response_serviceresult_015)));
return;
}
//是否安装客户端
if (!DeviceUtils.isAppInstalled(getContext(), PackageNameConstants.GOOGLE_NAME)) {
e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_09)));
return;
}
loginService.login(activity, new ILoginService.Listener() {
@Override
public void onSuccess(@NonNull PlatformInfo platformInfo) {
thirdUserInfo = new ThirdUserInfo();
thirdUserInfo.setType(ThirdUserInfo.TYPE_GOOGLE);
thirdUserInfo.setPlatform("Google");
thirdUserInfo.setUserName(platformInfo.getName());
thirdUserInfo.setUserIcon(platformInfo.getAvatar());
e.onSuccess(platformInfo);
}
@Override
public void onFailure(@NonNull LoginSDKException exception) {
exception.printStackTrace();
LogUtils.d("googleLogin" + exception);
e.onError(new Throwable(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_010) + exception.getCode()));
}
});
})
.flatMap(platform -> {
String openid = platform.getId();
String unionid = platform.getId();
String avatar = thirdUserInfo.getUserIcon();
if (avatar != null && avatar.equals("null")) {
avatar = null;
}
thirdUserInfo.setUserIcon(avatar);
String gender = thirdUserInfo.getUserGender();
if (gender != null && !gender.trim().isEmpty()) {
gender = gender.replace("m", "1").replace("f", "2");
}
thirdUserInfo.setUserGender(gender);
EventBus.getDefault().post(new LoginReportEvent(3));
return thirdLogin(openid, unionid, TYPE_GOOGLE_LOGIN, "", "");
})
.flatMap(s -> imLogin(currentAccountInfo))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxHelper.handleException())
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
}
/**
* 第三方信息登录
*
* @param openid
* @param unionid
* @param type
* @return
*/
private Single<String> thirdLogin(String openid, String unionid, int type, String yiDunToken, String shuMeiDeviceId) {
LinkedInfo linkedInfo = LinkedModel.get().getLinkedInfo();
String linkedmeChannel = null;
if (linkedInfo != null && !StringUtil.isEmpty(linkedInfo.getChannel())) {
linkedmeChannel = linkedInfo.getChannel();
}
String finalLinkedmeChannel = linkedmeChannel;
return Single.create(new SingleOnSubscribe<String>() {
@Override
public void subscribe(SingleEmitter<String> e) throws Exception {
try {
LoginResult loginResult = api.thirdLogin(
openid,
unionid,
String.valueOf(type),
finalLinkedmeChannel,
yiDunToken,
shuMeiDeviceId
).blockingGet();
if (!loginResult.isSuccess()) {
if (loginResult.getCode() == CODE_BAN_ACCOUNT || loginResult.getCode() == CODE_BAN_DEVICE) {
e.onError(new BanAccountException(loginResult.getReason(), loginResult.getDate()));
} else if (loginResult.getCode() == CODE_ACCOUNT_CANCEL) {
e.onError(new AccountCancelException(loginResult.getMessage(), loginResult.getErbanNo(), loginResult.getCancelDate()));
} else {
e.onError(new Throwable(loginResult.getMessage()));
}
return;
}
currentAccountInfo = loginResult.getData();
DemoCache.saveCurrentAccountInfo(currentAccountInfo);
//成功获取到uid后就通知首页刷新审核中状态的数据
EventBus.getDefault().post(new GetCurrentUidEvent(true));
} catch (Exception e1) {
e.onError(new Throwable(OldHttpErrorHandleUtil.handle(e1)));
return;
}
//获取tick
try {
TicketResult ticketResult = requestTicket().blockingGet();
if (!ticketResult.isSuccess()) {
e.onError(new Throwable(ticketResult.getMessage()));
return;
}
ticketInfo = ticketResult.getData();
DemoCache.saveTicketInfo(ticketInfo);
} catch (Exception e1) {
e.onError(new Throwable(OldHttpErrorHandleUtil.handle(e1)));
return;
}
e.onSuccess(ResUtil.getString(R.string.xchat_android_core_auth_authmodel_012));
}
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
/**
* 获取tick
*
@@ -493,6 +621,10 @@ public class AuthModel extends BaseModel implements IAuthModel {
@Override
public Single<String> logout() {
Logger.i("logout ~~ ");
ILoginService loginService = getGoogleLoginService();
if (loginService != null) {
loginService.logout();
}
return api.logout(currentAccountInfo.getAccess_token())
.compose(RxHelper.handleSchedulers())
.flatMap(stringServiceResult -> {

View File

@@ -64,6 +64,8 @@ public interface IAuthModel extends IModel {
*/
Single<String> login(String phoneAreaCode, String account, String password, String code, String yiDunToken, String shuMeiDeviceId);
Single<String> googleLogin(Activity activity);
/**
* 重置用户信息
*/
@@ -139,4 +141,5 @@ public interface IAuthModel extends IModel {
*/
boolean isImLogin();
}

View File

@@ -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();
/**
* 修改支付密码时候,绑定手机时候获取手机验证码
*

View File

@@ -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);
}
}

View File

@@ -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>
}

View File

@@ -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
}

View 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
)

View File

@@ -32,8 +32,8 @@ COMPILE_SDK_VERSION=33
MIN_SDK_VERSION=21
TARGET_SDK_VERSION=33
version_name=1.0.0
version_code=1
version_name=1.0.1
version_code=3
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=7890