Cp升级消息跳转装扮 邀请弹窗文案修改 关系任务界面调整
This commit is contained in:
@@ -60,7 +60,7 @@ class ContactsListFragment : BaseViewBindingFragment<FragmentContactListBinding>
|
||||
FansListActivity.start(requireContext(), FansListActivity.TYPE_FRIEND)
|
||||
}
|
||||
binding.tvRelation.setOnClickListener {
|
||||
CpInviteRecordActivity.start(requireContext())
|
||||
CpInviteRecordActivity.start(requireContext(),false)
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.yizhuan.erban.relation.cp;
|
||||
|
||||
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteInfo;
|
||||
|
||||
public class CpDataManager {
|
||||
|
||||
public static class Holder {
|
||||
private static final CpDataManager INSTANCE = new CpDataManager();
|
||||
}
|
||||
|
||||
public static CpDataManager get() {
|
||||
return CpDataManager.Holder.INSTANCE;
|
||||
}
|
||||
|
||||
private CpInviteInfo cpInviteInfo;
|
||||
|
||||
public CpInviteInfo getCpInviteInfo() {
|
||||
return cpInviteInfo;
|
||||
}
|
||||
|
||||
public void setCpInviteInfo(CpInviteInfo cpInviteInfo) {
|
||||
this.cpInviteInfo = cpInviteInfo;
|
||||
}
|
||||
|
||||
|
||||
public void clearCpInviteInfo() {
|
||||
setCpInviteInfo(null);
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package com.yizhuan.erban.relation.cp
|
||||
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteInfo
|
||||
import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
|
||||
object CpDataParser {
|
||||
fun inviteMsg2cpListEntity(msgEntity: CpInviteInfo) = UserCpListEntity(
|
||||
msgEntity.acceptUid, msgEntity.acceptAvatar, msgEntity.acceptNick,
|
||||
msgEntity.acceptGender, msgEntity.replyExpireTime, msgEntity.recommenTxt,
|
||||
0, msgEntity.inviteUid, msgEntity.inviteAvatar, msgEntity.inviteNick,
|
||||
msgEntity.inviteGender, 0, msgEntity.propsId, msgEntity.propsImg,
|
||||
msgEntity.propsName, msgEntity.propsPrice, 0, 0, msgEntity.replyExpireTime
|
||||
)
|
||||
|
||||
/**
|
||||
* val replyExpireTime: String,
|
||||
val inviteUid: Long,
|
||||
val inviteAvatar: String,
|
||||
val inviteNick: String,
|
||||
val inviteGender: Int,
|
||||
val acceptUid: Long,
|
||||
val acceptAvatar: String,
|
||||
val acceptNick: String,
|
||||
val acceptGender: Int,
|
||||
val propsId: Int,
|
||||
val propsName: String,
|
||||
val propsImg: String,
|
||||
val propsPrice: String,
|
||||
val recommenTxtList: List<String>,
|
||||
val recommenTxt: String
|
||||
*/
|
||||
}
|
@@ -55,6 +55,18 @@ object CpViewHelper {
|
||||
)
|
||||
}
|
||||
|
||||
fun getSizeSpan(text: String, size: Float, start: Int, end: Int) =
|
||||
SpannableStringBuilder(text).apply {
|
||||
val sizeSpan = AbsoluteSizeSpan(ScreenUtil.dip2px(size))
|
||||
setSpan(
|
||||
sizeSpan,
|
||||
start,
|
||||
end,
|
||||
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun showInviteTipDialog(
|
||||
context: Context,
|
||||
title: String,
|
||||
|
@@ -9,6 +9,8 @@ import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseBindingActivity
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.ActivityCpInviteRecordBinding
|
||||
import com.yizhuan.erban.relation.cp.CpDataManager
|
||||
import com.yizhuan.erban.relation.cp.CpDataParser
|
||||
import com.yizhuan.erban.relation.cp.CpViewHelper
|
||||
import com.yizhuan.erban.relation.cp.adapter.InviteRecordAdapter
|
||||
import com.yizhuan.erban.relation.cp.dialog.CpInviteReplyConfirmDialog
|
||||
@@ -27,30 +29,24 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
private val vm: CpViewModel by viewModels()
|
||||
private lateinit var adapter: InviteRecordAdapter
|
||||
private val type = 1// 1-别人给我发的邀请,2-我给别人发的邀请
|
||||
private val confirmDialog: CpInviteReplyConfirmDialog by lazy {
|
||||
CpInviteReplyConfirmDialog(this)
|
||||
}
|
||||
private val replyDialog: CpInviteReplyDialog by lazy {
|
||||
CpInviteReplyDialog(this)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
initTitleBar("关系申请")
|
||||
EventBus.getDefault().register(this)
|
||||
|
||||
adapter = InviteRecordAdapter(this)
|
||||
adapter.onVisitClickListener = object : InviteRecordAdapter.OnVisitClickListener {
|
||||
override fun onVisitClick(item: UserCpListEntity) {
|
||||
onItemClick(item)
|
||||
val needAlert = intent.getBooleanExtra("needAlert", false)
|
||||
if (needAlert) {
|
||||
CpDataManager.get().cpInviteInfo?.let {
|
||||
showReplyDialog(CpDataParser.inviteMsg2cpListEntity(it))
|
||||
}
|
||||
}
|
||||
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
mBinding.recyclerView.layoutManager = layoutManager
|
||||
adapter.emptyView = EmptyViewHelper.createEmptyView(this, "暂无数据")
|
||||
adapter.bindToRecyclerView(mBinding.recyclerView)
|
||||
mBinding.swipeRefresh.setOnRefreshListener {
|
||||
initRecyclerView()
|
||||
initObserver()
|
||||
|
||||
queryRecord(type)
|
||||
}
|
||||
|
||||
private fun initObserver() {
|
||||
EventBus.getDefault().register(this)
|
||||
vm.userCpListData.observe(this) {
|
||||
adapter.setNewData(it)
|
||||
}
|
||||
@@ -62,25 +58,12 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
mBinding.swipeRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
queryRecord(type)
|
||||
}
|
||||
|
||||
private fun queryRecord(type: Int) {
|
||||
vm.getUserCpListData(type)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun start(context: Context) {
|
||||
val intent = Intent(context, CpInviteRecordActivity::class.java)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onItemClick(item: UserCpListEntity) {
|
||||
replyDialog.cpInviteData = item
|
||||
if (replyDialog.listener == null) {
|
||||
replyDialog.listener = object : CpInviteReplyDialog.ReplyListener {
|
||||
private fun showReplyDialog(item: UserCpListEntity) {
|
||||
CpInviteReplyDialog(context).apply {
|
||||
cpInviteData = item
|
||||
listener = object : CpInviteReplyDialog.ReplyListener {
|
||||
override fun onAgree() {
|
||||
showConfirmDialog(item, true)
|
||||
}
|
||||
@@ -89,28 +72,59 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
showConfirmDialog(item, false)
|
||||
}
|
||||
}
|
||||
openDialog()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initRecyclerView() {
|
||||
adapter = InviteRecordAdapter(this)
|
||||
adapter.onVisitClickListener = object : InviteRecordAdapter.OnVisitClickListener {
|
||||
override fun onVisitClick(item: UserCpListEntity) {
|
||||
showReplyDialog(item)
|
||||
}
|
||||
}
|
||||
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
mBinding.recyclerView.layoutManager = layoutManager
|
||||
adapter.emptyView = EmptyViewHelper.createEmptyView(this, "暂无数据")
|
||||
adapter.bindToRecyclerView(mBinding.recyclerView)
|
||||
mBinding.swipeRefresh.setOnRefreshListener {
|
||||
queryRecord(type)
|
||||
}
|
||||
}
|
||||
|
||||
private fun queryRecord(type: Int) {
|
||||
vm.getUserCpListData(type)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun start(context: Context, needAlert: Boolean) {
|
||||
val intent = Intent(context, CpInviteRecordActivity::class.java)
|
||||
intent.putExtra("needAlert", needAlert)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
if (replyDialog.isShowing) replyDialog.closeDialog()
|
||||
replyDialog.openDialog()
|
||||
}
|
||||
|
||||
private fun showConfirmDialog(item: UserCpListEntity, isAgree: Boolean) {
|
||||
confirmDialog.setDialogTitle(
|
||||
CpViewHelper.getColorSpan(
|
||||
"是否${if (isAgree) "同意" else "拒绝"}与${item.inviteUserNick}成为CP?",
|
||||
val shb = CpViewHelper.getColorSpan(
|
||||
"是否${if (isAgree) "同意" else "拒绝"}与${item.inviteUserNick}成为CP?\n",
|
||||
Color.parseColor("#4C5AF1"),
|
||||
5, item.inviteUserNick.length
|
||||
)
|
||||
)
|
||||
if (confirmDialog.okCancelListener == null) {
|
||||
confirmDialog.okCancelListener = object : CommonTipDialog.OnActionListener {
|
||||
if (isAgree) {
|
||||
val str = "(同意将自动拒绝其他邀请)"
|
||||
val append = CpViewHelper.getSizeSpan(str, 12f, 0, str.length)
|
||||
shb.append(append)
|
||||
}
|
||||
|
||||
CpInviteReplyConfirmDialog(context).apply {
|
||||
setDialogTitle(shb)
|
||||
okCancelListener = object : CommonTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
vm.replyInvite(item.id, if (isAgree) 2 else 3)
|
||||
}
|
||||
}
|
||||
openDialog()
|
||||
}
|
||||
if (confirmDialog.isShowing) confirmDialog.closeDialog()
|
||||
confirmDialog.openDialog()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -121,5 +135,6 @@ class CpInviteRecordActivity : BaseBindingActivity<ActivityCpInviteRecordBinding
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
CpDataManager.get().clearCpInviteInfo()
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.activity.viewModels
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityCpTaskBinding
|
||||
@@ -13,9 +14,13 @@ import com.yizhuan.erban.relation.cp.adapter.TaskPagerAdapter
|
||||
import com.yizhuan.erban.relation.cp.fragment.CpTaskFragment
|
||||
import com.yizhuan.erban.relation.cp.viewmodel.CpViewModel
|
||||
import com.yizhuan.erban.relation.cp.widget.CpTaskDescriptionView
|
||||
import com.yizhuan.erban.relation.extention.visibility
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.ui.widget.OnPageSelectedListener
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpTaskEntity
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
|
||||
@ActLayoutRes(R.layout.activity_cp_task)
|
||||
@@ -35,20 +40,44 @@ class CpTaskActivity : BaseBindingActivity<ActivityCpTaskBinding>(),
|
||||
if (it) dialogManager.showProgressDialog(this)
|
||||
else dialogManager.dismissDialog()
|
||||
}
|
||||
vm.cpTaskData.observe(this) {
|
||||
setTaskProgress(it)
|
||||
}
|
||||
vm.cpTaskProcess(AuthModel.get().currentUid)
|
||||
setViewPager()
|
||||
setCpLevelContent()
|
||||
setCpLevelDesc()
|
||||
}
|
||||
|
||||
private fun setTaskProgress(entity: CpTaskEntity) {
|
||||
ImageLoadUtilsV2.loadAvatar(mBinding.ivAccept, entity.cpAvatar)
|
||||
ImageLoadUtilsV2.loadAvatar(mBinding.ivInvite, entity.avatar)
|
||||
mBinding.tvLevel.text =
|
||||
String.format(resources.getString(R.string.cp_level, entity.cpLevel.toString()))
|
||||
val progress = ((entity.cpSecretVal.toFloat() / entity.cpNextLevelSecretVal) * 100).toInt()
|
||||
mBinding.progressBar.progress = progress
|
||||
mBinding.tvProgress.text = "${entity.cpSecretVal}/${entity.cpNextLevelSecretVal}"
|
||||
var pl = mBinding.progressBar.width * (progress * 1f / 100).toInt() - ScreenUtil.dip2px(10f)
|
||||
if (pl < 0) pl = ScreenUtil.dip2px(5f)
|
||||
mBinding.tvProgress.setPadding(pl, 0, 0, 0)
|
||||
mBinding.ivDropDown.visibility = entity.isDamp.visibility()
|
||||
}
|
||||
|
||||
private fun setViewPager() {
|
||||
val list = ArrayList<String>(2)
|
||||
list.add("每日甜蜜")
|
||||
list.add("海誓山盟")
|
||||
val commonNavigator = CpTaskIndicatorAdapter(list)
|
||||
commonNavigator.setOnItemSelectListener(this)
|
||||
|
||||
val commonNavigator = CommonNavigator(this)
|
||||
commonNavigator.isAdjustMode = true
|
||||
val indicator = CpTaskIndicatorAdapter(list)
|
||||
indicator.setOnItemSelectListener(this)
|
||||
commonNavigator.adapter = indicator
|
||||
mBinding.indicator.navigator = commonNavigator
|
||||
mBinding.viewPager.adapter = pagerAdapter
|
||||
mBinding.viewPager.addOnPageChangeListener(object : OnPageSelectedListener() {
|
||||
override fun onPageSelected(position: Int) {}
|
||||
override fun onPageSelected(position: Int) {
|
||||
mBinding.viewPager.requestLayout()
|
||||
}
|
||||
})
|
||||
ViewPagerHelper.bind(mBinding.indicator, mBinding.viewPager)
|
||||
}
|
||||
@@ -56,7 +85,7 @@ class CpTaskActivity : BaseBindingActivity<ActivityCpTaskBinding>(),
|
||||
/**
|
||||
* 设置亲密度简介
|
||||
*/
|
||||
private fun setCpLevelContent() {
|
||||
private fun setCpLevelDesc() {
|
||||
val titles = resources.getStringArray(R.array.cp_task_title)
|
||||
val contents = resources.getStringArray(R.array.cp_task_content)
|
||||
val intimacyTitles = resources.getStringArray(R.array.cp_task_intimacy_title)
|
||||
|
@@ -1,15 +1,17 @@
|
||||
package com.yizhuan.erban.relation.cp.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,7 +24,7 @@ import java.util.List;
|
||||
public class CpTaskIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
private List<String> mTitleList;
|
||||
|
||||
public CpTaskIndicatorAdapter( List<String> mTitleList) {
|
||||
public CpTaskIndicatorAdapter(List<String> mTitleList) {
|
||||
this.mTitleList = mTitleList;
|
||||
}
|
||||
|
||||
@@ -57,32 +59,30 @@ public class CpTaskIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
void onItemSelect(int position);
|
||||
}
|
||||
|
||||
class WithdrawBillsPagerTitleView extends AppCompatTextView implements IPagerTitleView {
|
||||
class WithdrawBillsPagerTitleView extends FrameLayout implements IPagerTitleView {
|
||||
|
||||
|
||||
public WithdrawBillsPagerTitleView(Context context, String tabInfo) {
|
||||
super(context);
|
||||
setWidth(Utils.dip2px(getContext(), 173));
|
||||
setHeight(Utils.dip2px(getContext(), 40));
|
||||
setTextSize(Utils.dip2px(getContext(),18));
|
||||
setText(tabInfo);
|
||||
setGravity(Gravity.CENTER);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_cp_task_indicator,this,true);
|
||||
((TextView) getChildAt(0)).setText(tabInfo);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSelected(int index, int totalCount) {
|
||||
setBackgroundResource(R.drawable.bg_cp_task_label_selected);
|
||||
setHeight(Utils.dip2px(getContext(), 40));
|
||||
setTextColor(getResources().getColor(R.color.white));
|
||||
TextView tv = (TextView) getChildAt(0);
|
||||
tv.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.bg_cp_task_label_selected));
|
||||
tv.setHeight(ScreenUtil.dip2px(40f));
|
||||
tv.setTextColor(getResources().getColor(R.color.white));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeselected(int index, int totalCount) {
|
||||
setBackgroundDrawable(null);
|
||||
setHeight(Utils.dip2px(getContext(), 32));
|
||||
setTextColor(getResources().getColor(R.color.color_999999));
|
||||
TextView tv = (TextView) getChildAt(0);
|
||||
tv.setBackground(null);
|
||||
tv.setHeight(ScreenUtil.dip2px(32f));
|
||||
tv.setTextColor(getResources().getColor(R.color.color_999999));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -6,6 +6,7 @@ import android.view.View
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.databinding.DialogCpGlobalBinding
|
||||
import com.yizhuan.erban.relation.cp.CpDataManager
|
||||
import com.yizhuan.erban.relation.cp.activity.CpInviteRecordActivity
|
||||
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
@@ -29,8 +30,10 @@ class CpGlobalDialog(context: Context) :
|
||||
|
||||
override fun init() {
|
||||
window?.attributes?.let {
|
||||
it.y = ScreenUtil.dip2px(44f)
|
||||
it.dimAmount = 1f
|
||||
it.y = ScreenUtil.statusbarheight
|
||||
it.dimAmount = 0f
|
||||
it.width = ((345f / 375f).toInt())
|
||||
it.height = ScreenUtil.dip2px(80f)
|
||||
gravity = Gravity.TOP
|
||||
}
|
||||
binding.ivClose.setOnClickListener(this)
|
||||
@@ -38,8 +41,8 @@ class CpGlobalDialog(context: Context) :
|
||||
setCancelable(false)
|
||||
|
||||
entity?.let {
|
||||
ImageLoadUtilsV2.loadAvatar(binding.ivAvatar,entity?.inviteAvatar)
|
||||
binding.tvNick.text=it.inviteNick
|
||||
ImageLoadUtilsV2.loadAvatar(binding.ivAvatar, entity?.inviteAvatar)
|
||||
binding.tvNick.text = it.inviteNick
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +52,8 @@ class CpGlobalDialog(context: Context) :
|
||||
closeDialog()
|
||||
}
|
||||
R.id.tv_visit -> {
|
||||
CpInviteRecordActivity.start(context)
|
||||
CpDataManager.get().cpInviteInfo = entity
|
||||
CpInviteRecordActivity.start(context, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +70,10 @@ class CpGlobalDialog(context: Context) :
|
||||
|
||||
override fun onNext(t: Long) {
|
||||
binding.tvSec.text = "${5L - t}s"
|
||||
if (t == 5L) unregisterTimer()
|
||||
if (t == 5L) {
|
||||
unregisterTimer()
|
||||
closeDialog()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {}
|
||||
|
@@ -37,6 +37,9 @@ class CpInvitePageDialog(context: Context) : View.OnClickListener,
|
||||
binding.editDeclaration.setText(it)
|
||||
}
|
||||
}
|
||||
invitePageEntity?.recommenTxtList?.let {
|
||||
adapter.setNewData(it)
|
||||
}
|
||||
initSpannable()
|
||||
binding.tvSend.setOnClickListener(this)
|
||||
binding.ivClose.setOnClickListener(this)
|
||||
|
@@ -2,15 +2,14 @@ package com.yizhuan.erban.relation.cp.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.TextUtils
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.View
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.databinding.DialogCpInviteReplyBinding
|
||||
import com.yizhuan.erban.relation.cp.CpViewHelper
|
||||
import com.yizhuan.erban.relation.cp.CpViewHelper.getColorSpan
|
||||
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.utils.TimeUiUtils
|
||||
import com.yizhuan.xchat_android_core.relation.cp.UserCpListEntity
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
@@ -19,7 +18,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.lang.Exception
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@ActLayoutRes(R.layout.dialog_cp_invite_reply)
|
||||
@@ -33,6 +31,7 @@ class CpInviteReplyDialog(context: Context) :
|
||||
var cpInviteData: UserCpListEntity? = null
|
||||
var listener: ReplyListener? = null
|
||||
override fun init() {
|
||||
width = ((292f / 375) * ScreenUtil.screenWidth).toInt()
|
||||
binding.click = this
|
||||
cpInviteData?.let {
|
||||
setPage(it)
|
||||
@@ -49,30 +48,36 @@ class CpInviteReplyDialog(context: Context) :
|
||||
)
|
||||
CpViewHelper.setInviteTimeRemain(data.updateTime, binding.tvTime)
|
||||
CpViewHelper.setInviteGiftPriceStyle(context, data.propsPrice, binding.tvPrice)
|
||||
binding.tvDeclaration.text = data.declaration
|
||||
ImageLoadUtilsV2.loadImage(binding.ivGift, cpInviteData?.propsImg)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.tv_refuse -> {
|
||||
listener?.onRefuse()
|
||||
closeDialog()
|
||||
}
|
||||
R.id.tv_agree -> {
|
||||
listener?.onAgree()
|
||||
closeDialog()
|
||||
}
|
||||
R.id.iv_close -> closeDialog()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (TextUtils.isEmpty(cpInviteData?.updateTime)) return
|
||||
try {
|
||||
val arr = cpInviteData?.updateTime?.split(":")
|
||||
if (arr != null) {
|
||||
val h = arr.getOrNull(0)?.toInt() ?: 0 * 3600
|
||||
val m = arr.getOrNull(1)?.toInt() ?: 0 * 60
|
||||
val s = arr.getOrNull(2)?.toInt() ?: 0
|
||||
val remain = h + m + s
|
||||
cpInviteData?.updateTime?.let {
|
||||
val time = it.toLong()
|
||||
val current = System.currentTimeMillis() / 1000
|
||||
val remain = time - current
|
||||
countDown(remain)
|
||||
}
|
||||
}
|
||||
|
||||
private fun countDown(remain: Long) {
|
||||
Observable.interval(1000, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -82,21 +87,19 @@ class CpInviteReplyDialog(context: Context) :
|
||||
}
|
||||
|
||||
override fun onNext(t: Long) {
|
||||
val s = TimeUiUtils.getDynamicUi((remain - 1) * 1000.toLong())
|
||||
val s = TimeUiUtils.getDynamicUi((remain - 1) * 1000)
|
||||
CpViewHelper.setInviteTimeRemain(s, binding.tvTime)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
throw e
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
})
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
stopCountDown()
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
stopCountDown()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
@@ -23,7 +23,7 @@ class CpTaskFragment : BaseBindingFragment<FragmentCpTaskBinding>() {
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter = CpTaskAdapter()
|
||||
adapter.bindToRecyclerView(mBinding.recyclerView)
|
||||
vm.cpTaskData.value?.let {
|
||||
vm.cpTaskData.observe(this){
|
||||
when (pageType) {
|
||||
TYPE_DAILY -> {
|
||||
adapter.setNewData(it.dailyTask)
|
||||
|
@@ -100,6 +100,6 @@ interface Api {
|
||||
*/
|
||||
@GET("/user/couple/cpTaskProcess")
|
||||
suspend fun cpTaskProcess(
|
||||
@Query("uid ") uid: Long
|
||||
@Query("uid") uid: Long
|
||||
): ServiceResult<CpTaskEntity>
|
||||
}
|
@@ -6,6 +6,8 @@ import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
@@ -25,6 +27,9 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
||||
init {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.layout_cp_card, this, false)
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
|
||||
params.gravity = Gravity.CENTER
|
||||
addView(binding.root, params)
|
||||
}
|
||||
|
||||
private fun setPageData(
|
||||
@@ -45,28 +50,25 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
||||
var height = 0
|
||||
when (type) {
|
||||
PAGE_TYPE_SELF_CP -> {
|
||||
if (cpRelation == null) throw Exception("type:PAGE_TYPE_SELF_CP,cpRelation: CpRelation cant be null!!!")
|
||||
if (cpRelation == null) return
|
||||
userInfoVisibility = true
|
||||
cpLevelVisibility = cpRelation.waitUnbound
|
||||
binding.tvCpTime.setTextColor(context.resources.getColor(R.color.white))
|
||||
unbindRecoverVisibility = cpRelation.waitUnbound
|
||||
unbindVisibility =
|
||||
(cpRelation.uid == selfUId) && cpRelation.cpUid != 0L && !cpRelation.waitUnbound
|
||||
if (unbindRecoverVisibility && cpRelation.uid != selfUId) {
|
||||
binding.tvRecoveryUnbind.text = "关系解绑中"
|
||||
binding.tvRecoveryUnbind.isEnabled = false
|
||||
}
|
||||
unbindVisibility = cpRelation.cpUid != 0L && !cpRelation.waitUnbound//双方都能解绑
|
||||
setUnbindButton(cpRelation, selfUId)
|
||||
height = ScreenUtil.dip2px(180f)
|
||||
}
|
||||
PAGE_TYPE_SELF_INFO -> {
|
||||
if (cpRelation == null) throw Exception("type:PAGE_TYPE_SELF_INFO,cpRelation: CpRelation cant be null!!!")
|
||||
if (cpRelation == null) return
|
||||
userInfoVisibility = true
|
||||
cpLevelVisibility = cpRelation.cpUid != 0.toLong()
|
||||
binding.tvCpTime.setTextColor(Color.parseColor("#917FFF"))
|
||||
height = LayoutParams.WRAP_CONTENT
|
||||
declarationVisibility = cpRelation.cpUid != 0.toLong()
|
||||
}
|
||||
PAGE_TYPE_CUS_INFO -> {
|
||||
if (cpRelation == null) throw Exception("type:PAGE_TYPE_CUS_INFO,cpRelation: CpRelation cant be null!!!")
|
||||
if (cpRelation == null) return
|
||||
userInfoVisibility = cpRelation.cpUid != 0.toLong()
|
||||
cpLevelVisibility = cpRelation.cpUid != 0.toLong()
|
||||
binding.tvCpTime.setTextColor(Color.parseColor("#917FFF"))
|
||||
@@ -95,13 +97,28 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
||||
binding.btnBind.visibility = groupEmptyVisibility.visibility()
|
||||
binding.ivInvite.visibility = groupEmptyVisibility.visibility()
|
||||
binding.tvDeclaration.visibility = declarationVisibility.visibility()
|
||||
binding.ivUnbind.visibility = unbindVisibility.visibility()
|
||||
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, height)
|
||||
params.gravity = Gravity.CENTER
|
||||
addView(binding.root, params)
|
||||
binding.flMenu.visibility = unbindVisibility.visibility()
|
||||
binding.cpEntity = cpRelation
|
||||
binding.root.layoutParams?.height = height
|
||||
requestLayout()
|
||||
}
|
||||
|
||||
private fun setUnbindButton(
|
||||
cpRelation: CpRelation,
|
||||
selfUId: Long
|
||||
) {
|
||||
if (cpRelation.waitUnbound) {
|
||||
if (cpRelation.unboundUid != selfUId) {
|
||||
binding.tvRecoveryUnbind.text = "关系解绑中"
|
||||
binding.tvRecoveryUnbind.isEnabled = false
|
||||
binding.tvRecoveryUnbind.background = null
|
||||
} else {
|
||||
binding.tvRecoveryUnbind.text = "撤销解除关系"
|
||||
binding.tvRecoveryUnbind.isEnabled = true
|
||||
binding.tvRecoveryUnbind.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.bg_ff696f_ffafc3_cornor_4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setBackground(
|
||||
@@ -129,6 +146,10 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
||||
|
||||
fun setClick(click: OnClickListener) {
|
||||
binding.click = click
|
||||
binding.ivMore.setOnClickListener {
|
||||
val visible = (!binding.ivUnbind.isVisible)
|
||||
binding.ivUnbind.visibility = visible.visibility()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@@ -36,6 +36,7 @@ import com.yizhuan.erban.ui.withdraw.BinderAlipayActivity;
|
||||
import com.yizhuan.erban.vip.VipMainActivity;
|
||||
import com.yizhuan.tutu.mentoring_relationship.activity.MentoringRelationshipActivity;
|
||||
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.community.event.SquareTaskEvent;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RouterType;
|
||||
@@ -284,10 +285,10 @@ public class RouterHandler {
|
||||
VipMainActivity.start(context);
|
||||
break;
|
||||
case RouterType.CP_INVITE:
|
||||
CpInviteRecordActivity.Companion.start(context);
|
||||
CpInviteRecordActivity.Companion.start(context, false);
|
||||
break;
|
||||
case RouterType.CP_HEAD_WARE:
|
||||
|
||||
CommonWebViewActivity.start(context, UriProvider.getCpDecorationUrl());
|
||||
break;
|
||||
case RouterType.CP_TASK:
|
||||
CpTaskActivity.Companion.start(context);
|
||||
|
@@ -0,0 +1,44 @@
|
||||
package com.yizhuan.erban.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/10/31
|
||||
*/
|
||||
public class WrapContentViewPager extends ViewPager {
|
||||
public WrapContentViewPager(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public WrapContentViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int height = 0;
|
||||
//下面遍历所有child的高度
|
||||
final int position = getCurrentItem();
|
||||
View child = getChildAt(position);
|
||||
if (child != null) {
|
||||
child.measure(widthMeasureSpec,
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
height = child.getMeasuredHeight();
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/bg_cp_more_popup.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_cp_more_popup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_cp_more.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_cp_more.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 311 B |
BIN
app/src/main/res/drawable-xhdpi/ic_cp_task_down.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_cp_task_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 636 B |
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -14,21 +14,23 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:fillViewport="true"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingTop="@dimen/dp_8"
|
||||
android:paddingRight="@dimen/dp_15"
|
||||
android:paddingBottom="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_task_bottom"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_task_progress"
|
||||
@@ -41,9 +43,10 @@
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
<com.yizhuan.erban.ui.widget.WrapContentViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -76,67 +79,90 @@
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_task_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="76dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="@drawable/bg_cp_task_label_selected"
|
||||
>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/scroll_view">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guide_line"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:layoutDirection="ltr"
|
||||
app:layout_constraintGuide_begin="95dp"
|
||||
android:id="@+id/guide_line"
|
||||
/>
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="95dp" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_accept"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/iv_accept"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="@id/guide_line"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_invite"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/iv_invite"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginRight="@dimen/dp_33"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="@id/iv_accept"
|
||||
android:layout_marginRight="@dimen/dp_33"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/tv_level"
|
||||
android:layout_marginLeft="@dimen/dp_4"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintLeft_toRightOf="@id/guide_line"
|
||||
android:layout_marginLeft="@dimen/dp_4"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/progress_bar"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
/>
|
||||
app:layout_constraintLeft_toRightOf="@id/guide_line"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="12dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginLeft="@dimen/dp_4"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_level"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:progress="20"
|
||||
android:progressDrawable="@drawable/bg_cp_task_progress_bar"
|
||||
app:layout_constraintLeft_toRightOf="@id/guide_line"
|
||||
android:layout_marginRight="@dimen/dp_8"
|
||||
android:max="100"
|
||||
android:id="@+id/progress_bar"
|
||||
/>
|
||||
android:progress="20"
|
||||
android:progressDrawable="@drawable/bg_cp_task_progress_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/guide_line"
|
||||
app:layout_constraintRight_toLeftOf="@id/iv_drop_down"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_level" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_drop_down"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_4"
|
||||
android:src="@drawable/ic_cp_task_down"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/progress_bar"
|
||||
app:layout_constraintLeft_toRightOf="@id/progress_bar"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/progress_bar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/dp_4"
|
||||
android:paddingRight="@dimen/dp_4"
|
||||
android:textColor="#4C5AF1"
|
||||
android:textSize="8sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/progress_bar"
|
||||
app:layout_constraintLeft_toLeftOf="@id/progress_bar"
|
||||
app:layout_constraintTop_toTopOf="@id/progress_bar"
|
||||
tools:text="20/100" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -5,8 +5,6 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/bg_cp_dialog_global"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
@@ -57,7 +55,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintLeft_toLeftOf="@id/space"
|
||||
tools:text="这就是大哥呀呀"
|
||||
android:text="向你发送了一条CP邀请"
|
||||
app:layout_constraintRight_toLeftOf="@id/barrier_right"
|
||||
/>
|
||||
|
||||
|
@@ -18,17 +18,17 @@
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_35"
|
||||
android:src="@drawable/ic_invite_dialog_close"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/ic_invite_dialog_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/dp_20"
|
||||
android:layout_marginTop="1dp"
|
||||
android:background="@drawable/bg_dialog_cp_invite_replay"
|
||||
android:paddingBottom="@dimen/dp_20"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_close">
|
||||
|
||||
@@ -63,11 +63,22 @@
|
||||
tools:text="一二三四五一二三四五一二三四五 邀请你达" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:id="@+id/iv_gift"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_declaration"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tv_declaration"
|
||||
app:layout_constraintRight_toRightOf="@id/tv_declaration"
|
||||
android:layout_marginTop="@dimen/dp_21"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="146dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="102dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:background="@drawable/bg_invite_dialog_price"
|
||||
android:gravity="center"
|
||||
android:text="邀请函\n52000钻石"
|
||||
@@ -75,7 +86,7 @@
|
||||
android:textSize="@dimen/sp_13"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_declaration" />
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -86,6 +97,7 @@
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/bg_invite_reply_refuse"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="拒绝"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
@@ -103,6 +115,7 @@
|
||||
android:background="@drawable/bg_invite_reply_agree"
|
||||
android:gravity="center"
|
||||
android:text="同意"
|
||||
android:onClick="@{click}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintLeft_toRightOf="@id/tv_refuse"
|
||||
@@ -119,7 +132,10 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_refuse"
|
||||
tools:text="内决定,过期自动失效!" />
|
||||
tools:text="内决定,过期自动失效!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="70dp"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
@@ -1,13 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
android:layout_height="wrap_content" />
|
||||
</layout>
|
@@ -5,7 +5,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:background="@drawable/bg_white_cornor_4"
|
||||
android:paddingLeft="@dimen/dp_8"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="@dimen/dp_8"
|
||||
|
@@ -225,24 +225,45 @@
|
||||
android:paddingLeft="@dimen/dp_8"
|
||||
android:paddingRight="@dimen/dp_8"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@{cpEntity.declaration}"
|
||||
android:textColor="#9B8AFF"
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_mine_name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_unbind"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginRight="@dimen/dp_7"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/nim_ic_menu_normal"
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_menu"
|
||||
android:layout_width="77dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="@dimen/dp_8"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_gravity="top|right"
|
||||
android:src="@drawable/ic_cp_more" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_unbind"
|
||||
android:layout_width="77dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_cp_more_popup"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="解除关系"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
18
app/src/main/res/layout/layout_cp_task_indicator.xml
Normal file
18
app/src/main/res/layout/layout_cp_task_indicator.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="173dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/transparent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="@dimen/dp_8"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_18" />
|
||||
</merge>
|
@@ -19,9 +19,11 @@
|
||||
注:一旦亲密值开始减少,CP等级后会出现“↓”标志提醒;</item>
|
||||
<item>每个等级所需亲密值不同,等级越高,所需亲密值越多,上限为10级;</item>
|
||||
<item>CP等级是双方亲密程度的体现,达到对应等级可以获得对应特权;</item>
|
||||
<item>1)CP铭牌需自行定制(通过前往我的装扮页点击“定制关系铭牌”处进行定制)\n
|
||||
<item>
|
||||
1)CP铭牌需自行定制(通过前往我的装扮页点击“定制关系铭牌”处进行定制)\n
|
||||
2)CP位自动展示最高等级\n
|
||||
3)CP头饰自动发放至“我的装扮”中</item>
|
||||
3)CP头饰自动发放至“我的装扮”中
|
||||
</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="cp_task_intimacy_title">
|
||||
|
@@ -386,4 +386,11 @@ public class UriProvider {
|
||||
public static String getVipHelpUrl() {
|
||||
return JAVA_WEB_URL.concat("/yinyou/modules/rule/introduction-patrician.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cp装扮
|
||||
*/
|
||||
public static String getCpDecorationUrl() {
|
||||
return JAVA_WEB_URL.concat("/yinyou/activity/act-nameplate-cp/index.html");
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteInfo;
|
||||
import com.yizhuan.xchat_android_core.relation.cp.CpInviteMessage;
|
||||
|
||||
import lombok.val;
|
||||
|
||||
public class CpInviteAttachment extends CustomAttachment {
|
||||
|
||||
@@ -13,6 +18,8 @@ public class CpInviteAttachment extends CustomAttachment {
|
||||
public int mSecond;
|
||||
private CpInviteInfo entity;
|
||||
|
||||
final String TAG = "CpInviteAttachment";
|
||||
|
||||
public CpInviteAttachment(int second) {
|
||||
super(CustomAttachment.CP_INVITE_MESSAGE, second);
|
||||
}
|
||||
@@ -21,18 +28,13 @@ public class CpInviteAttachment extends CustomAttachment {
|
||||
protected void parseData(JSONObject data) {
|
||||
super.parseData(data);
|
||||
if (data != null) {
|
||||
if (data.containsKey("msg")) {
|
||||
msg = data.getString("msg");
|
||||
}
|
||||
if (data.containsKey("routerType")) {
|
||||
routerType = data.getInteger("routerType");
|
||||
}
|
||||
if (data.containsKey("popInfo")) {
|
||||
entity = new Gson().fromJson(routerValue, CpInviteInfo.class);
|
||||
}
|
||||
if (data.containsKey("title")) {
|
||||
title = data.getString("title");
|
||||
}
|
||||
final Gson gson = new Gson();
|
||||
CpInviteMessage inviteMessage = gson.fromJson(data.toJSONString(), CpInviteMessage.class);
|
||||
msg = inviteMessage.getMsg();
|
||||
title = inviteMessage.getTitle();
|
||||
routerType = inviteMessage.getRouterType();
|
||||
routerValue = inviteMessage.getPopInfo();
|
||||
entity = gson.fromJson(routerValue,CpInviteInfo.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,18 +1,26 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
data class CpInviteInfo(
|
||||
val replyExpireTime: String,
|
||||
val inviteUid: Long,
|
||||
val inviteAvatar: String,
|
||||
val inviteNick: String,
|
||||
val inviteGender: Int,
|
||||
val acceptUid: Long,
|
||||
val acceptAvatar: String,
|
||||
val acceptNick: String,
|
||||
val acceptGender: Int,
|
||||
val propsId: Int,
|
||||
val propsName: String,
|
||||
val propsImg: String,
|
||||
val propsPrice: Double,
|
||||
val recommenTxt: List<String>,
|
||||
data class CpInviteMessage(
|
||||
val msg: String = "",
|
||||
val routerType: Int = 0,
|
||||
val popInfo: String = "",
|
||||
val title: String = ""
|
||||
)
|
||||
|
||||
data class CpInviteInfo(
|
||||
val replyExpireTime: String = "",
|
||||
val inviteUid: Long = 0,
|
||||
val inviteAvatar: String = "",
|
||||
val inviteNick: String = "",
|
||||
val inviteGender: Int = 0,
|
||||
val acceptUid: Long = 0,
|
||||
val acceptAvatar: String = "",
|
||||
val acceptNick: String = "",
|
||||
val acceptGender: Int = 0,
|
||||
val propsId: Int = 0,
|
||||
val propsName: String = "",
|
||||
val propsImg: String = "",
|
||||
val propsPrice: String = "",
|
||||
val recommenTxtList: List<String>? = null,
|
||||
val recommenTxt: String = ""
|
||||
)
|
@@ -7,16 +7,17 @@ package com.yizhuan.xchat_android_core.relation.cp
|
||||
*/
|
||||
data class CpInvitePageEntity(
|
||||
val acceptAvatar: String?,
|
||||
val acceptGender: Int,//1-男2-女
|
||||
val acceptNick: String,
|
||||
val acceptUid: Long,
|
||||
val acceptGender: Int=0,//1-男2-女
|
||||
val acceptNick: String="",
|
||||
val acceptUid: Long=0,
|
||||
val inviteAvatar: String?,
|
||||
val inviteGender: Int,
|
||||
val inviteNick: String,
|
||||
val inviteUid: Long,
|
||||
val propsId: Int,
|
||||
val propsImg: String,
|
||||
val propsName: String,
|
||||
val propsPrice: String,
|
||||
val recommenTxt:List<String>
|
||||
val inviteGender: Int=0,
|
||||
val inviteNick: String="",
|
||||
val inviteUid: Long=0,
|
||||
val propsId: Int=0,
|
||||
val propsImg: String="",
|
||||
val propsName: String="",
|
||||
val propsPrice: String="",
|
||||
val recommenTxtList:List<String>?=null,
|
||||
val recommenTxt:String=""
|
||||
)
|
@@ -7,10 +7,10 @@ package com.yizhuan.xchat_android_core.relation.cp
|
||||
*/
|
||||
data class CpMpApplyListEntity(
|
||||
val applyTime: String?,
|
||||
val auditType: Int,//0、待审核,1、审核不通过,2、审核通过
|
||||
val iconPic: String,
|
||||
val mpId: Int,
|
||||
val mpName: String,
|
||||
val mpTxt: String,
|
||||
val noPassReason: String
|
||||
val auditType: Int=0,//0、待审核,1、审核不通过,2、审核通过
|
||||
val iconPic: String="",
|
||||
val mpId: Int=0,
|
||||
val mpName: String="",
|
||||
val mpTxt: String="",
|
||||
val noPassReason: String=""
|
||||
)
|
@@ -4,23 +4,23 @@ data class CpRelation(
|
||||
/**
|
||||
*
|
||||
*/
|
||||
val cpId: Long,// cp记录id
|
||||
val cpId: Long = 0,// cp记录id
|
||||
//邀请人
|
||||
val uid: Long,//邀请人uid
|
||||
val nick: String,//邀请人
|
||||
val gender: Int,//1-男2-女 //邀请人
|
||||
val avatar: String,//邀请人
|
||||
val uid: Long = 0,//邀请人uid
|
||||
val nick: String = "",//邀请人
|
||||
val gender: Int = 0,//1-男2-女 //邀请人
|
||||
val avatar: String = "",//邀请人
|
||||
//被邀请人
|
||||
val cpUid: Long,//
|
||||
val cpNick: String,
|
||||
val cpGender: Int,
|
||||
val cpAvatar: String,
|
||||
val cpUid: Long = 0,//
|
||||
val cpNick: String = "",
|
||||
val cpGender: Int = 0,
|
||||
val cpAvatar: String = "",
|
||||
|
||||
|
||||
var cpLevel: Int,
|
||||
val declaration: String,//cp关系誓言
|
||||
val cpKeepDuration: String,
|
||||
val cpBackImg: String,
|
||||
val waitUnbound: Boolean,//CP状态 true 解绑中
|
||||
val unboundUid: Long//解绑发起人UID
|
||||
var cpLevel: Int = 0,
|
||||
val declaration: String = "",//cp关系誓言
|
||||
val cpKeepDuration: String = "",
|
||||
val cpBackImg: String = "",
|
||||
val waitUnbound: Boolean = false,//CP状态 true 解绑中
|
||||
val unboundUid: Long = 0//解绑发起人UID
|
||||
)
|
@@ -1,33 +1,33 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
data class CpTaskEntity(
|
||||
val avatar: String?,
|
||||
val cpAvatar: String?,
|
||||
val cpBackImg: String?,
|
||||
val cpGender: Int,
|
||||
val cpKeepDuration: String,
|
||||
val cpLevel: Int,
|
||||
val cpNextLevelSecretVal: Int,//cp下一等级所需亲密值
|
||||
val cpNick: String,
|
||||
val cpSecretVal: Int,//cp亲密值
|
||||
val cpUid: Long,
|
||||
val dailyTask: List<Task>,//日任务列表
|
||||
val declaration: String,//cp关系誓言
|
||||
val gender: Int,//1-男2-女
|
||||
val isDamp: Boolean,//是否衰减标志:true-是,false-否
|
||||
val levelPercent: String,//cp当前等级到下一等级亲密值百分比(0~1间的小数)
|
||||
val nick: String,
|
||||
val totalTask: List<Task>,// 累计任务列表
|
||||
val uid: Long,
|
||||
val waitUnbound:Boolean,//CP状态 true 解绑中
|
||||
val unBoundUid:Long//解绑发起人UID
|
||||
val avatar: String = "",
|
||||
val cpAvatar: String = "",
|
||||
val cpBackImg: String = "",
|
||||
val cpGender: Int = 0,
|
||||
val cpKeepDuration: String = "",
|
||||
val cpLevel: Int = 0,
|
||||
val cpNextLevelSecretVal: Int = 0,//cp下一等级所需亲密值
|
||||
val cpNick: String = "",
|
||||
val cpSecretVal: Int = 0,//cp亲密值
|
||||
val cpUid: Long = 0,
|
||||
val dailyTask: List<Task>? = null,//日任务列表
|
||||
val declaration: String = "",//cp关系誓言
|
||||
val gender: Int = 0,//1-男2-女
|
||||
val isDamp: Boolean = false,//是否衰减标志:true-是,false-否
|
||||
val levelPercent: String = "",//cp当前等级到下一等级亲密值百分比(0~1间的小数)
|
||||
val nick: String = "",
|
||||
val totalTask: List<Task>? = null,// 累计任务列表
|
||||
val uid: Long = 0,
|
||||
val waitUnbound: Boolean = false,//CP状态 true 解绑中
|
||||
val unBoundUid: Long = 0//解绑发起人UID
|
||||
)
|
||||
|
||||
data class Task(
|
||||
val currentVal: Int,//当前值
|
||||
val isComplete: Boolean,
|
||||
val taskDesc: String,
|
||||
val taskNeedVal: Int,//任务所需值
|
||||
val taskSecretDesc: String,//任务亲密值描述
|
||||
val taskType: Int//任务类型:1-私聊,2-同一房间时长,3-送礼,4-陪伴
|
||||
val currentVal: Int = 0,//当前值
|
||||
val isComplete: Boolean = false,
|
||||
val taskDesc: String = "",
|
||||
val taskNeedVal: Int = 0,//任务所需值
|
||||
val taskSecretDesc: String = "",//任务亲密值描述
|
||||
val taskType: Int = 0//任务类型:1-私聊,2-同一房间时长,3-送礼,4-陪伴
|
||||
)
|
@@ -1,13 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
data class UserCpLevelMpRootEntity(
|
||||
val haveCp: Boolean,
|
||||
val mpDtoList: List<UserCpLevelMpEntity>
|
||||
val haveCp: Boolean = false,
|
||||
val mpDtoList: List<UserCpLevelMpEntity>? = null
|
||||
)
|
||||
|
||||
data class UserCpLevelMpEntity(
|
||||
val iconPic: String,
|
||||
val isHave: Boolean,//是否已经申请过:true-是,false-否
|
||||
val mpId: Int,
|
||||
val mpName: String
|
||||
val iconPic: String = "",
|
||||
val isHave: Boolean = false,//是否已经申请过:true-是,false-否
|
||||
val mpId: Int = 0,
|
||||
val mpName: String = ""
|
||||
)
|
@@ -1,23 +1,23 @@
|
||||
package com.yizhuan.xchat_android_core.relation.cp
|
||||
|
||||
data class UserCpListEntity(
|
||||
val acceptUid: Long,
|
||||
val acceptUserAvatar: String?,
|
||||
val acceptUserNick: String,
|
||||
val acceptUserSex: Int,//1-男 2女
|
||||
val createTime: String,
|
||||
val declaration: String,//关系誓言
|
||||
val id: Int,//邀请记录id
|
||||
val inviteUid: Long,//邀请人uid
|
||||
val inviteUserAvatar: String?,//邀请方头像
|
||||
val inviteUserNick: String,
|
||||
val inviteUserSex: Int,
|
||||
val levelSeq: Int,//CP等级
|
||||
val propsId: Int,
|
||||
val propsImg: String,
|
||||
val propsName: String,
|
||||
val propsPrice: String,
|
||||
val state: Int,//状态:1-邀请中,2-CP中,3-拒绝,4-解绑中,5-解绑完成
|
||||
val unboundUid: Int,//解绑人
|
||||
val updateTime: String
|
||||
val acceptUid: Long = 0,
|
||||
val acceptUserAvatar: String = "",
|
||||
val acceptUserNick: String = "",
|
||||
val acceptUserSex: Int = 0,//1-男 2女
|
||||
val createTime: String = "",
|
||||
val declaration: String = "",//关系誓言
|
||||
val id: Int = 0,//邀请记录id
|
||||
val inviteUid: Long = 0,//邀请人uid
|
||||
val inviteUserAvatar: String = "",//邀请方头像
|
||||
val inviteUserNick: String = "",
|
||||
val inviteUserSex: Int = 0,
|
||||
val levelSeq: Int = 0,//CP等级
|
||||
val propsId: Int = 0,
|
||||
val propsImg: String = "",
|
||||
val propsName: String = "",
|
||||
val propsPrice: String = "",
|
||||
val state: Int = 0,//状态:1-邀请中,2-CP中,3-拒绝,4-解绑中,5-解绑完成
|
||||
val unboundUid: Int = 0,//解绑人
|
||||
val updateTime: String = ""
|
||||
)
|
Reference in New Issue
Block a user