新人限时首充接口对接
This commit is contained in:
@@ -36,6 +36,7 @@ import com.yizhuan.xchat_android_core.pay.bean.PaymentResult
|
||||
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
||||
import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
@@ -94,10 +95,11 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
.build()
|
||||
|
||||
dialogManager.showProgressDialog(this)
|
||||
PayModel.get().firstChargeList
|
||||
PayModel.get().newUserChargeInfo
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
initData(it)
|
||||
initData(it.limitFirstChargeTaskList)
|
||||
initNewUserCharge(it.limitEndTime)
|
||||
dialogManager.dismissDialog()
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
@@ -118,7 +120,6 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
private fun initData(goodsList: List<FirstChargeGoods>) {
|
||||
this.goodsList = goodsList
|
||||
updateCurrGoods(goodsList.getOrNull(0))
|
||||
initNewUserCharge(CurrentTimeUtils.getCurrentTime() + 3 * 60 * 1000)
|
||||
val planViews = arrayListOf(
|
||||
binding.rbPlanA,
|
||||
binding.rbPlanB,
|
||||
@@ -129,7 +130,7 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
var initChecked = false
|
||||
planViews.forEachIndexed { index, button ->
|
||||
goodsList.getOrNull(index)?.let {
|
||||
if (!it.isFinish && !initChecked) {
|
||||
if (!it.isFinishCharge && !initChecked) {
|
||||
initChecked = true
|
||||
button.isChecked = true
|
||||
}
|
||||
@@ -141,9 +142,10 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
private fun initNewUserCharge(limitChargeEndTime: Long) {
|
||||
val count = (limitChargeEndTime - CurrentTimeUtils.getCurrentTime()) / 1000 / 60 + 1
|
||||
if (count <= 0) return
|
||||
Observable.intervalRange(0, count, 0, 1, TimeUnit.MINUTES)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -154,10 +156,11 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
val residueTime =
|
||||
limitChargeEndTime - CurrentTimeUtils.getCurrentTime()
|
||||
if (residueTime <= 0) {
|
||||
UserModel.get().cacheLoginUserInfo?.isShowLimitCharge = false
|
||||
finish()
|
||||
} else {
|
||||
binding.tvTime.text =
|
||||
TimeUtil.getElapseTimeForNewUserCharge(residueTime)
|
||||
"限时${TimeUtil.getElapseTimeForNewUserCharge(residueTime)}"
|
||||
}
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
@@ -179,7 +182,7 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
)
|
||||
binding.tvTitle.text = builder
|
||||
}
|
||||
binding.tvCharge.isInvisible = it.isFinish
|
||||
binding.tvCharge.isInvisible = it.isFinishCharge
|
||||
rewardAdapter.setNewData(it.firstChargeRewardList)
|
||||
}
|
||||
}
|
||||
|
@@ -177,10 +177,12 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
|
||||
}
|
||||
|
||||
private fun setCenterInfoData(pagerList: List<List<MeCenterInfo>?>) {
|
||||
if (ListUtils.isListEmpty(pagerList)) {
|
||||
private fun setCenterInfoData(pagerList: List<List<MeCenterInfo>>?) {
|
||||
if (pagerList.isNullOrEmpty()) {
|
||||
mBinding.llSettingEntrance.isVisible = false
|
||||
return
|
||||
}
|
||||
mBinding.llSettingEntrance.isVisible = true
|
||||
mBinding.magicIndicatorEntrance.initIndicator(pagerList.size)
|
||||
mBinding.magicIndicatorEntrance.setSelectedPage(0)
|
||||
mBinding.magicIndicatorEntrance.visibility =
|
||||
@@ -233,10 +235,12 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
})
|
||||
}
|
||||
|
||||
private fun setGameInfoData(pagerList: List<List<GameInfo>?>) {
|
||||
if (ListUtils.isListEmpty(pagerList)) {
|
||||
private fun setGameInfoData(pagerList: List<List<GameInfo>>?) {
|
||||
if (pagerList.isNullOrEmpty()) {
|
||||
mBinding.llGame.isVisible = false
|
||||
return
|
||||
}
|
||||
mBinding.llGame.isVisible = true
|
||||
mBinding.magicIndicatorGame.initIndicator(pagerList.size)
|
||||
mBinding.magicIndicatorGame.setSelectedPage(0)
|
||||
mBinding.magicIndicatorGame.visibility =
|
||||
@@ -300,12 +304,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
initUserDate()
|
||||
// 每次页面重新可见的时候,如果处于审核状态,都尝试刷新拿取最新信息
|
||||
// 不算是一个多好的做法,但是 it works
|
||||
// 不算频繁,可以接受
|
||||
if (mUserInfo?.isReview == true) {
|
||||
requestUpdateUserInfo()
|
||||
}
|
||||
requestUpdateUserInfo()
|
||||
}
|
||||
|
||||
private fun initUserDate() {
|
||||
@@ -366,9 +365,13 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
CurrentTimeUtils.getCurrentTime() + 2 * 60 * 1000 + 30 * 1000
|
||||
}
|
||||
if (userinfo.isShowLimitCharge) {
|
||||
mBinding.flNewUserCharge.isVisible = true
|
||||
val count =
|
||||
(userinfo.limitChargeEndTime - CurrentTimeUtils.getCurrentTime()) / 1000 / 60 + 1
|
||||
if (count <= 0) {
|
||||
mBinding.flNewUserCharge.isVisible = false
|
||||
return
|
||||
}
|
||||
mBinding.flNewUserCharge.isVisible = true
|
||||
newUserDisposable?.dispose()
|
||||
newUserDisposable =
|
||||
Observable.intervalRange(0, count, 0, 1, TimeUnit.MINUTES)
|
||||
|
@@ -16,7 +16,7 @@ import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
class BannerHelper {
|
||||
companion object {
|
||||
|
||||
fun setBanner(rollView: RollPagerView, bannerList: List<BannerInfo>) {
|
||||
fun setBanner(rollView: RollPagerView, bannerList: List<BannerInfo>?) {
|
||||
|
||||
if (ListUtils.isListEmpty(bannerList)) {
|
||||
rollView.visibility = View.GONE
|
||||
|
@@ -33,7 +33,7 @@
|
||||
android:layout_marginStart="21dp"
|
||||
android:layout_marginTop="87dp"
|
||||
android:gravity="center"
|
||||
android:text="限时6天23小时9分"
|
||||
tools:text="限时6天23小时9分"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
|
@@ -14,6 +14,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="279dp"
|
||||
android:layout_height="268dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bg_new_user_charge_prize"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
@@ -22,7 +23,9 @@
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="94dp"
|
||||
android:layout_marginTop="73dp" />
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="73dp"
|
||||
android:layout_marginEnd="20dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_know"
|
||||
@@ -43,7 +46,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
|
||||
|
@@ -543,9 +543,11 @@
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/shape_white_8dp_round"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/me_item_wallet">
|
||||
app:layout_constraintTop_toBottomOf="@id/me_item_wallet"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_entrance"
|
||||
@@ -573,10 +575,12 @@
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/shape_white_8dp_round"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_setting_entrance"
|
||||
app:layout_constraintVertical_bias="0">
|
||||
app:layout_constraintVertical_bias="0"
|
||||
tools:visibility="visible">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -7,10 +7,10 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/bg_new_user_charge_reward_item"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
@@ -33,14 +33,13 @@
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:maxWidth="70dp"
|
||||
android:maxWidth="55dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="12sp"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_bg"
|
||||
|
@@ -6,11 +6,10 @@ import com.google.gson.JsonObject;
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.ChargeListResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.NewUserChargeInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WxPayType;
|
||||
import com.yizhuan.xchat_android_library.coremanager.IBaseCore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -100,4 +99,6 @@ public interface IPayModel extends IModel {
|
||||
Single<String> giveGold(long toUid, String goldNum,String password);
|
||||
|
||||
Single<List<FirstChargeGoods>> getFirstChargeList();
|
||||
|
||||
Single<NewUserChargeInfo> getNewUserChargeInfo();
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import com.yizhuan.xchat_android_core.bean.response.result.WalletInfoResult;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.NewUserChargeInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WxPayType;
|
||||
import com.yizhuan.xchat_android_core.pay.event.ChargeCustomNotificationEvent;
|
||||
@@ -434,6 +435,19 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新用户限时首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<NewUserChargeInfo> getNewUserChargeInfo(){
|
||||
return api.getNewUserChargeInfo()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
|
||||
public interface Api {
|
||||
|
||||
/**
|
||||
@@ -594,6 +608,14 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
*/
|
||||
@GET("/first/charge/list")
|
||||
Single<ServiceResult<List<FirstChargeGoods>>> getFirstChargeList();
|
||||
|
||||
/**
|
||||
* 获取新用户限时首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/first/charge/limit/list")
|
||||
Single<ServiceResult<NewUserChargeInfo>> getNewUserChargeInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,5 +14,5 @@ public class FirstChargeGoods {
|
||||
private String chargeProdTitle;
|
||||
private ArrayList<FirstChargeReward> firstChargeRewardList;
|
||||
private String giveMoney;
|
||||
private boolean finish;
|
||||
private boolean finishCharge;
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NewUserChargeInfo {
|
||||
private long limitEndTime;
|
||||
private List<FirstChargeGoods> limitFirstChargeTaskList;
|
||||
public NewUserChargeInfo() {
|
||||
}
|
||||
}
|
@@ -313,7 +313,7 @@ public class TimeUtil {
|
||||
long hour = seconds / (60 * 60) % 24;
|
||||
sb.append(hour).append("时");
|
||||
|
||||
long minute = (seconds - 60 * 60 * hour) / 60;
|
||||
long minute = seconds / 60 % 60;
|
||||
sb.append(minute).append("分");
|
||||
|
||||
return sb.toString();
|
||||
|
Reference in New Issue
Block a user