1.邀请弹窗关系誓言推荐 2.UI调整
This commit is contained in:
@@ -9,6 +9,7 @@ import android.widget.TextView
|
|||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
||||||
|
|
||||||
object CpViewHelper {
|
object CpViewHelper {
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ object CpViewHelper {
|
|||||||
|
|
||||||
fun setInviteTimeRemain(time: String, tv: TextView) {
|
fun setInviteTimeRemain(time: String, tv: TextView) {
|
||||||
val s = "请在${time}内决定,过期自动失效!"
|
val s = "请在${time}内决定,过期自动失效!"
|
||||||
tv.text = getColorSpan(s, Color.RED, 2, time.length+2)
|
tv.text = getColorSpan(s, Color.RED, 2, time.length + 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getColorSpan(text: String, @ColorInt color: Int, start: Int, end: Int) =
|
fun getColorSpan(text: String, @ColorInt color: Int, start: Int, end: Int) =
|
||||||
@@ -53,4 +54,21 @@ object CpViewHelper {
|
|||||||
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE
|
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showInviteTipDialog(
|
||||||
|
context: Context,
|
||||||
|
title: String,
|
||||||
|
message: String,
|
||||||
|
listener: DialogManager.OkCancelDialogListener
|
||||||
|
) {
|
||||||
|
val builder = getColorSpan(message, Color.parseColor("#999999"), 0, message.length)
|
||||||
|
val sizeSpan = AbsoluteSizeSpan(ScreenUtil.dip2px(13f))
|
||||||
|
builder.setSpan(
|
||||||
|
sizeSpan,
|
||||||
|
0,
|
||||||
|
message.length,
|
||||||
|
SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE
|
||||||
|
)
|
||||||
|
DialogManager(context).showOkWithTitleDialog(title, builder, "确定", true, listener)
|
||||||
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
package com.yizhuan.erban.relation.cp.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
|
||||||
|
class DeclarationRecommendAdapter :
|
||||||
|
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_cp_declaration_recommend) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: String?) {
|
||||||
|
helper.setText(R.id.tv_recommend,item)
|
||||||
|
}
|
||||||
|
}
|
@@ -8,7 +8,9 @@ import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
|||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
import com.yizhuan.erban.databinding.DialogCpInviteBinding
|
import com.yizhuan.erban.databinding.DialogCpInviteBinding
|
||||||
import com.yizhuan.erban.relation.cp.CpViewHelper
|
import com.yizhuan.erban.relation.cp.CpViewHelper
|
||||||
|
import com.yizhuan.erban.relation.cp.adapter.DeclarationRecommendAdapter
|
||||||
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog
|
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog
|
||||||
|
import com.yizhuan.erban.ui.widget.LinearLayoutManagerWrapper
|
||||||
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||||
|
|
||||||
@@ -18,15 +20,22 @@ class CpInvitePageDialog(context: Context) :
|
|||||||
BaseBindingDialog<DialogCpInviteBinding>(context) {
|
BaseBindingDialog<DialogCpInviteBinding>(context) {
|
||||||
var listener: DialogClickListener? = null
|
var listener: DialogClickListener? = null
|
||||||
var entity: CpInvitePageEntity? = null
|
var entity: CpInvitePageEntity? = null
|
||||||
|
var invitePageEntity: CpInvitePageEntity? = null
|
||||||
|
private val adapter = DeclarationRecommendAdapter()
|
||||||
override fun init() {
|
override fun init() {
|
||||||
binding.setClick { this }
|
binding.setClick { this }
|
||||||
|
invitePageEntity?.let { binding.cpCard.setInviteDialogPageData(invitePageEntity) }
|
||||||
|
val layoutManager = LinearLayoutManagerWrapper(context)
|
||||||
|
binding.rvRecommend.layoutManager = layoutManager
|
||||||
|
adapter.bindToRecyclerView(binding.rvRecommend)
|
||||||
|
adapter.setOnItemClickListener { _, _, position ->
|
||||||
|
adapter.getItem(position)?.let {
|
||||||
|
binding.editDeclaration.setText(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
initSpannable()
|
initSpannable()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setInvitePageData(invitePageEntity: CpInvitePageEntity) {
|
|
||||||
binding.cpCard.setInviteDialogPageData(invitePageEntity)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initSpannable() {
|
private fun initSpannable() {
|
||||||
val absoluteSizeSpan10 = AbsoluteSizeSpan(ScreenUtil.dip2px(10f))
|
val absoluteSizeSpan10 = AbsoluteSizeSpan(ScreenUtil.dip2px(10f))
|
||||||
val absoluteSizeSpan8 = AbsoluteSizeSpan(ScreenUtil.dip2px(8f))
|
val absoluteSizeSpan8 = AbsoluteSizeSpan(ScreenUtil.dip2px(8f))
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.yizhuan.erban.relation.cp.fragment
|
||||||
|
|
||||||
|
import com.yizhuan.erban.R
|
||||||
|
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||||
|
import com.yizhuan.erban.databinding.FragmentUserinfoCpBinding
|
||||||
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||||
|
|
||||||
|
@ActLayoutRes(R.layout.fragment_userinfo_cp)
|
||||||
|
class UserInfoCpFragment : BaseViewBindingFragment<FragmentUserinfoCpBinding>() {
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -9,6 +9,7 @@ import androidx.databinding.DataBindingUtil
|
|||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
import com.yizhuan.erban.databinding.LayoutCpCardBinding
|
import com.yizhuan.erban.databinding.LayoutCpCardBinding
|
||||||
import com.yizhuan.erban.relation.extention.visibility
|
import com.yizhuan.erban.relation.extention.visibility
|
||||||
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||||
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
||||||
import com.yizhuan.xchat_android_core.relation.cp.CpRelation
|
import com.yizhuan.xchat_android_core.relation.cp.CpRelation
|
||||||
|
|
||||||
@@ -22,7 +23,6 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
|||||||
init {
|
init {
|
||||||
val inflater = LayoutInflater.from(context)
|
val inflater = LayoutInflater.from(context)
|
||||||
binding = DataBindingUtil.inflate(inflater, R.layout.layout_cp_card, this, true)
|
binding = DataBindingUtil.inflate(inflater, R.layout.layout_cp_card, this, true)
|
||||||
setPageData(-1,-1,null,null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setPageData(
|
private fun setPageData(
|
||||||
@@ -37,7 +37,16 @@ class RelationCpCardView(context: Context, attr: AttributeSet?, def: Int) :
|
|||||||
var unbindRecoverVisibility = false
|
var unbindRecoverVisibility = false
|
||||||
var groupEmptyVisibility = false
|
var groupEmptyVisibility = false
|
||||||
var declarationVisibility = false
|
var declarationVisibility = false
|
||||||
cpRelation?.let { binding.cpEntity = it }
|
cpRelation?.let {
|
||||||
|
binding.cpEntity = it
|
||||||
|
ImageLoadUtils.loadRoundBackground(
|
||||||
|
context,
|
||||||
|
it.cpBackImg,
|
||||||
|
this,
|
||||||
|
16,
|
||||||
|
R.drawable.bg_corner_shadow_12
|
||||||
|
)
|
||||||
|
}
|
||||||
inviteData?.let { binding.inviteData = it }
|
inviteData?.let { binding.inviteData = it }
|
||||||
when (type) {
|
when (type) {
|
||||||
PAGE_TYPE_SELF_CP -> {
|
PAGE_TYPE_SELF_CP -> {
|
||||||
|
@@ -3,16 +3,14 @@ package com.yizhuan.erban.ui.im.friend
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import com.bun.miitmdid.core.JLibrary.context
|
import com.bun.miitmdid.core.JLibrary.context
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
|
||||||
import com.yizhuan.erban.R
|
import com.yizhuan.erban.R
|
||||||
import com.yizhuan.erban.base.BaseFragment
|
import com.yizhuan.erban.base.BaseFragment
|
||||||
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
||||||
|
import com.yizhuan.erban.relation.cp.CpViewHelper
|
||||||
import com.yizhuan.erban.relation.cp.dialog.CpInvitePageDialog
|
import com.yizhuan.erban.relation.cp.dialog.CpInvitePageDialog
|
||||||
import com.yizhuan.erban.relation.cp.viewmodel.CpViewModel
|
import com.yizhuan.erban.relation.cp.viewmodel.CpViewModel
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity
|
import com.yizhuan.erban.ui.pay.ChargeActivity
|
||||||
import com.yizhuan.erban.ui.widget.dialog.CommonTipDialog
|
|
||||||
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
import com.yizhuan.xchat_android_core.relation.cp.CpInvitePageEntity
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
|
||||||
import com.yizhuan.xchat_android_core.utils.toast
|
import com.yizhuan.xchat_android_core.utils.toast
|
||||||
|
|
||||||
class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
||||||
@@ -21,18 +19,8 @@ class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
|||||||
CpInvitePageDialog(fragment.requireContext())
|
CpInvitePageDialog(fragment.requireContext())
|
||||||
.apply { listener = inviteDialogListener }
|
.apply { listener = inviteDialogListener }
|
||||||
}
|
}
|
||||||
|
init {
|
||||||
private val sentTipDialog by lazy {
|
val manager = DialogManager(fragment.requireContext())
|
||||||
CommonTipDialog(fragment.requireContext()).apply {
|
|
||||||
setMessageBold(true)
|
|
||||||
setMessageSize(ScreenUtil.dip2px(16f))
|
|
||||||
setSubMessage("(若对方拒接或24小时未同意,钻石将会返还)")
|
|
||||||
setSubMessageColor(fragment.requireContext().resources.getColor(R.color.color_999999))
|
|
||||||
setSubMessageSize(ScreenUtil.dip2px(13f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun init(manager: DialogManager) {
|
|
||||||
cpViewModel.loadingLiveData.observe(fragment) { aBoolean: Boolean ->
|
cpViewModel.loadingLiveData.observe(fragment) { aBoolean: Boolean ->
|
||||||
if (aBoolean) {
|
if (aBoolean) {
|
||||||
manager.showProgressDialog(fragment.context)
|
manager.showProgressDialog(fragment.context)
|
||||||
@@ -46,8 +34,8 @@ class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
|||||||
/**
|
/**
|
||||||
* 邀请好友组队
|
* 邀请好友组队
|
||||||
*/
|
*/
|
||||||
fun inviteCp(userInfo: UserInfo) {
|
fun inviteCp(uid: Long) {
|
||||||
cpViewModel.getCpInvitePageData(userInfo.uid)
|
cpViewModel.getCpInvitePageData(uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +45,7 @@ class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
|||||||
private fun showInvitePageDialog(info: CpInvitePageEntity) {
|
private fun showInvitePageDialog(info: CpInvitePageEntity) {
|
||||||
with(cpInviteDialog) {
|
with(cpInviteDialog) {
|
||||||
entity = info
|
entity = info
|
||||||
setInvitePageData(info)
|
invitePageEntity = info
|
||||||
if (isShowing) closeDialog()
|
if (isShowing) closeDialog()
|
||||||
openDialog()
|
openDialog()
|
||||||
}
|
}
|
||||||
@@ -70,20 +58,21 @@ class FriendFragmentCpDelegate(private val fragment: BaseFragment) {
|
|||||||
cpInvitePageEntity: CpInvitePageEntity,
|
cpInvitePageEntity: CpInvitePageEntity,
|
||||||
declaration: String,
|
declaration: String,
|
||||||
) {
|
) {
|
||||||
sentTipDialog.setTipMsg("确定送出${cpInvitePageEntity.propsName}}礼物与Ta结成CP关系吗?")
|
CpViewHelper.showInviteTipDialog(
|
||||||
sentTipDialog.setOnActionListener(object : CommonTipDialog.OnActionListener {
|
context,
|
||||||
override fun onOk() {
|
"确定送出${cpInvitePageEntity.propsName}}礼物与Ta结成CP关系吗?",
|
||||||
cpViewModel.makeCpInvite(
|
"(若对方拒接或24小时未同意,钻石将会返还)"
|
||||||
cpInvitePageEntity.acceptUid,
|
){
|
||||||
declaration,
|
cpViewModel.makeCpInvite(
|
||||||
cpInvitePageEntity.propsId
|
cpInvitePageEntity.acceptUid,
|
||||||
) {
|
declaration,
|
||||||
DialogManager(fragment.context).showOkCancelDialog("钻石余额不足,请前去充值!") {
|
cpInvitePageEntity.propsId
|
||||||
ChargeActivity.start(context)
|
) {
|
||||||
}
|
DialogManager(fragment.context).showOkCancelDialog("钻石余额不足,请前去充值!") {
|
||||||
|
ChargeActivity.start(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inviteDialogListener =
|
private val inviteDialogListener =
|
||||||
|
@@ -263,6 +263,6 @@ public class FriendListFragment extends BaseFragment {
|
|||||||
if (cpDelegate == null) {
|
if (cpDelegate == null) {
|
||||||
cpDelegate = new FriendFragmentCpDelegate(this);
|
cpDelegate = new FriendFragmentCpDelegate(this);
|
||||||
}
|
}
|
||||||
cpDelegate.inviteCp(cpInfo);
|
cpDelegate.inviteCp(cpInfo.getUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
|||||||
final int cpState = item.getCpState();
|
final int cpState = item.getCpState();
|
||||||
holder.stvOp.setText(cpState == 1 ? "已邀请" : cpState == 2 ? "已有CP" : "邀请");
|
holder.stvOp.setText(cpState == 1 ? "已邀请" : cpState == 2 ? "已有CP" : "邀请");
|
||||||
holder.stvOp.setEnabled(cpState != 1 && cpState != 2);
|
holder.stvOp.setEnabled(cpState != 1 && cpState != 2);
|
||||||
|
holder.addOnClickListener(R.id.stv_op);
|
||||||
holder.stvOp.setBackground(context.getResources().getDrawable(R.drawable.bg_button_relation_invite));
|
holder.stvOp.setBackground(context.getResources().getDrawable(R.drawable.bg_button_relation_invite));
|
||||||
} else {
|
} else {
|
||||||
holder.stvOp.setVisibility(View.GONE);
|
holder.stvOp.setVisibility(View.GONE);
|
||||||
|
@@ -21,8 +21,10 @@ import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
|||||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||||
import com.yizhuan.erban.module_hall.hall.activity.HallSearchActivity;
|
import com.yizhuan.erban.module_hall.hall.activity.HallSearchActivity;
|
||||||
|
import com.yizhuan.erban.ui.im.friend.FriendFragmentCpDelegate;
|
||||||
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
|
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
|
||||||
import com.yizhuan.erban.ui.search.view.ISearchView;
|
import com.yizhuan.erban.ui.search.view.ISearchView;
|
||||||
|
import com.yizhuan.erban.ui.widget.dialog.CommonTipDialog;
|
||||||
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
|
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
|
||||||
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
|
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
|
||||||
import com.yizhuan.xchat_android_core.community.im.DynamicImMsg;
|
import com.yizhuan.xchat_android_core.community.im.DynamicImMsg;
|
||||||
@@ -30,6 +32,7 @@ import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
|
|||||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||||
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||||
@@ -52,6 +55,7 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
|
|||||||
private int mType;
|
private int mType;
|
||||||
private int fromType;
|
private int fromType;
|
||||||
|
|
||||||
|
|
||||||
public static SearchDetailFragment newInstance(int type) {
|
public static SearchDetailFragment newInstance(int type) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt("type", type);
|
args.putInt("type", type);
|
||||||
@@ -115,10 +119,12 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
|
|||||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
searchAdapter = new SearchAdapter(mContext, mType, fromType);
|
searchAdapter = new SearchAdapter(mContext, mType, fromType);
|
||||||
searchAdapter.setType(fromType);
|
searchAdapter.setType(fromType);
|
||||||
searchAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
searchAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||||
@Override
|
SearchRoomInfo item = (SearchRoomInfo) adapter.getData().get(position);
|
||||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
if (fromType == AbstractSelectFriendAction.TYPE_CP) {
|
||||||
SearchRoomInfo item = (SearchRoomInfo) adapter.getData().get(position);
|
long targetUid = JavaUtil.str2long(item.getUid()+"");
|
||||||
|
new FriendFragmentCpDelegate(this).inviteCp(targetUid);
|
||||||
|
} else {
|
||||||
showSureDialog(item.getUid() + "", item.getAvatar(), item.getNick());
|
showSureDialog(item.getUid() + "", item.getAvatar(), item.getNick());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,17 +1,10 @@
|
|||||||
package com.yizhuan.erban.ui.widget.dialog;
|
package com.yizhuan.erban.ui.widget.dialog;
|
||||||
|
|
||||||
import static android.graphics.Typeface.BOLD;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.view.Window;
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.style.AbsoluteSizeSpan;
|
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.ColorRes;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.xchat_android_core.utils.TextUtils;
|
import com.yizhuan.xchat_android_core.utils.TextUtils;
|
||||||
|
|
||||||
@@ -22,18 +15,9 @@ import com.yizhuan.xchat_android_core.utils.TextUtils;
|
|||||||
*/
|
*/
|
||||||
public class CommonTipDialog extends BaseDialog {
|
public class CommonTipDialog extends BaseDialog {
|
||||||
private String tipMsg = "";
|
private String tipMsg = "";
|
||||||
private String subMessage = "";
|
|
||||||
|
|
||||||
private String okText = "确定";
|
private String okText = "确定";
|
||||||
private String cancelText = "取消";
|
private String cancelText = "取消";
|
||||||
private boolean messageBold;
|
|
||||||
private boolean subMessageBold;
|
|
||||||
private @ColorRes
|
|
||||||
int messageColor = -1;
|
|
||||||
private @ColorRes
|
|
||||||
int subMessageColor = -1;
|
|
||||||
private int messageSize = -1;
|
|
||||||
private int subMessageSize = -1;
|
|
||||||
|
|
||||||
public CommonTipDialog(Context context) {
|
public CommonTipDialog(Context context) {
|
||||||
super(context, R.style.dialog);
|
super(context, R.style.dialog);
|
||||||
@@ -51,10 +35,7 @@ public class CommonTipDialog extends BaseDialog {
|
|||||||
setContentView(R.layout.layout_ok_cancel_dialog);
|
setContentView(R.layout.layout_ok_cancel_dialog);
|
||||||
|
|
||||||
TextView tip = findViewById(R.id.message);
|
TextView tip = findViewById(R.id.message);
|
||||||
TextView sub = findViewById(R.id.sub_message);
|
tip.setText(tipMsg);
|
||||||
|
|
||||||
setMessageAndStyle(tip, tipMsg);
|
|
||||||
setSubMessageAndStyle(sub, subMessage);
|
|
||||||
|
|
||||||
TextView ok = findViewById(R.id.btn_ok);
|
TextView ok = findViewById(R.id.btn_ok);
|
||||||
ok.setText(okText);
|
ok.setText(okText);
|
||||||
@@ -74,82 +55,10 @@ public class CommonTipDialog extends BaseDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setMessageAndStyle(TextView tip, String message) {
|
|
||||||
SpannableStringBuilder messageBuilder = null;
|
|
||||||
if (messageBold || messageColor != -1 || messageSize != -1) {
|
|
||||||
messageBuilder = new SpannableStringBuilder(message);
|
|
||||||
if (messageBold) {
|
|
||||||
StyleSpan boldSpan = new StyleSpan(BOLD);
|
|
||||||
messageBuilder.setSpan(boldSpan, 0, messageBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (messageSize != -1) {
|
|
||||||
AbsoluteSizeSpan sizeSpan = new AbsoluteSizeSpan(messageSize);
|
|
||||||
messageBuilder.setSpan(sizeSpan, 0, messageBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (messageColor != -1) {
|
|
||||||
tip.setTextColor(getContext().getResources().getColor(messageColor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tip.setText(messageBuilder == null ? message : messageBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSubMessageAndStyle(TextView sub, String message) {
|
|
||||||
SpannableStringBuilder subMessageBuilder = null;
|
|
||||||
if (subMessageBold || subMessageColor != -1 || subMessageSize != -1) {
|
|
||||||
subMessageBuilder = new SpannableStringBuilder(message);
|
|
||||||
if (subMessageBold) {
|
|
||||||
StyleSpan boldSpan = new StyleSpan(BOLD);
|
|
||||||
subMessageBuilder.setSpan(boldSpan, 0, subMessageBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subMessageSize != -1) {
|
|
||||||
AbsoluteSizeSpan sizeSpan = new AbsoluteSizeSpan(subMessageSize);
|
|
||||||
subMessageBuilder.setSpan(sizeSpan, 0, subMessageBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subMessageColor != -1) {
|
|
||||||
sub.setTextColor(getContext().getResources().getColor(subMessageColor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sub.setText(subMessageBuilder == null ? message : subMessageBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setTipMsg(String tipMsg) {
|
public void setTipMsg(String tipMsg) {
|
||||||
this.tipMsg = tipMsg;
|
this.tipMsg = tipMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubMessage(String subMessage) {
|
|
||||||
this.subMessage = subMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageBold(boolean isBold) {
|
|
||||||
this.messageBold = isBold;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageColor(@ColorRes int color) {
|
|
||||||
this.messageColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageSize(int textSize) {
|
|
||||||
this.messageSize = textSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubMessageBold(boolean subMessageBold) {
|
|
||||||
this.subMessageBold = subMessageBold;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubMessageColor(int subMessageColor) {
|
|
||||||
this.subMessageColor = subMessageColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubMessageSize(int subMessageSize) {
|
|
||||||
this.subMessageSize = subMessageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OnActionListener l;
|
private OnActionListener l;
|
||||||
|
|
||||||
public void setOkText(String okText) {
|
public void setOkText(String okText) {
|
||||||
@@ -173,4 +82,6 @@ public class CommonTipDialog extends BaseDialog {
|
|||||||
default void onCancel() {
|
default void onCancel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
8
app/src/main/res/drawable/bg_invite_recommend_text.xml
Normal file
8
app/src/main/res/drawable/bg_invite_recommend_text.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle"
|
||||||
|
>
|
||||||
|
<solid android:color="#4f8a8aff"/>
|
||||||
|
<corners android:radius="@dimen/dp_17"/>
|
||||||
|
|
||||||
|
</shape>
|
@@ -10,7 +10,6 @@
|
|||||||
android:id="@+id/title_bar"
|
android:id="@+id/title_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_25"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
@@ -47,12 +47,12 @@
|
|||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:enabled="false"
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
android:hint="@string/search_hint"
|
android:hint="@string/search_hint"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:maxLength="20"
|
android:maxLength="20"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text=""
|
|
||||||
android:textColor="@color/text_normal_c6c6e9"
|
android:textColor="@color/text_normal_c6c6e9"
|
||||||
android:textColorHint="@color/text_hint_555574"
|
android:textColorHint="@color/text_hint_555574"
|
||||||
android:textCursorDrawable="@null"
|
android:textCursorDrawable="@null"
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="655dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_8"
|
android:layout_marginLeft="@dimen/dp_8"
|
||||||
android:layout_marginRight="@dimen/dp_8">
|
android:layout_marginRight="@dimen/dp_8">
|
||||||
|
|
||||||
@@ -27,10 +27,9 @@
|
|||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="619dp"
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
android:background="@drawable/bg_cp_invite_dialog"
|
android:background="@drawable/bg_cp_invite_dialog"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintHorizontal_weight="1"
|
app:layout_constraintHorizontal_weight="1"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_close">
|
app:layout_constraintTop_toBottomOf="@id/iv_close">
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@
|
|||||||
<com.yizhuan.erban.relation.cp.widget.RelationCpCardView
|
<com.yizhuan.erban.relation.cp.widget.RelationCpCardView
|
||||||
android:id="@+id/cp_card"
|
android:id="@+id/cp_card"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="68dp"
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
android:layout_marginTop="@dimen/dp_20"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/tv_tip"
|
app:layout_constraintLeft_toLeftOf="@id/tv_tip"
|
||||||
app:layout_constraintRight_toRightOf="@id/tv_tip"
|
app:layout_constraintRight_toRightOf="@id/tv_tip"
|
||||||
@@ -96,7 +95,6 @@
|
|||||||
android:id="@+id/rv_recommend"
|
android:id="@+id/rv_recommend"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
android:layout_marginTop="@dimen/dp_8"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/edit_declaration"
|
app:layout_constraintLeft_toLeftOf="@id/edit_declaration"
|
||||||
app:layout_constraintRight_toRightOf="@id/edit_declaration"
|
app:layout_constraintRight_toRightOf="@id/edit_declaration"
|
||||||
app:layout_constraintTop_toBottomOf="@id/edit_declaration" />
|
app:layout_constraintTop_toBottomOf="@id/edit_declaration" />
|
||||||
|
15
app/src/main/res/layout/fragment_userinfo_cp.xml
Normal file
15
app/src/main/res/layout/fragment_userinfo_cp.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<com.yizhuan.erban.relation.cp.widget.RelationCpCardView
|
||||||
|
android:id="@+id/cp_card_view"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_15"
|
||||||
|
android:layout_marginTop="@dimen/dp_18"
|
||||||
|
android:layout_marginRight="@dimen/dp_15" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
15
app/src/main/res/layout/item_cp_declaration_recommend.xml
Normal file
15
app/src/main/res/layout/item_cp_declaration_recommend.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/tv_recommend"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
|
android:background="@drawable/bg_invite_recommend_text"
|
||||||
|
android:maxWidth="218dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textSize="@dimen/sp_10"
|
||||||
|
android:paddingLeft="@dimen/dp_5"
|
||||||
|
android:paddingRight="@dimen/dp_5"
|
||||||
|
tools:text="一二三四五一二三四五一二三四五一二三四五"
|
||||||
|
android:layout_height="20dp" />
|
@@ -29,7 +29,6 @@
|
|||||||
android:paddingLeft="@dimen/dp_4"
|
android:paddingLeft="@dimen/dp_4"
|
||||||
android:paddingTop="@dimen/dp_5"
|
android:paddingTop="@dimen/dp_5"
|
||||||
android:paddingRight="@dimen/dp_4"
|
android:paddingRight="@dimen/dp_4"
|
||||||
android:minHeight="148dp"
|
|
||||||
android:paddingBottom="@dimen/dp_5">
|
android:paddingBottom="@dimen/dp_5">
|
||||||
|
|
||||||
|
|
||||||
|
@@ -924,7 +924,7 @@
|
|||||||
<string name="invite_cp">邀请CP</string>
|
<string name="invite_cp">邀请CP</string>
|
||||||
<string name="has_cp">已有CP</string>
|
<string name="has_cp">已有CP</string>
|
||||||
<string name="invite_declaration_hint">在这里写上你们的关系誓言吧!\n(关系誓言会在展示个人资料页,请认真填写哦~</string>
|
<string name="invite_declaration_hint">在这里写上你们的关系誓言吧!\n(关系誓言会在展示个人资料页,请认真填写哦~</string>
|
||||||
<string name="invite_gift_price_text">邀请函\ns%钻石</string>
|
<string name="invite_gift_price_text">邀请函\n%s钻石</string>
|
||||||
<string name="invite_cp_empty_declaration_tip">请输入关系誓言!</string>
|
<string name="invite_cp_empty_declaration_tip">请输入关系誓言!</string>
|
||||||
<string name="invite_cp_state_invited">已邀请</string>
|
<string name="invite_cp_state_invited">已邀请</string>
|
||||||
<string name="invite_cp_state_agreed">已同意</string>
|
<string name="invite_cp_state_agreed">已同意</string>
|
||||||
|
@@ -17,5 +17,6 @@ data class CpInvitePageEntity(
|
|||||||
val propsId: Int,
|
val propsId: Int,
|
||||||
val propsImg: String,
|
val propsImg: String,
|
||||||
val propsName: String,
|
val propsName: String,
|
||||||
val propsPrice: String
|
val propsPrice: String,
|
||||||
|
val recommenTxt:String?
|
||||||
)
|
)
|
Reference in New Issue
Block a user