diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 37fa6cede..d1e6e9334 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1316,6 +1316,10 @@ android:name=".fansteam.FansTeamListActivity" android:screenOrientation="portrait" /> + + \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/MainActivity.java b/app/src/main/java/com/yizhuan/erban/MainActivity.java index 773eb7590..27f2073b2 100644 --- a/app/src/main/java/com/yizhuan/erban/MainActivity.java +++ b/app/src/main/java/com/yizhuan/erban/MainActivity.java @@ -50,7 +50,10 @@ import com.tencent.bugly.crashreport.CrashReport; import com.trello.rxlifecycle3.android.ActivityEvent; import com.yizhuan.erban.application.ActivityStackManager; import com.yizhuan.erban.avroom.activity.AVRoomActivity; +import com.yizhuan.erban.avroom.firstcharge.FirstChargePrizeDialog; import com.yizhuan.erban.avroom.ktv.KtvMusicManager; +import com.yizhuan.erban.avroom.newuserchargegift.NewUserChargeGiftDialog; +import com.yizhuan.erban.avroom.newuserchargegift.NewUserChargePrizeDialog; import com.yizhuan.erban.base.BaseMvpActivity; import com.yizhuan.erban.common.widget.CircleImageView; import com.yizhuan.erban.common.widget.DragLayout; @@ -113,6 +116,7 @@ import com.yizhuan.erban.ui.widget.RecallDialog; import com.yizhuan.erban.utils.CleanLeakUtils; import com.yizhuan.erban.utils.PushMessageHandler; import com.yizhuan.xchat_android_core.Constants; +import com.yizhuan.xchat_android_core.DemoCache; import com.yizhuan.xchat_android_core.UriProvider; import com.yizhuan.xchat_android_core.auth.AuthModel; import com.yizhuan.xchat_android_core.auth.event.KickOutEvent; @@ -168,6 +172,8 @@ import com.yizhuan.xchat_android_core.patriarch.event.CloseMinRoomEvent; import com.yizhuan.xchat_android_core.patriarch.event.ImPushMsgPmLimitTimeEvent; import com.yizhuan.xchat_android_core.patriarch.event.PmDismissAllLimitDialogEvent; import com.yizhuan.xchat_android_core.pay.bean.ShowCommonWebEvent; +import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent; +import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent; import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment; import com.yizhuan.xchat_android_core.recall.bean.CheckLostUserInfo; import com.yizhuan.xchat_android_core.recall.event.CheckLostUserEvent; @@ -459,6 +465,12 @@ public class MainActivity extends BaseMvpActivity //这里是为了处理APP后台运行的情况下点击分享房间等LinkedMe链接的情况 if (UserModel.get().getCacheLoginUserInfo() != null) { handleLinkedJump(); + if (PmDialogShowMrg.get().isHasShow()) { + if (DemoCache.readNewUserChargeGift() == 1) { + NewUserChargeGiftDialog.start(context); + DemoCache.saveNewUserChargeGift(2); + } + } } } @@ -1035,6 +1047,11 @@ public class MainActivity extends BaseMvpActivity } } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNewUserChargeEvent(NewUserChargeEvent event) { + new NewUserChargePrizeDialog(this, event.getChargeProdTitle(), event.getFirstChargeRewardList()).openDialog(); + } + /** * 处理开房限制时长 */ diff --git a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java index 8ec312de9..27819b9d8 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java @@ -1026,6 +1026,10 @@ public class AVRoomActivity extends BaseMvpActivity() { + + private var goodsList: List? = null + private var currGoods: FirstChargeGoods? = null + private lateinit var rewardAdapter: RewardAdapter + private lateinit var rvDelegate: RVDelegate + + companion object { + @JvmStatic + fun start(context: Context) { + val starter = Intent(context, NewUserChargeGiftDialog::class.java) + context.startActivity(starter) + } + + private const val BIND_CODE_GOLD = 200 + } + + @SuppressLint("CheckResult") + override fun init() { + //这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼 + val height = ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context) + window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, height) + window.setGravity(Gravity.CENTER) + EventBus.getDefault().register(this) + binding.rgPlan.setOnCheckedChangeListener { group, checkedId -> + updateCurrGoods(goodsList?.getOrNull(group.indexOfChild(group.findViewById(checkedId)))) + } + + binding.tvCharge.setOnClickListener { + currGoods?.let { + SelectPayTypeDialog.newInstance(it.chargeProdId, "¥${it.chargeMoney}") + .show(this) + } ?: run { + "请选择充值产品!".toast() + } + } + + rvDelegate = RVDelegate.Builder() + .setAdapter(RewardAdapter().also { rewardAdapter = it }) + .setLayoutManager(LinearLayoutManager(this, RecyclerView.HORIZONTAL, false)) + .setRecyclerView(binding.recyclerView) + .build() + + dialogManager.showProgressDialog(this) + PayModel.get().firstChargeList + .compose(bindToLifecycle()) + .subscribe({ + initData(it) + dialogManager.dismissDialog() + }, { + it.printStackTrace() + dialogManager.dismissDialog() + SingleToastUtil.showToast(it.message) + finish() + }) + + binding.viewBg.setOnClickListener { + //do nothing + } + binding.root.setOnClickListener { + finish() + } + } + + @SuppressLint("SetTextI18n") + private fun initData(goodsList: List) { + this.goodsList = goodsList + updateCurrGoods(goodsList.getOrNull(0)) + initNewUserCharge(CurrentTimeUtils.getCurrentTime() + 3 * 60 * 1000) + val planViews = arrayListOf( + binding.rbPlanA, + binding.rbPlanB, + binding.rbPlanC, + binding.rbPlanD, + binding.rbPlanE + ) + var initChecked = false + planViews.forEachIndexed { index, button -> + goodsList.getOrNull(index)?.let { + if (!it.isFinish && !initChecked) { + initChecked = true + button.isChecked = true + } + button.isVisible = true + button.text = "${it.chargeMoney}元" + } ?: run { + button.isVisible = false + } + } + } + + @SuppressLint("CheckResult") + private fun initNewUserCharge(limitChargeEndTime: Long) { + val count = (limitChargeEndTime - CurrentTimeUtils.getCurrentTime()) / 1000 / 60 + 1 + Observable.intervalRange(0, count, 0, 1, TimeUnit.MINUTES) + .compose(bindUntilEvent(ActivityEvent.DESTROY)) + .observeOn(AndroidSchedulers.mainThread()) + .doOnComplete { + finish() + } + .subscribe({ + val residueTime = + limitChargeEndTime - CurrentTimeUtils.getCurrentTime() + if (residueTime <= 0) { + finish() + } else { + binding.tvTime.text = + TimeUtil.getElapseTimeForNewUserCharge(residueTime) + } + }, { + it.printStackTrace() + }) + } + + private fun updateCurrGoods(firstChargeGoods: FirstChargeGoods?) { + firstChargeGoods?.let { + currGoods = it + val giveMoneyIndex = it.chargeProdTitle.lastIndexOf(it.giveMoney) + if (giveMoneyIndex == -1) { + binding.tvTitle.text = it.chargeProdTitle + } else { + val builder = SpannableStringBuilder(it.chargeProdTitle) + builder.setSpan( + ForegroundColorSpan(Color.parseColor("#FFA027")), giveMoneyIndex, + giveMoneyIndex + (it.giveMoney?.length ?: 0), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + ) + binding.tvTitle.text = builder + } + binding.tvCharge.isInvisible = it.isFinish + rewardAdapter.setNewData(it.firstChargeRewardList) + } + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + dialogManager.dismissDialog() + if (resultCode != RESULT_OK) { + return + } + //支付页面返回处理 + if (requestCode == PaymentActivity.REQUEST_CODE_PAY) { + if (data != null && data.extras != null) { + val paymentResult: PaymentResult? = + data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT) + if (paymentResult != null) { + // 充值金额超过限定时,就必须先实名认证 + when (JavaUtil.str2int(paymentResult.code)) { + PayModel.NOT_REAL_NAME_BEFORE_CHARGING -> dialogManager.showTipsDialog( + getString(R.string.tips_need_to_certification), + getString(R.string.go_to_certification), + object : AbsOkDialogListener() { + override fun onOk() { + // 跳去实名认证页面 + CommonWebViewActivity.start( + this@NewUserChargeGiftDialog, + UriProvider.getTutuRealNamePage() + ) + } + }) + UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST -> dialogManager.showTipsDialog( + getString(R.string.tips_need_bind_bank_card_first), + object : AbsOkDialogListener() { + override fun onOk() { + // 跳去添加银行卡页面 + AddBankCardAgreementActivity.start(this@NewUserChargeGiftDialog) + } + }) + else -> { + toast(paymentResult.msg) + //重新获取钱包信息 + PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe() + } + } + } + } + } + if (requestCode == BIND_CODE_GOLD) { + ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD) + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + fun onNewUserChargeEvent(event: NewUserChargeEvent?) { + finish() + } + + override fun onDestroy() { + super.onDestroy() + EventBus.getDefault().unregister(this) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/NewUserChargePrizeDialog.kt b/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/NewUserChargePrizeDialog.kt new file mode 100644 index 000000000..e138e23d3 --- /dev/null +++ b/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/NewUserChargePrizeDialog.kt @@ -0,0 +1,38 @@ +package com.yizhuan.erban.avroom.newuserchargegift + +import android.content.Context +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.google.android.flexbox.AlignItems +import com.google.android.flexbox.FlexboxLayoutManager +import com.google.android.flexbox.JustifyContent +import com.yizhuan.erban.R +import com.yizhuan.erban.databinding.DialogFirstChargePrizeBinding +import com.yizhuan.erban.databinding.DialogNewUserChargePrizeBinding +import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog +import com.yizhuan.erban.ui.utils.RVDelegate +import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward +import com.yizhuan.xchat_android_library.annatation.ActLayoutRes + +@ActLayoutRes(R.layout.dialog_new_user_charge_prize) +class NewUserChargePrizeDialog( + context: Context, + val title: String?, + private val firstChargeRewardList: List? +) : BaseBindingDialog(context) { + + private lateinit var rvDelegate: RVDelegate + + override fun init() { + rvDelegate = RVDelegate.Builder() + .setAdapter(RewardAdapter()) + .setLayoutManager(LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)) + .setRecyclerView(binding.recyclerView) + .build() + binding.ivKnow.setOnClickListener { + closeDialog() + } + rvDelegate.setNewData(firstChargeRewardList) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/RewardAdapter.kt b/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/RewardAdapter.kt new file mode 100644 index 000000000..a78bde608 --- /dev/null +++ b/app/src/main/java/com/yizhuan/erban/avroom/newuserchargegift/RewardAdapter.kt @@ -0,0 +1,21 @@ +package com.yizhuan.erban.avroom.newuserchargegift + +import android.widget.ImageView +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.BaseViewHolder +import com.yizhuan.erban.R +import com.yizhuan.erban.ui.utils.load +import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward +import com.yizhuan.xchat_android_core.utils.TextUtils + +class RewardAdapter : + BaseQuickAdapter(R.layout.item_new_user_charge_reward) { + override fun convert(helper: BaseViewHolder, item: FirstChargeReward) { + + helper.getView(R.id.iv_pic).load(item.showPir) + + helper.setText(R.id.tv_name, item.showText) + .setText(R.id.tv_time, "(${item.showTime})") + .setGone(R.id.tv_time, !TextUtils.isEmptyText(item.showTime)) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/avroom/presenter/AvRoomPresenter.java b/app/src/main/java/com/yizhuan/erban/avroom/presenter/AvRoomPresenter.java index d8bd7494e..32c267401 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/presenter/AvRoomPresenter.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/presenter/AvRoomPresenter.java @@ -443,7 +443,9 @@ public class AvRoomPresenter extends BaseMvpPresenter { */ @SuppressLint("CheckResult") public void checkNewUserGift() { - if (AvRoomDataManager.get().mCurrentRoomInfo == null || !DemoCache.readNewUserGift()) + + if (AvRoomDataManager.get().isRoomOwner() || + !DemoCache.readNewUserGift()) return; Single.timer(3, TimeUnit.SECONDS) diff --git a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.kt b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.kt index b55386fff..dd8ceabd5 100644 --- a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.kt +++ b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.kt @@ -14,9 +14,13 @@ import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.viewpager.widget.PagerAdapter import com.chad.library.adapter.base.BaseQuickAdapter +import com.netease.nim.uikit.common.util.sys.TimeUtil +import com.trello.rxlifecycle3.android.FragmentEvent +import com.yizhuan.erban.BuildConfig import com.yizhuan.erban.R import com.yizhuan.erban.UIHelper import com.yizhuan.erban.avroom.activity.AVRoomActivity +import com.yizhuan.erban.avroom.newuserchargegift.NewUserChargeGiftDialog import com.yizhuan.erban.base.BaseActivity import com.yizhuan.erban.base.BaseFragment import com.yizhuan.erban.databinding.FragmentMeBinding @@ -56,14 +60,21 @@ import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol import com.yizhuan.xchat_android_core.user.UserModel import com.yizhuan.xchat_android_core.user.bean.UserInfo import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent +import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils import com.yizhuan.xchat_android_core.utils.StarUtils import com.yizhuan.xchat_android_library.rxbus.RxBusHelper import com.yizhuan.xchat_android_library.utils.FormatUtils import com.yizhuan.xchat_android_library.utils.ListUtils +import com.yizhuan.xchat_android_library.utils.TimeUtils +import io.reactivex.Observable +import io.reactivex.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.Disposable +import io.reactivex.internal.operators.observable.ObservableRangeLong import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode import java.util.* +import java.util.concurrent.TimeUnit /** * @description: 我的 界面 @@ -81,6 +92,7 @@ class MeFragment : BaseFragment(), View.OnClickListener { private val meViewModel: MeViewModel by viewModels() private val homeViewModel: HomeViewModel by activityViewModels() private val vipViewModel: VipViewModel by viewModels() + private var newUserDisposable: Disposable? = null override fun getRootLayoutId(): Int { return R.layout.fragment_me } @@ -341,10 +353,51 @@ class MeFragment : BaseFragment(), View.OnClickListener { val star = StarUtils.getConstellation(Date(it.birth)) mBinding.tvConstellation.text = star setUserLevel(it.userLevelVo) + initNewUserCharge(it) } } + private fun initNewUserCharge(userinfo: UserInfo) { + //test + if (BuildConfig.DEBUG && !userinfo.isShowLimitCharge) { + userinfo.isShowLimitCharge = true + userinfo.limitChargeEndTime = + CurrentTimeUtils.getCurrentTime() + 2 * 60 * 1000 + 30 * 1000 + } + if (userinfo.isShowLimitCharge) { + mBinding.flNewUserCharge.isVisible = true + val count = + (userinfo.limitChargeEndTime - CurrentTimeUtils.getCurrentTime()) / 1000 / 60 + 1 + newUserDisposable?.dispose() + newUserDisposable = + Observable.intervalRange(0, count, 0, 1, TimeUnit.MINUTES) + .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW)) + .observeOn(AndroidSchedulers.mainThread()) + .doOnComplete { + userinfo.isShowLimitCharge = false + mBinding.flNewUserCharge.isVisible = false + } + .subscribe({ + val residueTime = + userinfo.limitChargeEndTime - CurrentTimeUtils.getCurrentTime() + if (residueTime <= 0) { + userinfo.isShowLimitCharge = false + mBinding.flNewUserCharge.isVisible = false + } else { + mBinding.tvNewUserChargeEndTime.text = + TimeUtil.getElapseTimeForNewUserCharge(residueTime) + } + + }, { + mBinding.flNewUserCharge.isVisible = false + it.printStackTrace() + }) + } else { + mBinding.flNewUserCharge.isVisible = false + } + } + private fun setUserLevel(userLevelVo: UserLevelVo?) { mBinding.ivUserCharm.visibility = View.GONE mBinding.ivUserLevel.visibility = View.GONE @@ -425,6 +478,7 @@ class MeFragment : BaseFragment(), View.OnClickListener { R.id.tv_user_visitor -> VisitorListActivity.start(mContext) R.id.me_item_wallet -> ChargeActivity.start(mContext) R.id.tv_user_history -> RoomHistoryListActivity.start(mContext) + R.id.fl_new_user_charge -> NewUserChargeGiftDialog.start(mContext) else -> {} } } diff --git a/app/src/main/java/com/yizhuan/erban/ui/patriarch/PatriarchModeDialog.java b/app/src/main/java/com/yizhuan/erban/ui/patriarch/PatriarchModeDialog.java index 0025d11c7..c2b5b3043 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/patriarch/PatriarchModeDialog.java +++ b/app/src/main/java/com/yizhuan/erban/ui/patriarch/PatriarchModeDialog.java @@ -1,6 +1,7 @@ package com.yizhuan.erban.ui.patriarch; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; @@ -13,8 +14,10 @@ import android.widget.ImageView; import android.widget.TextView; import com.yizhuan.erban.R; +import com.yizhuan.erban.avroom.newuserchargegift.NewUserChargeGiftDialog; import com.yizhuan.erban.base.BaseSdDialog; import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil; +import com.yizhuan.xchat_android_core.DemoCache; import butterknife.BindView; import butterknife.ButterKnife; @@ -52,6 +55,12 @@ public class PatriarchModeDialog extends BaseSdDialog { windowParams.gravity = Gravity.CENTER; window.setAttributes(windowParams); } + setOnDismissListener(dialog -> { + if (DemoCache.readNewUserChargeGift() == 1) { + NewUserChargeGiftDialog.start(context); + DemoCache.saveNewUserChargeGift(2); + } + }); } @OnClick({R.id.tv_set_pm, R.id.iv_close}) diff --git a/app/src/main/java/com/yizhuan/erban/ui/patriarch/help/PmDialogShowMrg.java b/app/src/main/java/com/yizhuan/erban/ui/patriarch/help/PmDialogShowMrg.java index d45777221..0a5b21469 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/patriarch/help/PmDialogShowMrg.java +++ b/app/src/main/java/com/yizhuan/erban/ui/patriarch/help/PmDialogShowMrg.java @@ -31,6 +31,7 @@ import lombok.Setter; */ public class PmDialogShowMrg { + @Getter private boolean hasShow; private final static String KEY_SAVE_PATRIARCH_MODE_STATUS = "key_save_patriarch_mode_status"; diff --git a/app/src/main/res/color/color_selector_white_false_999.xml b/app/src/main/res/color/color_selector_white_false_999.xml new file mode 100644 index 000000000..1a09619a7 --- /dev/null +++ b/app/src/main/res/color/color_selector_white_false_999.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_charge_btn.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_charge_btn.png new file mode 100644 index 000000000..3f88f69b6 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_charge_btn.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_gift.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_gift.png new file mode 100644 index 000000000..53a2974f3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_gift.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_me_entrance.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_me_entrance.png new file mode 100644 index 000000000..eef4cb9bd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_me_entrance.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize.png new file mode 100644 index 000000000..131baeec4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize_ok.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize_ok.png new file mode 100644 index 000000000..685a8d18e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_prize_ok.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_checked.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_checked.png new file mode 100644 index 000000000..1beca9037 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_checked.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_unchecked.png b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_unchecked.png new file mode 100644 index 000000000..eda1eec86 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_new_user_charge_rb_unchecked.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_new_user_charge_close.png b/app/src/main/res/drawable-xhdpi/ic_new_user_charge_close.png new file mode 100644 index 000000000..c7bca6bf1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_new_user_charge_close.png differ diff --git a/app/src/main/res/drawable/bg_new_user_charge_rb_plan.xml b/app/src/main/res/drawable/bg_new_user_charge_rb_plan.xml new file mode 100644 index 000000000..f253e27f7 --- /dev/null +++ b/app/src/main/res/drawable/bg_new_user_charge_rb_plan.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_new_user_charge_reward_item.xml b/app/src/main/res/drawable/bg_new_user_charge_reward_item.xml new file mode 100644 index 000000000..a9ba6c6b4 --- /dev/null +++ b/app/src/main/res/drawable/bg_new_user_charge_reward_item.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/app/src/main/res/layout/dialog_new_user_charge_gift.xml b/app/src/main/res/layout/dialog_new_user_charge_gift.xml new file mode 100644 index 000000000..4389fceae --- /dev/null +++ b/app/src/main/res/layout/dialog_new_user_charge_gift.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_new_user_charge_prize.xml b/app/src/main/res/layout/dialog_new_user_charge_prize.xml new file mode 100644 index 000000000..cbb1d4488 --- /dev/null +++ b/app/src/main/res/layout/dialog_new_user_charge_prize.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_me.xml b/app/src/main/res/layout/fragment_me.xml index 3220b2c8e..7ef524320 100644 --- a/app/src/main/res/layout/fragment_me.xml +++ b/app/src/main/res/layout/fragment_me.xml @@ -86,7 +86,7 @@ android:layout_width="60dp" android:layout_height="wrap_content" android:src="@drawable/ic_avatar_auditing" - android:visibility="@{userInfo.isReview() ?View.VISIBLE:View.GONE}" + android:visibility="@{userInfo.isReview()?View.VISIBLE:View.GONE}" app:layout_constraintBottom_toBottomOf="@id/iv_user_head" app:layout_constraintLeft_toLeftOf="@id/iv_user_head" app:layout_constraintRight_toRightOf="@id/iv_user_head" /> @@ -635,6 +635,35 @@ app:rollviewpager_hint_gravity="left" app:rollviewpager_hint_paddingBottom="8dp" /> + + + + + + + + diff --git a/app/src/main/res/layout/item_new_user_charge_reward.xml b/app/src/main/res/layout/item_new_user_charge_reward.xml new file mode 100644 index 000000000..394efd89e --- /dev/null +++ b/app/src/main/res/layout/item_new_user_charge_reward.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/DemoCache.java b/core/src/main/java/com/yizhuan/xchat_android_core/DemoCache.java index 1e86819c0..85977bfe9 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/DemoCache.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/DemoCache.java @@ -64,6 +64,7 @@ public class DemoCache { private static final String KEY_BGM_SINGLE_CYCLE = "key_bgm_single_cycle"; private static final String KEY_SINGLE_ROOM_TIP = "key_single_room_tip"; private static final String KEY_NEW_USER_GIFT = "key_new_user_gift"; + private static final String KEY_NEW_USER_CHARGE_GIFT = "key_new_user_charge_gift"; /** * 保存网页域名 */ @@ -358,11 +359,23 @@ public class DemoCache { } public static void saveNewUserGift(boolean value) { - SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_SINGLE_ROOM_TIP , value); + SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_NEW_USER_GIFT , value); } public static Boolean readNewUserGift() { - return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_SINGLE_ROOM_TIP, true); + return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_NEW_USER_GIFT, true); + } + + /** + * + * @param value 0初始值 1 需要弹窗 2 不需要弹窗 + */ + public static void saveNewUserChargeGift(int value) { + SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putInt(KEY_NEW_USER_CHARGE_GIFT , value); + } + + public static int readNewUserChargeGift() { + return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getInt(KEY_NEW_USER_CHARGE_GIFT, 0); } diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java index ef917ff33..c84d1f065 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java @@ -335,6 +335,7 @@ public class CustomAttachment implements MsgAttachment { //首充礼包 public static final int CUSTOM_MSG_FIRST_CHARGE = 76; public static final int CUSTOM_MSG_SUB_FIRST_CHARGE_PRIZE = 761; + public static final int CUSTOM_MSG_SUB_NEW_USER_CHARGE_PRIZE = 762; //访客未读 public static final int CUSTOM_MSG_HEADER_TYPE_VISITOR = 78; public static final int CUSTOM_MSG_SUB_TYPE_VISITOR_UNREAD = 781; diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMSystemMsgManager.java b/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMSystemMsgManager.java index a8ef0f113..614700842 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMSystemMsgManager.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMSystemMsgManager.java @@ -38,6 +38,7 @@ import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods; import com.yizhuan.xchat_android_core.pay.event.ChargeCustomNotificationEvent; import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent; import com.yizhuan.xchat_android_core.pay.event.FirstRechargeEvent; +import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent; import com.yizhuan.xchat_android_core.statistic.StatisticManager; import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; import com.yizhuan.xchat_android_core.user.UserModel; @@ -302,6 +303,12 @@ public class IMSystemMsgManager { event.setChargeProdTitle(firstChargeGoods.getChargeProdTitle()); event.setFirstChargeRewardList(firstChargeGoods.getFirstChargeRewardList()); EventBus.getDefault().post(event); + }else if (subType == CustomAttachment.CUSTOM_MSG_SUB_NEW_USER_CHARGE_PRIZE){ + FirstChargeGoods firstChargeGoods = data.toJavaObject(FirstChargeGoods.class); + NewUserChargeEvent event = new NewUserChargeEvent(); + event.setChargeProdTitle(firstChargeGoods.getChargeProdTitle()); + event.setFirstChargeRewardList(firstChargeGoods.getFirstChargeRewardList()); + EventBus.getDefault().post(event); } break; case CUSTOM_MSG_VIP: diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/pay/bean/FirstChargeGoods.java b/core/src/main/java/com/yizhuan/xchat_android_core/pay/bean/FirstChargeGoods.java index ee53da34e..edbb21175 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/pay/bean/FirstChargeGoods.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/pay/bean/FirstChargeGoods.java @@ -14,4 +14,5 @@ public class FirstChargeGoods { private String chargeProdTitle; private ArrayList firstChargeRewardList; private String giveMoney; + private boolean finish; } diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/pay/event/NewUserChargeEvent.java b/core/src/main/java/com/yizhuan/xchat_android_core/pay/event/NewUserChargeEvent.java new file mode 100644 index 000000000..f994bb7e7 --- /dev/null +++ b/core/src/main/java/com/yizhuan/xchat_android_core/pay/event/NewUserChargeEvent.java @@ -0,0 +1,14 @@ +package com.yizhuan.xchat_android_core.pay.event; + + +import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward; + +import java.util.ArrayList; + +import lombok.Data; + +@Data +public class NewUserChargeEvent { + private String chargeProdTitle; + private ArrayList firstChargeRewardList; +} diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/user/bean/UserInfo.java b/core/src/main/java/com/yizhuan/xchat_android_core/user/bean/UserInfo.java index d1918d510..c6c26a885 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/user/bean/UserInfo.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/user/bean/UserInfo.java @@ -273,6 +273,13 @@ public class UserInfo implements Serializable { @Setter private String iosBubbleUrl; + @Getter + @Setter + private boolean showLimitCharge; + @Getter + @Setter + private long limitChargeEndTime; + public UserInfo() { } diff --git a/nim_uikit/src/com/netease/nim/uikit/common/util/sys/TimeUtil.java b/nim_uikit/src/com/netease/nim/uikit/common/util/sys/TimeUtil.java index 06dafa77a..8c55d1aa3 100644 --- a/nim_uikit/src/com/netease/nim/uikit/common/util/sys/TimeUtil.java +++ b/nim_uikit/src/com/netease/nim/uikit/common/util/sys/TimeUtil.java @@ -302,6 +302,23 @@ public class TimeUtil { return sb.toString(); } + public static String getElapseTimeForNewUserCharge(long milliseconds) { + StringBuilder sb = new StringBuilder(); + long seconds = milliseconds / 1000; + if (seconds < 1) seconds = 1; + + long day = seconds / (60 * 60 * 24); + sb.append(day).append("天"); + + long hour = seconds / (60 * 60) % 24; + sb.append(hour).append("时"); + + long minute = (seconds - 60 * 60 * hour) / 60; + sb.append(minute).append("分"); + + return sb.toString(); + } + public static String getElapseTimeForShow(int milliseconds) { StringBuilder sb = new StringBuilder(); int seconds = milliseconds / 1000;