红包需求

This commit is contained in:
oujunhui
2020-07-07 18:47:11 +08:00
parent cc6f055ce0
commit 77b2a55d7e
85 changed files with 3729 additions and 15 deletions

View File

@@ -290,6 +290,9 @@ dependencies {
implementation 'com.github.fodroid:XRadioGroup:v1.5'
implementation files('libs/msa_mdid_1.0.13.aar')
implementation "androidx.core:core-ktx:+"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
@@ -297,4 +300,5 @@ repositories {
flatDir {
dirs 'aliyun-libs', 'hw-push-libs', 'quick-pass-libs'
}
mavenCentral()
}

View File

@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
@@ -36,6 +37,8 @@ import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.orhanobut.logger.Logger;
import com.yinyuan.xchat_android_core.redpackage.RedPackageModel;
import com.yinyuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.fragment.AbsRoomFragment;
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
@@ -43,6 +46,7 @@ import com.yizhuan.erban.avroom.fragment.InputPwdDialogFragment;
import com.yizhuan.erban.avroom.game.PlayGameActivity;
import com.yizhuan.erban.avroom.presenter.AvRoomPresenter;
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
import com.yizhuan.erban.avroom.redpackage.RedPackageOpenDialog;
import com.yizhuan.erban.avroom.view.IAvRoomView;
import com.yizhuan.erban.base.BaseMvpActivity;
import com.yizhuan.erban.base.TitleBar;
@@ -69,6 +73,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageAttachment;
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
@@ -118,6 +123,7 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import io.reactivex.Single;
@@ -143,6 +149,13 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
private static final String AI_UID = "aiUid";
private static final String SHOW_PARTY_ROOM_FIRST_ENTER_TIP = "show_party_room_first_enter_tip";
public static final int FROM_TYPE_NORMAL = 0;
public static final int FROM_TYPE_FC = 1;
public static final int FROM_TYPE_USER = 2;//跟随用户进房
public static final int FROM_TYPE_TOP_BROADCAST = 3;//通过置顶广播进房
public static final int FROM_TYPE_NORMAL_BROADCAST = 4;//通过普通广播进房
public static final int FROM_TYPE_ALL_RED = 5;//通过全服红包进房
private SVGAImageView svgaRoomBg;
private RelativeLayout finishLayout;
private ViewStub mVsRoomOffline;
@@ -171,6 +184,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
private int pos = 0;
boolean isLast = true;
private LoadingDialog mLoadingDialog;
private List<RedPackageOpenDialog> openDialogs;
private static final int SHOW_RED_DIALOG_MAX = 10;
/**
* 管理限制进房
@@ -198,6 +213,18 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
context.startActivity(intent);
}
public static void start(Context context, long roomUid, int fromType, String workAuthor, @Nullable RedPackageNotifyInfo notifyInfo) {
Intent intent = new Intent(context, AVRoomActivity.class);
intent.putExtra(Constants.ROOM_UID, roomUid);
intent.putExtra("fromType", fromType);
intent.putExtra("workAuthor", workAuthor);
if (notifyInfo != null) {
intent.putExtra("notifyInfo", notifyInfo);
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
public static void start(Context context, long roomUid, int roomType) {
Intent intent = new Intent(context, AVRoomActivity.class);
intent.putExtra(Constants.ROOM_UID, roomUid);
@@ -262,6 +289,8 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
if (newRoomUid != 0 && newRoomUid == roomUid) {
updateRoomInfo();
//updateRoomInfo之后进入云信进房逻辑后直接return了,不会再次调用addRoomFragment()
showRedPackage(AvRoomDataManager.get().mCurrentRoomInfo);
return;
}
// 师徒任务三判定
@@ -282,6 +311,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
// 相同类型的房间,但是是不同人的房间
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
svgaRoomBg.clearAnimation();
dismissRedPackageDialog();
svgaRoomBg.setVisibility(View.INVISIBLE);
getDialogManager().showProgressDialog(this, getString(R.string.waiting_text), true);
updateRoomInfo();
@@ -391,6 +421,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
if (giftList != null) {
giftList.clear();
}
if (!isResume) showRedPackage(AvRoomDataManager.get().mCurrentRoomInfo);
isResume = true;
}
@@ -511,6 +542,13 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
case RoomEvent.MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN:
toBack(true);
break;
case RoomEvent.RECEIVE_RED_PACKAGE:
try {//防止NPE
showRedPackageOpenDialog(((RedPackageAttachment) roomEvent.getChatRoomMessage().getAttachment()).getRedPackageNotifyInfo());
} catch (Exception e) {
e.printStackTrace();
}
break;
default:
}
}
@@ -733,6 +771,47 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
AvRoomDataManager.get().release();
}
@SuppressLint("CheckResult")
private void showRedPackage(RoomInfo roomInfo) {
if (roomInfo == null) return;
RedPackageNotifyInfo inRoomNotifyInfo = (RedPackageNotifyInfo) getIntent().getSerializableExtra("notifyInfo");
Map<String, Long> redMap = DemoCache.readRedPackage();
RedPackageModel.INSTANCE.getRedPackage(roomInfo.getUid())
.compose(bindToLifecycle())
.doFinally(() -> {
if (inRoomNotifyInfo != null && (redMap == null || !redMap.containsKey(inRoomNotifyInfo.getRedEnvelopeId()))) {
showRedPackageOpenDialog(inRoomNotifyInfo);
}
})
.filter(notifyInfo -> inRoomNotifyInfo == null || !notifyInfo.getRedEnvelopeId().equals(inRoomNotifyInfo.getRedEnvelopeId()))
.subscribe(this::showRedPackageOpenDialog);
}
private void showRedPackageOpenDialog(RedPackageNotifyInfo notifyInfo) {
if (!isResume) return;
if (openDialogs == null) {
openDialogs = new ArrayList<>();
}
RedPackageOpenDialog openDialog = RedPackageOpenDialog.Companion.newInstance(notifyInfo);
openDialog.show(this);
if (openDialog.getDialog() != null) {
openDialog.getDialog().setOnDismissListener(dialog -> openDialogs.remove(openDialog));
}
openDialogs.add(openDialog);
if (openDialogs.size() >= SHOW_RED_DIALOG_MAX) {
openDialogs.get(SHOW_RED_DIALOG_MAX - 1).dismissAllowingStateLoss();
}
}
private void dismissRedPackageDialog() {
if (openDialogs != null) {
openDialogs.clear();
}
if (mCurrentFragment instanceof HomePartyFragment) {
((HomePartyFragment) mCurrentFragment).dismissSendRedPackageDialog();
}
}
private void showPartyRoomTip() {
boolean isFirst = (boolean) SharedPreferenceUtils.get(SHOW_PARTY_ROOM_FIRST_ENTER_TIP, true);
if (isFirst) {

View File

@@ -254,6 +254,8 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
} else if (v.getId() == R.id.tv_room_desc || v.getId() == R.id.tv_room_type
|| v.getId() == R.id.iv_room_can_edit) {
onMicroItemClickListener.onRoomSettingsClick();
}else if (v.getId() == R.id.iv_red_package) {
onMicroItemClickListener.onRedPackageClick(position, info.mChatRoomMember);
}
}
}

View File

@@ -34,6 +34,7 @@ import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.erban.utils.RegexUtil;
import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.initial.InitialModel;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.noble.NobleUtil;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
@@ -260,6 +261,7 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
View inOfficialMask;
TextView tvOfficialMask;
ImageView ivOfficialMask;
ImageView ivRedPackage;
BossMicroViewHolder(View itemView) {
super(itemView);
@@ -278,6 +280,9 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
}
ivRedPackage = itemView.findViewById(R.id.iv_red_package);
ivRedPackage.setOnClickListener(this);
}
@Override
@@ -288,7 +293,10 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null)
return;
//初始化红包是否显示
// if (InitialModel.get().getCacheInitInfo().isRedEnvelopeSwitch()) {
ivRedPackage.setVisibility(View.VISIBLE);
// }
// 新版房主位优先判断麦序是否有人,麦序没人再判断是否是离开模式(防止新版展示离开模式,实际麦位有人)
ChatRoomMember chatRoomMember = info.mChatRoomMember;
if (chatRoomMember == null) {

View File

@@ -13,4 +13,6 @@ public interface OnMicroItemClickListener {
void onLockBtnClick(int position);
void onRoomSettingsClick();
void onRedPackageClick(int position, ChatRoomMember chatRoomMember);
}

View File

@@ -621,6 +621,12 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
}
}
public void dismissSendRedPackageDialog() {
if (roomFragment != null) {
roomFragment.clearDialog();
}
}
/**
* 收藏房间
*/

View File

@@ -82,6 +82,7 @@ import com.yizhuan.erban.avroom.ktv.KtvMusicManager;
import com.yizhuan.erban.avroom.ktv.KtvSelectSongActivity;
import com.yizhuan.erban.avroom.ktv.KtvSongListActivity;
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
import com.yizhuan.erban.avroom.redpackage.RedPackageSendDialog;
import com.yizhuan.erban.treasure_box.activity.TreasureBoxHonourActivity;
import com.yizhuan.erban.treasure_box.fragment.ChooseTreasureBoxDialogFragment;
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
@@ -282,6 +283,12 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
private boolean isRoomMin;
private int mJoinMiniWorldOperationPosition = -1;
@Nullable
private RedPackageSendDialog redPackageSendDialog;
@Nullable
private UserInfoDialog userInfoDialog;
public static HomePartyRoomFragment newInstance(boolean isRoomMin) {
HomePartyRoomFragment roomFragment = new HomePartyRoomFragment();
Bundle bundle = new Bundle();
@@ -1706,8 +1713,8 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
@Override
public void showMicAvatarClickDialog(List<ViewItem> buttonItemList, String uid) {
GiftDialog.GIFT_DIALOG_FROM = "房间";
UserInfoDialog dialog = new UserInfoDialog(mContext, JavaUtil.str2long(uid), buttonItemList, true);
dialog.show();
userInfoDialog = new UserInfoDialog(mContext, JavaUtil.str2long(uid), buttonItemList, true);
userInfoDialog.show();
//getDialogManager().showCommonPopupDialog(buttonItemList, getString(R.string.cancel));
}
@@ -1853,6 +1860,21 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
showRoomIntroduction(AvRoomDataManager.get().isRoomOwner() || AvRoomDataManager.get().isRoomAdmin());
}
@Override
public void onRedPackageClick(int position, ChatRoomMember chatRoomMember) {
redPackageSendDialog = new RedPackageSendDialog();
redPackageSendDialog.show(getActivity());
}
public void clearDialog() {
if (giftDialog != null) giftDialog.dismiss();
if (dynamicFaceDialog != null) dynamicFaceDialog.dismiss();
if (userInfoDialog != null) userInfoDialog.dismiss();
if (redPackageSendDialog != null) {
redPackageSendDialog.dismissAllowingStateLoss();
}
}
private void showRoomIntroduction(boolean isModify) {
RoomInfo info = AvRoomDataManager.get().mCurrentRoomInfo;
if (info == null) return;

View File

@@ -0,0 +1,21 @@
package com.yizhuan.erban.avroom.redpackage
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeGiftItemVO
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtils
class RedPackageGiftAdapter(layoutId: Int = R.layout.item_red_package_gift) :
BaseQuickAdapter<RedEnvelopeGiftItemVO, BaseViewHolder>(layoutId) {
override fun convert(helper: BaseViewHolder, item: RedEnvelopeGiftItemVO) {
ImageLoadUtils.loadAvatar(mContext, item.giftVo?.giftUrl, helper.getView(R.id.iv_gift))
helper.setText(R.id.tv_gift_num, "x${item.giftNum}")
helper.getView<TextView>(R.id.tv_gift_name)?.let {
it.text = item.giftVo?.giftName
}
}
}

View File

@@ -0,0 +1,87 @@
package com.yizhuan.erban.avroom.redpackage
import android.os.Bundle
import android.view.LayoutInflater
import android.view.WindowManager
import android.view.animation.AnimationUtils
import com.yinyuan.xchat_android_core.redpackage.RedPackageNotifyInfo
import com.yizhuan.erban.R
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.common.widget.dialog.DialogManager
import com.yizhuan.erban.databinding.DialogRedPackageGoRoomBinding
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
class RedPackageGoRoomDialog : BaseDialog<DialogRedPackageGoRoomBinding>() {
private val redPackageNotifyInfo by lazy { arguments?.getSerializable(KEY_NOTIFY_INFO) as RedPackageNotifyInfo }
companion object {
private const val KEY_NOTIFY_INFO = "redPackageNotifyInfo"
private var dialogManager: DialogManager? = null
fun newInstance(redPackageNotifyInfo: RedPackageNotifyInfo): RedPackageGoRoomDialog {
return RedPackageGoRoomDialog().apply {
arguments = Bundle().apply {
putSerializable(KEY_NOTIFY_INFO, redPackageNotifyInfo)
}
}
}
}
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
height = WindowManager.LayoutParams.MATCH_PARENT
super.onStart()
}
override fun initBinding(inflater: LayoutInflater): DialogRedPackageGoRoomBinding {
return DialogRedPackageGoRoomBinding.inflate(inflater)
}
override fun init() {
AnimationUtils.loadAnimation(context, R.anim.anim_all_red_package).apply {
binding.clRed.animation = this
start()
}
AnimationUtils.loadAnimation(context, R.anim.anim_all_red_package_in_btn).let {
binding.ivGoRoom.animation = it
it.start()
}
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivGoRoom.setOnClickListener {
val jump = {
AVRoomActivity.start(context, redPackageNotifyInfo.roomUid,
AVRoomActivity.FROM_TYPE_ALL_RED, redPackageNotifyInfo.sendUserNick, redPackageNotifyInfo)
dismissAllowingStateLoss()
}
// StatUtil.onEvent("gethongbao_get", "进房抢红包弹窗-进房抢")
if (AvRoomDataManager.get().isOwnerOnMic && AvRoomDataManager.get().roomId != redPackageNotifyInfo.roomUid) {
//如果显示这个弹窗的时候,又收到了一个全服,再次点击进房抢的时候需要关闭前面的那个
dialogManager?.dismissDialog()
dialogManager = DialogManager(context)
dialogManager?.showOkCancelDialog("是否下麦退出当前房间?", true, jump)
} else {
jump()
}
}
redPackageNotifyInfo.let {
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding.ivAvatar)
binding.tvContent.text = it.redEnvelopeMessage
binding.tvNickname.text = it.sendUserNick.subAndReplaceDot()
binding.tvRoomName.text = it.roomTitle.subAndReplaceDot()
}
// StatUtil.onEvent("gethongbao", "进房抢红包弹窗")
}
override fun onDestroy() {
super.onDestroy()
dialogManager = null
}
}

View File

@@ -0,0 +1,41 @@
package com.yizhuan.erban.avroom.redpackage
import android.graphics.Color
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeItemVO
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.utils.UserUtils
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
import java.text.SimpleDateFormat
import java.util.*
class RedPackageOpenAdapter : BaseQuickAdapter<RedEnvelopeItemVO, BaseViewHolder>(R.layout.item_red_package_diamond) {
private val dateFormat = SimpleDateFormat("MM月dd日 HH:mm", Locale.CHINA)
override fun convert(helper: BaseViewHolder, item: RedEnvelopeItemVO) {
ImageLoadUtils.loadAvatar(mContext, item.userVO.avatar, helper.getView(R.id.iv_avatar))
val isSelf = item.userVO.uid == UserUtils.getUserUid()
helper.setText(R.id.tv_nickname, if (isSelf) "" else item.userVO.nick.subAndReplaceDot(6))
.setTextColor(R.id.tv_nickname, Color.parseColor(if (isSelf) "#FDCD00" else "#FFFFFF"))
.setText(R.id.tv_time, dateFormat.format(item.createTime))
.setText(R.id.tv_diamond_num, item.amount)
item.redEnvelopeGiftItemVOs?.let {
if (it.isNotEmpty()) {
helper.setGone(R.id.tv_diamond_num, false)
.setGone(R.id.tv_diamond, false)
val rvGift = helper.getView<RecyclerView>(R.id.rv_gift)
val adapter = RedPackageGiftAdapter()
rvGift.visibility = View.VISIBLE
rvGift.layoutManager = LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false)
rvGift.adapter = adapter
adapter.setNewData(it)
}
}
}
}

View File

@@ -0,0 +1,176 @@
package com.yizhuan.erban.avroom.redpackage
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.text.style.ForegroundColorSpan
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.view.animation.AccelerateDecelerateInterpolator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yinyuan.xchat_android_core.redpackage.*
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeState.Companion.REMAIN_ZERO
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeState.Companion.SUCCESS
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeState.Companion.TIME_OUT
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeState.Companion.TIME_OUT_BACK
import com.yizhuan.erban.R
import com.yizhuan.erban.avroom.widget.MessageView
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.databinding.DialogGameResultBinding
import com.yizhuan.erban.databinding.DialogRedPackageOpenBinding
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.utils.UserUtils
import com.yizhuan.xchat_android_core.DemoCache
import com.yizhuan.xchat_android_core.redpackage.ALL_DIAMOND
import com.yizhuan.xchat_android_core.redpackage.ALL_GIFT
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
class RedPackageOpenDialog : BaseDialog<DialogRedPackageOpenBinding>() {
private var mObjectAnimator: ObjectAnimator? = null
private val redPackageNotifyInfo by lazy { arguments?.getSerializable(KEY_NOTIFY_INFO) as RedPackageNotifyInfo }
private var isOpened = false
private var redPackageInfo: RedPackageInfo? = null
companion object {
private const val KEY_NOTIFY_INFO = "redPackageNotifyInfo"
fun newInstance(redPackageNotifyInfo: RedPackageNotifyInfo): RedPackageOpenDialog {
return RedPackageOpenDialog().apply {
arguments = Bundle().apply {
putSerializable(KEY_NOTIFY_INFO, redPackageNotifyInfo)
}
}
}
}
override fun initBinding(inflater: LayoutInflater): DialogRedPackageOpenBinding {
return DialogRedPackageOpenBinding.inflate(inflater)
}
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
height = WindowManager.LayoutParams.WRAP_CONTENT
super.onStart()
}
override fun init() {
dialog?.setCanceledOnTouchOutside(false)
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivOpen.setOnClickListener {
startRedPacketAnim(it)
it.isEnabled = false
}
redPackageNotifyInfo.let {
ImageLoadUtils.loadAvatar(context, it.sendUserAvatar, binding.ivAvatar)
binding.tvContent.text = it.redEnvelopeMessage
binding.tvNickname.text = it.sendUserNick
}
// StatUtil.onEvent("openhongbao", "当前房开红包弹窗")
}
@SuppressLint("CheckResult")
private fun startRedPacketAnim(v: View) {
RedPackageModel.openRedPackage(redPackageNotifyInfo.redEnvelopeId)
.subscribe({
redPackageInfo = it
if (mObjectAnimator?.isRunning == false) {
openRedPackage()
}
}, {
binding.ivOpen.isEnabled = true
mObjectAnimator?.cancel()
SingleToastUtil.showToast(it.message)
})
mObjectAnimator = ObjectAnimator.ofFloat(v, "rotationY", 0f, 360f)
mObjectAnimator?.let {
it.duration = 1500
it.interpolator = AccelerateDecelerateInterpolator()
it.addListener(object : AnimatorListenerAdapter() {
var isCanceled = false
override fun onAnimationCancel(animation: Animator?) {
isCanceled = true
}
override fun onAnimationEnd(animation: Animator?) {
if (!isCanceled) {
openRedPackage()
}
}
})
it.start()
}
// StatUtil.onEvent("openhongbao_open", "当前房开红包弹窗-开启")
}
@SuppressLint("SetTextI18n")
private fun openRedPackage() {
if (isOpened) return
redPackageInfo?.let { packageInfo ->
isOpened = true
binding.clOpened.visibility = View.VISIBLE
binding.clRed.visibility = View.GONE
binding.tvNicknameOpened.text = redPackageNotifyInfo.sendUserNick
ImageLoadUtils.loadAvatar(context, redPackageNotifyInfo.sendUserAvatar, binding.ivAvatarOpened)
packageInfo.redEnvelopeVO?.apply {
binding.tvContentOpened.text = message
when (packageInfo.redEnvelopeState) {
SUCCESS -> {
packageInfo.redEnvelopeItemVOs?.firstOrNull { item -> item.userVO.uid == UserUtils.getUserUid() }?.let {
it.redEnvelopeGiftItemVOs?.apply {
if (!isEmpty()) {
val adapter = RedPackageGiftAdapter(R.layout.item_red_package_gift_top)
binding.rvGift.visibility = View.VISIBLE
binding.tvDiamondNum.visibility = View.GONE
binding.tvDiamond.visibility = View.GONE
binding.rvGift.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding.rvGift.adapter = adapter
adapter.setNewData(this)
binding.tvTips.setTextColor(Color.WHITE)
binding.tvTips.text = MessageView.SpannableBuilder(binding.tvTips)
.append("礼物已存入背包,总价值")
.append(it.amount, ForegroundColorSpan(Color.parseColor("#FDCD00")))
.append("钻石")
.build()
}
}
binding.tvDiamondNum.text = it.amount
}
}
TIME_OUT, REMAIN_ZERO, TIME_OUT_BACK -> {
binding.clOpened.setBackgroundResource(R.drawable.room_red_package_no_get_bg)
binding.tvDiamondNum.visibility = View.GONE
binding.tvDiamond.visibility = View.GONE
binding.tvTips.visibility = View.GONE
binding.tvNoGet.visibility = View.VISIBLE
}
}
binding.tvRedNum.text = "已领取${pickNum}/${totalNum}"
if (type == ALL_GIFT || type == ALL_DIAMOND) {
DemoCache.saveRedPackage(id)
}
}
val adapter = RedPackageOpenAdapter()
binding.rvUsers.adapter = adapter
binding.rvUsers.layoutManager = LinearLayoutManager(context)
adapter.setNewData(packageInfo.redEnvelopeItemVOs)
}
}
override fun onDestroyView() {
super.onDestroyView()
mObjectAnimator?.cancel()
mObjectAnimator = null
}
}

View File

@@ -0,0 +1,237 @@
package com.yizhuan.erban.avroom.redpackage
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Paint
import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import com.jungly.gridpasswordview.GridPasswordView
import com.yinyuan.xchat_android_core.redpackage.RedPackageModel
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.common.widget.dialog.DialogManager
import com.yizhuan.erban.databinding.DialogRedPackageSendBinding
import com.yizhuan.erban.pay.password.GiveGoldPassWordFragment
import com.yizhuan.erban.ui.login.BinderPhoneActivity
import com.yizhuan.erban.ui.pay.ChargeActivity
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
import com.yizhuan.erban.ui.webview.DialogWebViewActivity
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.initial.InitialModel
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.pay.PayModel
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent
import com.yizhuan.xchat_android_core.redpackage.ALL_DIAMOND
import com.yizhuan.xchat_android_core.redpackage.ALL_GIFT
import com.yizhuan.xchat_android_core.redpackage.ROOM_DIAMOND
import com.yizhuan.xchat_android_core.redpackage.ROOM_GIFT
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.utils.toIntOrDef
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
import com.yizhuan.xchat_android_library.utils.codec.DESUtils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
class RedPackageSendDialog : BaseDialog<DialogRedPackageSendBinding>(), GridPasswordView.OnPasswordChangedListener, TextWatcher {
private var passWordFragment: GiveGoldPassWordFragment? = null
private val dialogManager by lazy { DialogManager(context) }
private var isAll = false
private var isGift = false
override fun initBinding(inflater: LayoutInflater): DialogRedPackageSendBinding {
return DialogRedPackageSendBinding.inflate(inflater)
}
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
height = WindowManager.LayoutParams.WRAP_CONTENT
super.onStart()
}
@SuppressLint("SetTextI18n")
override fun init() {
EventBus.getDefault().register(this)
PayModel.get().currentWalletInfo?.let {
binding.tvBalanceNum.text = it.diamondNum.toString()
}
val initInfo = InitialModel.get().cacheInitInfo
fun changeToAll() {
isAll = true
binding.tvAllRed.alpha = 1f
binding.tvRoomRed.alpha = 0.5f
binding.indicatorAllRed.visibility = View.VISIBLE
binding.indicatorRoomRed.visibility = View.GONE
binding.tvGoldNumHint.text = "红包总金额不低于${initInfo.redEnvelopeConfig.serverRedEnvelopeMinAmount}钻石且必须为100的倍数"
binding.editRedNum.hint = "${initInfo.redEnvelopeConfig.serverRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.serverRedEnvelopeMaxNum}"
}
fun changeToNotAll() {
isAll = false
binding.tvAllRed.alpha = 0.5f
binding.tvRoomRed.alpha = 1f
binding.indicatorAllRed.visibility = View.GONE
binding.indicatorRoomRed.visibility = View.VISIBLE
binding.tvGoldNumHint.text = "红包总金额不低于${initInfo.redEnvelopeConfig.roomRedEnvelopeMinAmount}钻石且必须为100的倍数"
binding.editRedNum.hint = "${initInfo.redEnvelopeConfig.roomRedEnvelopeMinNum}-${initInfo.redEnvelopeConfig.roomRedEnvelopeMaxNum}"
}
when (initInfo.redEnvelopedPosition) {
2 -> changeToAll()
else -> changeToNotAll()
}
binding.tvCharge.paint.flags = Paint.UNDERLINE_TEXT_FLAG
binding.tvCharge.paint.isAntiAlias = true
binding.tvChangeType.paint.flags = Paint.UNDERLINE_TEXT_FLAG
binding.tvChangeType.paint.isAntiAlias = true
binding.tvChangeType.setOnClickListener {
if (isGift) {
isGift = false
binding.tvRedTypeHint.text = "当前为手气红包,"
binding.tvChangeType.text = "改为礼物红包"
} else {
isGift = true
binding.tvRedTypeHint.text = "当前为礼物红包,"
binding.tvChangeType.text = "改为手气红包"
}
}
//默认就已经是手气红包,如果后台配置为了礼物红包就在这里改下
if (initInfo.redEnvelopeType == 2 && !isGift) {
binding.tvChangeType.callOnClick()
}
binding.tvCharge.setOnClickListener { ChargeActivity.start(context) }
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
binding.ivHelp.setOnClickListener { DialogWebViewActivity.start(context, UriProvider.getRedPacketRule()) }
binding.ivSend.setOnClickListener {
UserModel.get().cacheLoginUserInfo?.let {
if (!it.isBindPhone) {
startActivity(Intent(context, BinderPhoneActivity::class.java))
return@setOnClickListener
} else if (!it.isBindPaymentPwd) {
ModifyPwdActivity.start(context, ModifyPwdActivity.PAY_PWD)
return@setOnClickListener
}
}
val minNum = if (isAll) initInfo.redEnvelopeConfig.serverRedEnvelopeMinNum else initInfo.redEnvelopeConfig.roomRedEnvelopeMinNum
val maxNum = if (isAll) initInfo.redEnvelopeConfig.serverRedEnvelopeMaxNum else initInfo.redEnvelopeConfig.roomRedEnvelopeMaxNum
val minGold = if (isAll) initInfo.redEnvelopeConfig.serverRedEnvelopeMinAmount else initInfo.redEnvelopeConfig.roomRedEnvelopeMinAmount
val maxGold = if (isAll) initInfo.redEnvelopeConfig.serverRedEnvelopeMaxAmount else initInfo.redEnvelopeConfig.roomRedEnvelopeMaxAmount
val rate = if (initInfo.redEnvelopeConfig.exchangeDiamondsRate == 0.0) 0.68 else initInfo.redEnvelopeConfig.exchangeDiamondsRate
val redNum = binding.editRedNum.text.toString().toIntOrDef()
if (redNum < minNum || redNum > maxNum) {
SingleToastUtil.showToast("红包数量不能小于${minNum}或大于${maxNum}!")
return@setOnClickListener
}
val goldNum = binding.editGoldNum.text.toString().toIntOrDef()
if (goldNum % 100 != 0) {
SingleToastUtil.showToast("钻石数必须为100的倍数!")
return@setOnClickListener
}
if (goldNum < minGold || goldNum > maxGold) {
SingleToastUtil.showToast("钻石数量不能小于${minGold}或大于${maxGold}!")
return@setOnClickListener
}
if (isGift && goldNum.toFloat() / redNum < 1) {//单个礼物红包价值不低于1钻石
SingleToastUtil.showToast("单个红包金额过低")
return@setOnClickListener
}
if (!isGift && goldNum.toFloat() / redNum * rate < 0.1) {//单个手气红包价值不低于0.1水晶
SingleToastUtil.showToast("单个红包金额过低")
return@setOnClickListener
}
GiveGoldPassWordFragment.newInstance(requireFragmentManager(), binding.editGoldNum.text.toString()).apply {
setListener(this@RedPackageSendDialog)
passWordFragment = this
}
};
binding.tvAllRed.setOnClickListener {
if (isAll) return@setOnClickListener
changeToAll()
}
binding.tvRoomRed.setOnClickListener {
if (!isAll) return@setOnClickListener
changeToNotAll()
}
binding.editRedText.addTextChangedListener(this)
binding.editRedText.setOnEditorActionListener { _, _, event ->
event.keyCode == KeyEvent.KEYCODE_ENTER
}
// StatUtil.onEvent("room_sendhongbao", "进入发红包页面")
}
private fun getRedType(): Int {
return if (isAll) {
if (isGift) ALL_GIFT else ALL_DIAMOND
} else {
if (isGift) ROOM_GIFT else ROOM_DIAMOND
}
}
override fun onDestroyView() {
binding.editRedText.removeTextChangedListener(this)
super.onDestroyView()
}
@SuppressLint("CheckResult")
override fun onTextChanged(psw: String) {
val password = passWordFragment?.password?.password ?: ""
if (password.length == 6) {
dialogManager.showProgressDialog(context)
RedPackageModel.sendRedPackage(binding.editGoldNum.text.toString(),
binding.editRedText.text.toString().ifEmpty { "恭喜发财,大吉大利!" },
binding.editRedNum.text.toString(),
AvRoomDataManager.get().mCurrentRoomInfo?.uid.toString(), getRedType(), DESUtils.DESAndBase64(password))
.doOnError {
dialogManager.dismissDialog()
SingleToastUtil.showToast(it.message)
passWordFragment?.password?.clearPassword()
}
.subscribe { _ ->
dialogManager.dismissDialog()
SingleToastUtil.showToast("发送成功")
// StatUtil.onEvent("room_sendhongbao_success", "发红包成功")
passWordFragment?.dismissAllowingStateLoss()
dismissAllowingStateLoss()
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
binding.tvBalanceNum.text = PayModel.get().currentWalletInfo?.getGoldNum()?.toString()
?: "0"
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
}
override fun onInputFinish(psw: String) {
}
@SuppressLint("SetTextI18n")
override fun afterTextChanged(s: Editable) {
binding.tvRedTextLimit.text = "${s.length}/20"
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
}

View File

@@ -45,6 +45,7 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.orhanobut.logger.Logger;
import com.tongdaxing.erban.sadmin.utils.SaAttachmentToMsgUtil;
import com.yinyuan.xchat_android_core.redpackage.RedEnvelopeRoomMsg;
import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
@@ -89,6 +90,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.MonsterStatusAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.MultiGiftAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.MusicInfoAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NobleAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageRoomMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2;
@@ -164,6 +166,11 @@ import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import lombok.Setter;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_DIAMOND;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ALL_GIFT;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ROOM_DIAMOND;
import static com.yizhuan.xchat_android_core.redpackage.RedPackageTypeKt.ROOM_GIFT;
/**
* 直播间消息界面
*
@@ -172,7 +179,7 @@ import lombok.Setter;
public class MessageView extends FrameLayout {
private static final String TAG = "MessageView";
private final int textColor = 0x80ffffff;
private final static int MAX_MESSAGE_SIZE = 2000;//公屏最多展示条数
private final static int BLOCK_MAX_MESSAGE_SIZE = MAX_MESSAGE_SIZE * 3 / 2;//在查看消息停住的时候 最多消息条数.
private RecyclerView messageListView;
@@ -768,6 +775,8 @@ public class MessageView extends FrameLayout {
//收藏了房间
setFollowRoomTip(tvContent, (RoomTipAttachment) attachment, chatRoomMessage);
}
} else if (second == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_MSG) {
setRedPackageMsg(chatRoomMessage, tvContent);
}
else {
tvContent.setTextColor(Color.WHITE);
@@ -818,6 +827,35 @@ public class MessageView extends FrameLayout {
tvContent.setMovementMethod(new LinkMovementMethod());
}
private void setRedPackageMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
if (chatRoomMessage.getAttachment() instanceof RedPackageRoomMsgAttachment) {
RedPackageRoomMsgAttachment attachment = (RedPackageRoomMsgAttachment) chatRoomMessage.getAttachment();
RedEnvelopeRoomMsg roomMsg = attachment.getRedEnvelopeRoomMsg();
String openNickname = RegexUtil.getPrintableString(roomMsg.getOpenRedEnvelopeUserNick());
String sendNickname = RegexUtil.getPrintableString(roomMsg.getRedEnvelopeMasterNick());
SpannableBuilder text = new SpannableBuilder(tvContent)
.append(openNickname, new ForegroundColorSpan(roomTipColor))
.append("打开", new ForegroundColorSpan(textColor))
.append(sendNickname, new ForegroundColorSpan(roomTipColor));
switch (roomMsg.getRedEnvelopeType()) {
case ALL_DIAMOND:
case ROOM_DIAMOND:
text.append("的红包领取了", new ForegroundColorSpan(textColor))
.append(roomMsg.getAmount() + "水晶", new ForegroundColorSpan(roomTipColor));
tvContent.setText(text.build());
break;
case ALL_GIFT:
case ROOM_GIFT:
text.append("的红包领取了价值", new ForegroundColorSpan(textColor))
.append(roomMsg.getAmount() + "灵石", new ForegroundColorSpan(roomTipColor))
.append("的礼物", new ForegroundColorSpan(textColor));
tvContent.setText(text.build());
}
}
}
/**
* 提示加入话题
*

View File

@@ -26,6 +26,7 @@ import androidx.fragment.app.FragmentManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.Observer;
@@ -35,10 +36,14 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
import com.yinyuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.erban.MiddleActivity;
import com.yizhuan.erban.NimMiddleActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.redpackage.RedPackageGoRoomDialog;
import com.yizhuan.erban.avroom.redpackage.RedPackageOpenDialog;
import com.yizhuan.erban.common.LoadingFragment;
import com.yizhuan.erban.common.NetworkErrorFragment;
import com.yizhuan.erban.common.NoDataFragment;
@@ -59,14 +64,17 @@ import com.yizhuan.erban.ui.login.RegisterActivity;
import com.yizhuan.erban.ui.pay.ChargeActivity;
import com.yizhuan.erban.ui.widget.DefaultToolBar;
import com.yizhuan.erban.ui.widget.dialog.OpenNobleGlobalNoticeDialog;
import com.yizhuan.erban.utils.UserUtils;
import com.yizhuan.tutu.mentoring_relationship.dialog.GrabApprenticesNoticeDialog;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.mentoring_relationship.event.GrabApprenticesEvent;
import com.yizhuan.xchat_android_core.noble.NobleInfo;
import com.yizhuan.xchat_android_core.noble.NobleProtocol;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_library.rxbus.RxBus;
import com.yizhuan.xchat_android_library.utils.ImeUtil;
@@ -91,6 +99,9 @@ import static com.yizhuan.xchat_android_core.Constants.DEBUG_MAX_UID;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_NOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_GIFT;
/**
@@ -643,15 +654,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
getSupportFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
public void showCustomFragment(Fragment fragment) {
View status = findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
getSupportFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
@Override
public void showLoading(View view, int drawable, int tips) {
@@ -978,6 +980,22 @@ public abstract class BaseActivity extends RxAppCompatActivity
}
}
break;
case CUSTOM_MSG_RED_PACKAGE:
switch (baseProtocol.getSecond()) {
case CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_GIFT:
case CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND:
if (this instanceof AddUserInfoActivity || this instanceof LoginActivity || UserUtils.getUserInfo() == null)
return;
RedPackageNotifyInfo notifyInfo = new Gson().fromJson(String.valueOf(baseProtocol.getData()), RedPackageNotifyInfo.class);
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo != null && roomInfo.getUid() == notifyInfo.getRoomUid() && context instanceof AVRoomActivity) {
RedPackageOpenDialog.Companion.newInstance(notifyInfo).show(this);
} else {
RedPackageGoRoomDialog.Companion.newInstance(notifyInfo).show(this);
}
break;
}
break;
default:
break;
}

View File

@@ -0,0 +1,61 @@
package com.yizhuan.erban.base
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.*
import androidx.fragment.app.FragmentActivity
import androidx.viewbinding.ViewBinding
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.trello.rxlifecycle3.components.support.RxDialogFragment
import java.lang.Exception
abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
private var _binding: T? = null
val binding get() = _binding!!
var width = ScreenUtil.getDialogWidth()
var height = WindowManager.LayoutParams.WRAP_CONTENT
override fun onStart() {
super.onStart()
val window = dialog?.window
if (window != null) {
window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val windowParams = window.attributes
windowParams.width = width
windowParams.height = height
windowParams.dimAmount = 0.5f
windowParams.gravity = Gravity.CENTER
window.attributes = windowParams
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
_binding = initBinding(inflater)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
init()
}
fun show(context: Context?) {
try {
show((context as FragmentActivity).supportFragmentManager, null)
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
abstract fun initBinding(inflater: LayoutInflater): T
abstract fun init()
}

View File

@@ -0,0 +1,33 @@
package com.yizhuan.erban.common;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
public class EmptyViewHelper {
public static View createEmptyView(Context context, String text) {
if (!NetworkUtils.isNetworkAvailable(context)) text = "网络异常,请检查网络再试~";
View view = LayoutInflater.from(context).inflate(R.layout.layout_ktv_empty, null);
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
return view;
}
public static View createDarkEmptyView(Context context, String text) {
if (!NetworkUtils.isNetworkAvailable(context)) text = "网络异常,请检查网络再试~";
View view = LayoutInflater.from(context).inflate(R.layout.layout_ktv_empty, null);
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
((ImageView) view.findViewById(R.id.iv_status)).setImageResource(R.drawable.empty_content_dark);
return view;
}
}

View File

@@ -0,0 +1,65 @@
package com.yinyuan.doudou.pay.activity
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.yinyuan.doudou.pay.adapter.LatelyGiveAdapter
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseActivity
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import kotlinx.android.synthetic.main.activity_give_gold.*
class GiveGoldActivity : BaseActivity() {
private lateinit var adapter: LatelyGiveAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_give_gold)
initTitleBar("钻石转赠")
recyclerView.layoutManager = LinearLayoutManager(this)
adapter = LatelyGiveAdapter()
adapter.bindToRecyclerView(recyclerView)
adapter.emptyView = EmptyViewHelper.createEmptyView(this, "暂无数据")
adapter.setOnItemClickListener { _, _, position ->
adapter.getItem(position)?.let {
GiveGoldToUserActivity.start(this, it)
}
}
llSearch.setOnClickListener { GiveGoldSearchActivity.start(this) }
}
@SuppressLint("CheckResult")
override fun onResume() {
super.onResume()
UserModel.get().giveUserList
.compose(bindToLifecycle())
.doOnError { toast(it.message) }
.subscribe { users ->
adapter.setNewData(users.filterNotNull())
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK && requestCode == GiveGoldSearchActivity.REQUEST_CODE) {
GiveGoldToUserActivity.start(this, UserInfo().apply {
val room = data?.getParcelableExtra<SearchRoomInfo>("searchRoomInfo")
room?.let {
birth = it.birth
erbanNo = it.erbanNo
uid = it.uid
nick = it.nick
avatar = it.avatar
}
})
}
}
}

View File

@@ -0,0 +1,83 @@
package com.yinyuan.doudou.pay.activity
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.recyclerview.widget.LinearLayoutManager
import android.text.Editable
import android.text.TextWatcher
import com.yinyuan.doudou.pay.adapter.GiveSearchAdapter
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseActivity
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo
import com.yizhuan.xchat_android_core.room.model.AvRoomModel
import com.yizhuan.xchat_android_core.utils.net.RxHelper
import kotlinx.android.synthetic.main.activity_give_gold_search.*
class GiveGoldSearchActivity : BaseActivity(), TextWatcher {
companion object {
const val REQUEST_CODE = 0xff12
@JvmStatic
fun start(context: Activity) {
val intent = Intent(context, GiveGoldSearchActivity::class.java)
context.startActivityForResult(intent, REQUEST_CODE)
}
}
private lateinit var rvDelegate: RVDelegate<SearchRoomInfo>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_give_gold_search)
val adapter = GiveSearchAdapter()
rvDelegate = RVDelegate.Builder<SearchRoomInfo>()
.setPageSize(Int.MAX_VALUE)
.setEmptyView(EmptyViewHelper.createEmptyView(this, "暂无搜索内容"))
.setLayoutManager(LinearLayoutManager(this))
.setRecyclerView(recyclerView)
.setAdapter(adapter)
.build()
adapter.setOnItemClickListener { _, _, position ->
setResult(Activity.RESULT_OK, Intent().apply {
adapter.getItem(position)?.let {
putExtra("searchRoomInfo", it as Parcelable)
}
})
finish()
}
editSearch.addTextChangedListener(this)
tvCancel.setOnClickListener { finish() }
}
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
@SuppressLint("CheckResult")
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
rvDelegate.setNewData(null)
} else {
AvRoomModel.get()
.roomSearch(s.toString())
.compose(RxHelper.handleBeanData())
.doOnError { rvDelegate.loadErr(true) }
.compose(bindToLifecycle())
.subscribe { rooms ->
rvDelegate.setNewData(rooms)
}
}
}
}

View File

@@ -0,0 +1,33 @@
package com.yizhuan.erban.pay.activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseActivity
import kotlinx.android.synthetic.main.activity_give_gold_success.*
class GiveGoldSuccessActivity : BaseActivity() {
companion object {
@JvmStatic
fun start(context: Context, gold: String, nickname: String) {
val intent = Intent(context, GiveGoldSuccessActivity::class.java)
intent.putExtra("gold", gold)
intent.putExtra("nickname", nickname)
context.startActivity(intent)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_give_gold_success)
initTitleBar("转赠到寻梦帐号")
tvNickname.text = "转赠给:${intent.getStringExtra("nickname")}"
tvGold.text = "${intent.getStringExtra("gold").toInt()}钻石"
tvSure.setOnClickListener { finish() }
}
}

View File

@@ -0,0 +1,113 @@
package com.yinyuan.doudou.pay.activity
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import com.jungly.gridpasswordview.GridPasswordView
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseActivity
import com.yizhuan.erban.pay.activity.GiveGoldSuccessActivity
import com.yizhuan.erban.pay.password.GiveGoldPassWordFragment
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.xchat_android_core.DemoCache
import com.yizhuan.xchat_android_core.pay.PayModel
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import kotlinx.android.synthetic.main.activity_give_gold_to_user.*
class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChangedListener, TextWatcher {
companion object {
@JvmStatic
fun start(context: Context, user: UserInfo) {
val intent = Intent(context, GiveGoldToUserActivity::class.java)
intent.putExtra("user", user)
context.startActivity(intent)
}
}
private var userInfo: UserInfo? = null
private var passWordFragment: GiveGoldPassWordFragment? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_give_gold_to_user)
userInfo = intent.getSerializableExtra("user") as UserInfo?
init()
}
@SuppressLint("SetTextI18n")
private fun init() {
initTitleBar("转赠到寻梦帐号")
userInfo?.apply {
tvId.text = "Id:${erbanNo}"
tvNickname.text = nick
ImageLoadUtils.loadAvatar(context, avatar, ivAvatar)
val initInfo = DemoCache.readInitInfo()
editGold.hint = if (initInfo.redEnvelopeConfig.rate == 0.0) "请输入转赠钻石数量" else "请输入转赠钻石数量需为10倍数"
tv_desc.text = if (initInfo.redEnvelopeConfig.rate == 0.0) "钻石" else "钻石,另将收取一定比例手续费"
tvSure.setOnClickListener {
var gold = editGold.text.toString().toInt()
if (gold <= 0) {
toast("请输入正确钻石数量")
return@setOnClickListener
}
var rateGold = gold * initInfo.redEnvelopeConfig.rate / 100
GiveGoldPassWordFragment.newInstance(supportFragmentManager, gold.toString(), nick, if (rateGold == 0.0) "" else "手续费:(${initInfo.redEnvelopeConfig.rate.toInt()}%): ${rateGold}钻石")
.apply {
passWordFragment = this
setListener(this@GiveGoldToUserActivity)
}
}
}
tvCoin.text = PayModel.get().currentWalletInfo?.canGiveGoldNum?.toString() ?: "0"
editGold.addTextChangedListener(this)
}
@SuppressLint("CheckResult")
override fun onInputFinish(psw: String) {
}
override fun onTextChanged(psw: String) {
val password = passWordFragment?.password?.password ?: ""
if (password.length == 6) {
userInfo?.apply {
dialogManager.showProgressDialog(context)
PayModel.get().giveGold(uid, editGold.text.toString(), password)
.compose(bindToLifecycle())
.doOnError {
toast(it.message)
passWordFragment?.password?.clearPassword()
dialogManager.dismissDialog()
}
.subscribe { _ ->
passWordFragment?.dismissAllowingStateLoss()
dialogManager.dismissDialog()
finish()
GiveGoldSuccessActivity.start(context, editGold.text.toString(), nick)
}
}
}
}
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrBlank()) {
editGold.textSize = 15f
tvSure.isEnabled = false
} else {
editGold.textSize = 35f
tvSure.isEnabled = true
}
}
}

View File

@@ -0,0 +1,30 @@
package com.yizhuan.erban.pay.adapter;
import android.text.TextUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
/**
* <p> 充值adapter </p>
* Created by Administrator on 2017/11/20.
*/
public class ChargeAdapter extends BaseQuickAdapter<ChargeBean, BaseViewHolder> {
public ChargeAdapter() {
super(R.layout.list_item_charge);
}
@Override
protected void convert(BaseViewHolder baseViewHolder, ChargeBean chargeBean) {
if (chargeBean == null) return;
baseViewHolder
// .setText(R.id.item_charge_gold, chargeBean.chargeGoldNum)
.setText(R.id.tv_desc, chargeBean.prodDesc)
// .setText(R.id.item_charge_money, "" + chargeBean.money)
.setGone(R.id.tv_desc, !TextUtils.isEmpty(chargeBean.prodDesc));
}
}

View File

@@ -0,0 +1,37 @@
package com.yinyuan.doudou.pay.adapter
import android.annotation.SuppressLint
import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.coorchice.library.SuperTextView
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
class GiveSearchAdapter : BaseQuickAdapter<SearchRoomInfo, BaseViewHolder>(R.layout.item_lately_give) {
@SuppressLint("SetTextI18n")
override fun convert(helper: BaseViewHolder, item: SearchRoomInfo) {
helper.getView<TextView>(R.id.tv_id).text = "Id:${item.erbanNo}"
helper.getView<TextView>(R.id.tv_nickname).text = item.nick
setGenderAndBirth(helper.getView(R.id.tv_gender), item.gender, item.birth)
ImageLoadUtils.loadAvatar(mContext, item.avatar, helper.getView(R.id.iv_avatar))
}
private fun setGenderAndBirth(tvGender: SuperTextView, gender: Int, birth: Long) {
if (gender == 1) {
tvGender.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_man_white, 0, 0, 0)
tvGender.solid = Color.parseColor("#FF72D1E7")
}
if (gender == 2) {
tvGender.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_women_white, 0, 0, 0)
tvGender.solid = Color.parseColor("#FFEF82B6")
}
tvGender.text = ((CurrentTimeUtils.getCurrentTime() - birth) / 1000 / 60 / 60 / 24 / 365).toString()
}
}

View File

@@ -0,0 +1,37 @@
package com.yinyuan.doudou.pay.adapter
import android.annotation.SuppressLint
import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.coorchice.library.SuperTextView
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.xchat_android_core.user.bean.UserInfo
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
class LatelyGiveAdapter : BaseQuickAdapter<UserInfo, BaseViewHolder>(R.layout.item_lately_give) {
@SuppressLint("SetTextI18n")
override fun convert(helper: BaseViewHolder, item: UserInfo) {
helper.getView<TextView>(R.id.tv_id).text = "Id:${item.erbanNo}"
helper.getView<TextView>(R.id.tv_nickname).text = item.nick
setGenderAndBirth(helper.getView(R.id.tv_gender), item.gender, item.birth)
ImageLoadUtils.loadAvatar(mContext, item.avatar, helper.getView(R.id.iv_avatar))
}
private fun setGenderAndBirth(tvGender: SuperTextView, gender: Int, birth: Long) {
if (gender == 1) {
tvGender.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_man_white, 0, 0, 0)
tvGender.solid = Color.parseColor("#FF72D1E7")
}
if (gender == 2) {
tvGender.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_women_white, 0, 0, 0)
tvGender.solid = Color.parseColor("#FFEF82B6")
}
tvGender.text = ((CurrentTimeUtils.getCurrentTime() - birth) / 1000 / 60 / 60 / 24 / 365).toString()
}
}

View File

@@ -0,0 +1,132 @@
package com.yizhuan.erban.pay.password;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import com.jungly.gridpasswordview.GridPasswordView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.setting.VerifyPhoneActivity;
//也可继承design中的BottomSheetDialogFragment
public class GiveGoldPassWordFragment extends DialogFragment {
private GiveGoldPasswordView mPassword;
private GridPasswordView.OnPasswordChangedListener listener;
private static GiveGoldPassWordFragment passWordFragment;
private static final String EXTRA_GOLD = "gold";
private static final String EXTRA_NICKNAME = "nickname";
private static final String EXTRA_GOLD_RATE = "rate";
public static GiveGoldPassWordFragment newInstance(FragmentManager fragmentManager, String gold) {
if (passWordFragment == null) {
passWordFragment = new GiveGoldPassWordFragment();
Bundle bundle = new Bundle();
bundle.putString(EXTRA_GOLD, gold);
passWordFragment.setArguments(bundle);
passWordFragment.show(fragmentManager, "GiveGoldPassWordFragment");
}
return passWordFragment;
}
/**
* @param gold 金额
* @param nickname 转账对象昵称
* @param rate 手续费
* @return
*/
public static GiveGoldPassWordFragment newInstance(FragmentManager fragmentManager, String gold, String nickname, String rate) {
if (passWordFragment == null) {
passWordFragment = new GiveGoldPassWordFragment();
Bundle bundle = new Bundle();
bundle.putString(EXTRA_GOLD, gold);
bundle.putString(EXTRA_NICKNAME, nickname);
bundle.putString(EXTRA_GOLD_RATE, rate);
passWordFragment.setArguments(bundle);
passWordFragment.show(fragmentManager, "GiveGoldPassWordFragment");
}
return passWordFragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
//继承BottomSheetDialogFragment时onStart()可注释掉
@Override
public void onStart() {
super.onStart();
Window window = getDialog().getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparent)));
WindowManager.LayoutParams layoutParams = window.getAttributes();
DisplayMetrics dm = new DisplayMetrics();
Display d = window.getWindowManager().getDefaultDisplay();
d.getRealMetrics(dm);
window.getWindowManager().getDefaultDisplay().getMetrics(dm);
layoutParams.width = dm.widthPixels;
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
window.setAttributes(layoutParams);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_give_gold_password, container);
init(view);
return view;
}
private void init(View view) {
mPassword = view.findViewById(R.id.give_gold_password_view);
mPassword.getCloseImageView().setOnClickListener(view12 -> dismiss());
mPassword.getForgetTextView().setOnClickListener(view1 -> VerifyPhoneActivity.start(getActivity(), true));
mPassword.getPswView().setOnPasswordChangedListener(listener);
if (getArguments() != null) {
if (!TextUtils.isEmpty(getArguments().getString(EXTRA_NICKNAME))) {
mPassword.getTvNickname().setText("转赠给:" + getArguments().getString(EXTRA_NICKNAME));
} else {
mPassword.getTvNickname().setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(getArguments().getString(EXTRA_GOLD_RATE))) {
mPassword.getTvRate().setText(getArguments().getString(EXTRA_GOLD_RATE));
} else {
mPassword.getTvRate().setVisibility(View.GONE);
}
mPassword.getTvGold().setText(getArguments().getString(EXTRA_GOLD) + "钻石");
}
}
public void setListener(GridPasswordView.OnPasswordChangedListener listener) {
this.listener = listener;
}
public GiveGoldPasswordView getPassword() {
return mPassword;
}
@Override
public void onDestroy() {
super.onDestroy();
passWordFragment = null;
}
}

View File

@@ -0,0 +1,136 @@
package com.yizhuan.erban.pay.password;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.jungly.gridpasswordview.GridPasswordView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.widget.password.PasswordKeyboardView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by lcw on 2016/11/28.
*/
public class GiveGoldPasswordView extends RelativeLayout {
private ImageView mClose;
private TextView mTitle;
private TextView mForgetPwd;
private GridPasswordView mPassword;
private TextView tvNickname;
private TextView tvRate;
private TextView tvGold;
private PasswordKeyboardView mKeyboard;
private List<String> passwordList;//记录键盘输入的值
private StringBuilder mValue;//最后保存的密码
public GiveGoldPasswordView(Context context) {
this(context, null);
}
public GiveGoldPasswordView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public GiveGoldPasswordView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
View.inflate(context, R.layout.view_give_gold_password, this);
initView();
initEvent();
}
private void initView() {
mPassword = findViewById(R.id.view_password);
mClose = findViewById(R.id.img_close);
mTitle = findViewById(R.id.tv_title);
mForgetPwd = findViewById(R.id.tv_forgetPwd);
mKeyboard = findViewById(R.id.view_keyboard);
tvGold = findViewById(R.id.tv_gold);
tvNickname = findViewById(R.id.tv_nickname);
tvRate = findViewById(R.id.tv_rate);
//打乱数字的位置
//mKeyboard.shuffleKeyboard();
}
private void initEvent() {
mValue = new StringBuilder();
passwordList = new ArrayList<>();
mKeyboard.setIOnKeyboardListener(new PasswordKeyboardView.IOnKeyboardListener() {
@Override
public void onInsertKeyEvent(String text) {
mValue.setLength(0);
passwordList.add(text);
for (int i = 0; i < passwordList.size(); i++) {
mValue.append(passwordList.get(i));
}
mPassword.setPassword(mValue.toString());
}
@Override
public void onDeleteKeyEvent() {
mValue.setLength(0);
if (passwordList.size() != 0) {
passwordList.remove(passwordList.size() - 1);
for (int i = 0; i < passwordList.size(); i++) {
mValue.append(passwordList.get(i));
}
mPassword.setPassword(mValue.toString());
}
}
});
}
//获取输入的密码
public String getPassword() {
return mValue.toString();
}
//取消
public ImageView getCloseImageView() {
return mClose;
}
//标题
public TextView getTitleTextView() {
return mTitle;
}
//忘记密码
public TextView getForgetTextView() {
return mForgetPwd;
}
public TextView getTvNickname() {
return tvNickname;
}
public TextView getTvRate() {
return tvRate;
}
public TextView getTvGold() {
return tvGold;
}
//输入密码控件
public GridPasswordView getPswView() {
return mPassword;
}
public void clearPassword(){
mValue.setLength(0);
mPassword.clearPassword();
passwordList.clear();
}
}

View File

@@ -0,0 +1,83 @@
package com.yizhuan.erban.pay.presenter;
import android.annotation.SuppressLint;
import android.content.Context;
import com.yizhuan.erban.pay.view.IChargeView;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by MadisonRong on 05/01/2018.
*/
public class ChargePresenter extends PayPresenter<IChargeView> {
private static final String TAG = "ChargePresenter";
public ChargePresenter() {
this.payModel = PayModel.get();
}
/**
* 加载用户信息(显示用户账号和钱包余额)
*/
public void loadUserInfo() {
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (userInfo != null) {
getMvpView().setupUserInfo(userInfo);
}
refreshWalletInfo(false);
}
/**
* 获取充值产品列表
*/
@SuppressLint("CheckResult")
public void getChargeList() {
payModel.getChargeList(1)
.compose(bindToLifecycle())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(chargeBeans -> {
if (chargeBeans != null) {
getMvpView().buildChargeList(chargeBeans);
} else {
getMvpView().getChargeListFail("请求数据为空");
}
});
}
/**
* 显示充值选项(支付宝或者微信)
*/
public void showChargeOptionsDialog() {
getMvpView().displayChargeOptionsDialog();
}
/**
* 发起充值
* @param context context
* @param chargeProdId 充值产品 ID
* @param payChannel 充值渠道,目前只支持
* {@link com.yinyuan.xchat_android_core.Constants#CHARGE_ALIPAY} 和
* {@link com.yinyuan.xchat_android_core.Constants#CHARGE_WX}
*/
@SuppressLint("CheckResult")
public void requestCharge(Context context, String chargeProdId, String payChannel) {
payModel.requestCharge(context, chargeProdId, payChannel)
.compose(bindToLifecycle())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(jsonObject -> {
if (jsonObject != null) {
getMvpView().getChargeOrOrderInfo(jsonObject.toString());
} else {
getMvpView().getChargeOrOrderInfoFail("请求错误");
}
});
}
}

View File

@@ -0,0 +1,47 @@
package com.yizhuan.erban.pay.presenter;
import android.annotation.SuppressLint;
import com.yizhuan.erban.pay.view.IPayView;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by MadisonRong on 08/01/2018.
*/
public class PayPresenter<T extends IPayView> extends AbstractMvpPresenter<T> {
protected PayModel payModel;
protected WalletInfo walletInfo;
public PayPresenter() {
this.payModel = PayModel.get();
}
/**
* 刷新钱包信息
*/
@SuppressLint("CheckResult")
public void refreshWalletInfo(boolean force) {
payModel.getWalletInfo()
.compose(bindToLifecycle())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(walletInfo -> {
if (walletInfo != null) {
// cache walletInfo for calling in the future
this.walletInfo = walletInfo;
PayModel.get().setCurrentWalletInfo(walletInfo);
getMvpView().setupUserWalletBalance(walletInfo);
} else {
getMvpView().getUserWalletInfoFail("请求错误");
}
});
}
}

View File

@@ -0,0 +1,26 @@
package com.yizhuan.erban.pay.view;
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import java.util.List;
/**
* Created by MadisonRong on 05/01/2018.
*/
public interface IChargeView extends IPayView {
public void setupUserInfo(UserInfo userInfo);
public void buildChargeList(List<ChargeBean> chargeBeanList);
public void getChargeListFail(String error);
public void displayChargeOptionsDialog();
public void getChargeOrOrderInfo(String data);
public void getChargeOrOrderInfoFail(String error);
}

View File

@@ -0,0 +1,16 @@
package com.yizhuan.erban.pay.view;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
/**
* Created by MadisonRong on 08/01/2018.
*/
public interface IPayView extends IMvpBaseView {
public void setupUserWalletBalance(WalletInfo walletInfo);
public void getUserWalletInfoFail(String error);
}

View File

@@ -0,0 +1,192 @@
package com.yizhuan.erban.ui.utils;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.netease.nim.uikit.common.util.sys.NetworkUtil;
import com.yizhuan.erban.base.IDataStatus;
import com.yizhuan.erban.common.EmptyViewHelper;
import com.yizhuan.xchat_android_library.utils.ListUtils;
import java.util.List;
/**
* 无聊写的,好像没什么用的样子
* create time 2018/11/28
*
* @param <T> Adapter对应数据类型
*/
public class RVDelegate<T> {
private BaseQuickAdapter<T, ? extends BaseViewHolder> adapter;
private RecyclerView recyclerView;
private SwipeRefreshLayout refreshLayout;
private int pageSize;
private IDataStatus dataStatus;
private View emptyView;
private RVDelegate(BaseQuickAdapter<T, ? extends BaseViewHolder> adapter, RecyclerView.LayoutManager layoutManager, RecyclerView recyclerView, SwipeRefreshLayout refreshLayout, IDataStatus dataStatus, View emptyView, int pageSize) {
this.adapter = adapter;
this.recyclerView = recyclerView;
this.pageSize = pageSize;
this.dataStatus = dataStatus;
this.refreshLayout = refreshLayout;
this.emptyView = emptyView;
recyclerView.setLayoutManager(layoutManager);
adapter.bindToRecyclerView(recyclerView);
}
public void addData(List<T> data) {
if (data != null) {
adapter.addData(data);
}
if (data != null && data.size() >= pageSize) {
adapter.loadMoreComplete();
} else {
adapter.loadMoreEnd();
}
}
public void setNewData(List<T> data) {
adapter.setNewData(data);
if (emptyView != null && ListUtils.isListEmpty(data)) {
adapter.setEmptyView(emptyView);
}
adapter.disableLoadMoreIfNotFullPage();
if (refreshLayout != null) refreshLayout.setRefreshing(false);
if (dataStatus != null) {
if (!ListUtils.isListEmpty(data)) {
dataStatus.hideStatus();
} else {
dataStatus.showNoData();
}
}
}
public void setNewData(List<T> data, View headView) {
adapter.setNewData(data);
if (emptyView != null && ListUtils.isListEmpty(data)) {
adapter.setEmptyView(emptyView);
}
adapter.removeAllHeaderView();
if (headView != null) {
adapter.addHeaderView(headView);
}
adapter.disableLoadMoreIfNotFullPage();
if (refreshLayout != null) refreshLayout.setRefreshing(false);
if (dataStatus != null) {
if (!ListUtils.isListEmpty(data)) {
dataStatus.hideStatus();
} else {
dataStatus.showNoData();
}
}
}
public BaseQuickAdapter<T, ? extends BaseViewHolder> getAdapter() {
return adapter;
}
public void loadData(List<T> data, boolean isRefresh) {
if (isRefresh) {
setNewData(data);
} else {
addData(data);
}
}
public void loadData(List<T> data, View headView, boolean isRefresh) {
if (isRefresh) {
setNewData(data, headView);
} else {
addData(data);
}
}
public void loadErr(boolean isRefresh) {
if (isRefresh) {
if (!NetworkUtil.isNetAvailable(recyclerView.getContext())) {
adapter.setEmptyView(EmptyViewHelper.createEmptyView(recyclerView.getContext(), "网络异常,请检查网络再试"));
} else if (emptyView != null) {
adapter.setEmptyView(emptyView);
}
if (refreshLayout != null) refreshLayout.setRefreshing(false);
if (dataStatus != null) {
if (NetworkUtil.isNetAvailable(recyclerView.getContext())) {
dataStatus.showNoData();
} else {
dataStatus.showNetworkErr();
}
}
} else {
adapter.loadMoreFail();
}
}
public static class Builder<T> {
private BaseQuickAdapter<T, ? extends BaseViewHolder> adapter;
private RecyclerView.LayoutManager layoutManager;
private RecyclerView recyclerView;
private int pageSize = Integer.MAX_VALUE;
private IDataStatus dataStatus;
private SwipeRefreshLayout refreshLayout;
private View emptyView;
public Builder<T> setAdapter(BaseQuickAdapter<T, ? extends BaseViewHolder> mAdapter) {
this.adapter = mAdapter;
return this;
}
/**
* @param pageSize 每页数量,不设置默认不分页
* @return
*/
public Builder<T> setPageSize(int pageSize) {
this.pageSize = pageSize;
return this;
}
public Builder<T> setLayoutManager(RecyclerView.LayoutManager layoutManager) {
this.layoutManager = layoutManager;
return this;
}
public Builder<T> setRecyclerView(RecyclerView recyclerView) {
this.recyclerView = recyclerView;
return this;
}
/**
* 如果设置refreshLayout,可会在每次加载完数据后隐藏刷新的view
*
* @param refreshLayout
* @return
*/
public Builder<T> setRefreshLayout(SwipeRefreshLayout refreshLayout) {
this.refreshLayout = refreshLayout;
return this;
}
public Builder<T> setDataStatus(IDataStatus dataStatus) {
this.dataStatus = dataStatus;
return this;
}
public Builder<T> setEmptyView(View emptyView) {
this.emptyView = emptyView;
return this;
}
public RVDelegate<T> build() {
return new RVDelegate<>(adapter, layoutManager, recyclerView, refreshLayout, dataStatus, emptyView, pageSize);
}
}
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="50"
android:fromAlpha="0"
android:toAlpha="1" />
<scale
android:duration="390"
android:fromXScale="0"
android:fromYScale="0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.03"
android:toYScale="1.03" />
<scale
android:duration="70"
android:fromXScale="1.03"
android:fromYScale="1.03"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="50"
android:toXScale="1"
android:toYScale="1" />
</set>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
android:duration="300"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:repeatMode="reverse"
android:pivotY="50%"
android:repeatCount="-1"
android:toXScale="1.1"
android:toYScale="1.1" />
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#0bb788" android:startColor="#12a8a8" android:type="linear" android:useLevel="true" />
<corners android:radius="100dp" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#0bb788" android:startColor="#12a8a8" android:type="linear" android:useLevel="true" />
<corners android:radius="100dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="#DBDBDB" />
<corners android:radius="100dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#10daa3" android:startColor="#17d9d9" android:type="linear" android:useLevel="true" />
<corners android:radius="100dp" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#10daa3"
android:startColor="#17d9d9"
android:type="linear"
android:useLevel="true" />
<corners android:radius="100dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/common_rb_bg" android:state_enabled="true" />
<item android:drawable="@drawable/shape_dbdbdb_100dp" android:state_enabled="false" />
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100dp"/>
<solid android:color="#dbdbdb"/>
</shape>

View 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">
<corners android:radius="@dimen/dp_10" />
<solid android:color="#D13019" />
</shape>

View 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">
<corners android:radius="100dp" />
<solid android:color="#80FFBDCC" />
</shape>

View 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">
<corners android:radius="2dp" />
<solid android:color="@color/white" />
</shape>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".pay.activity.GiveGoldSuccessActivity">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_give_gold_success" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffea3b36"
android:textSize="16sp"
android:text="转赠成功" />
<TextView
android:id="@+id/tvNickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:textColor="#ff333333"
android:textSize="13sp"
tools:text="转赠给:寄情书" />
<TextView
android:id="@+id/tvGold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff333333"
android:textSize="28sp"
tools:text="10000钻石" />
<TextView
android:id="@+id/tvSure"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="15dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="15dp"
android:background="@drawable/common_btn_bg"
android:gravity="center"
android:text="完成"
android:textColor="#ffffffff"
android:textSize="15sp" />
</LinearLayout>

View File

@@ -261,5 +261,18 @@
android:textSize="9dp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_red_package"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:scaleType="centerInside"
android:src="@drawable/room_red_package_in"
android:visibility="gone"
android:layout_centerVertical="true"
tools:visibility="visible" />
</RelativeLayout>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:layout_marginBottom="10dp"
android:src="@drawable/default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.coorchice.library.SuperTextView
android:id="@+id/tv_gender"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/dp_5"
android:adjustViewBounds="true"
android:drawableLeft="@drawable/ic_man_white"
android:drawablePadding="2dp"
android:gravity="center"
android:includeFontPadding="false"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textColor="@color/white"
android:textSize="10sp"
app:corner="6dp"
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
app:layout_constraintStart_toEndOf="@id/tv_nickname"
app:layout_constraintTop_toTopOf="@id/tv_nickname"
app:solid="#EF82B6"
tools:text="12" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="#ff333333"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/tv_id"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toTopOf="@id/iv_avatar"
app:layout_constraintVertical_chainStyle="packed"
tools:text="寄情书" />
<TextView
android:id="@+id/tv_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="#ff999999"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toBottomOf="@id/tv_gender"
tools:text="ID:123456" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<LinearLayout
android:id="@+id/ll_main_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<ImageView
android:id="@+id/img_close"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/ic_pwd_close" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
android:text="请输入支付密码"
android:textColor="@color/color_000000"
android:textSize="18dp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textColor="#333333"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_gold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:textColor="#333333"
android:textSize="28sp" />
<TextView
android:id="@+id/tv_rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textColor="#333333"
android:textSize="10sp" />
<com.jungly.gridpasswordview.GridPasswordView
android:id="@+id/view_password"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="10dp"
android:layout_marginRight="16dp"
app:gpvGridColor="#ffffff"
app:gpvLineColor="@color/line_color"
app:gpvLineWidth="1dp"
app:gpvPasswordLength="6"
app:gpvPasswordType="numberPassword"
app:gpvTextColor="@color/color_000000"
app:gpvTextSize="25sp" />
<TextView
android:id="@+id/tv_forgetPwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="15dp"
android:text="忘记密码?"
android:textColor="#EA3B36" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@+id/view_keyboard"
android:background="@color/line_color" />
<com.yizhuan.erban.ui.widget.password.PasswordKeyboardView
android:id="@+id/view_keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ll_main_password"
android:background="#f0f0f0"
android:focusable="true"
android:focusableInTouchMode="true"
android:keyBackground="@color/white"
android:keyTextColor="#000000"
android:shadowColor="#00000000"
android:shadowRadius="4"
app:pkvDeleteBackgroundColor="#f0f0f0"
app:pkvDeleteDrawable="@mipmap/keyboard_backspace" />
</RelativeLayout>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:background="@color/white"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<LinearLayout
android:id="@+id/llSearch"
android:layout_width="0dp"
android:layout_height="29dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_weight="1.0"
android:background="@drawable/bg_search_edit"
android:gravity="center_vertical">
<ImageView
android:id="@+id/search_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:src="@mipmap/icon_little_search" />
<EditText
android:id="@+id/editSearch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:background="@null"
android:hint="@string/search_hint"
android:maxLength="20"
android:text=""
android:textColor="@color/text_color_primary"
android:textColorHint="@color/text_color_secondary"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/tvCancel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center"
android:paddingRight="15dp"
android:text="@string/cancel"
android:textColor="@color/grey"
android:textSize="16sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/llSearch"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginTop="20dp"
android:layout_marginRight="15dp"
android:background="@drawable/bg_search_edit"
android:gravity="center_vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:background="@null"
android:drawableStart="@mipmap/icon_little_search"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:maxLength="20"
android:text="@string/search_hint"
android:textColor="@color/color_999999"
android:textColorHint="@color/text_color_secondary"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/tvLately"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="15dp"
android:text="最近转赠"
android:textColor="#ff333333"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llSearch" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="15dp"
app:layout_constraintTop_toBottomOf="@id/tvLately"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_bg_anim"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:autoPlay="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:loopCount="1"
app:source="all_red_package.svga" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_red"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:background="@drawable/room_red_package_go_room_bg"
app:layout_constraintBottom_toTopOf="@id/iv_close"
app:layout_constraintDimensionRatio="325:450"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1444" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line2"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4889" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line3"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.66" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line4"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.8111" />
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/default_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1" />
<TextView
android:id="@+id/tv_room_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLength="9"
android:maxLines="1"
android:textColor="#fffdcd00"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@id/tv_text"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_avatar"
tools:text="风吹来的少女" />
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="厅内的"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@id/tv_nickname"
app:layout_constraintStart_toEndOf="@id/tv_room_name"
app:layout_constraintTop_toBottomOf="@id/iv_avatar" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLength="9"
android:maxLines="1"
android:textColor="#fffdcd00"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_text"
app:layout_constraintTop_toBottomOf="@id/iv_avatar"
tools:text="风吹来的少女风吹来的少女" />
<TextView
android:id="@+id/tv_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line2"
tools:text="恭喜发财,大吉大利!" />
<ImageView
android:id="@+id/iv_go_room"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:src="@drawable/room_red_package_go_room_btn"
app:layout_constraintBottom_toTopOf="@id/line4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line3" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/room_red_package_close"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_red" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,309 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_red"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:background="@drawable/room_red_package_open_bg"
app:layout_constraintDimensionRatio="325:450"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1444" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line2"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4889" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line3"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.6278" />
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/default_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="#fffdcd00"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_avatar"
tools:text="风吹来的少女" />
<TextView
android:id="@+id/tv_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line2"
tools:text="恭喜发财,大吉大利!" />
<ImageView
android:id="@+id/iv_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/room_red_package_open_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line3" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_opened"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:background="@drawable/room_red_package_get_bg"
android:visibility="gone"
app:layout_constraintDimensionRatio="325:450"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line1_opened"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1956" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line2_opened"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.2722" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line3_opened"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.44" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line4"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.465" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line5"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<ImageView
android:id="@+id/iv_avatar_opened"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/default_avatar"
app:layout_constraintEnd_toStartOf="@id/tv_nickname_opened"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1_opened" />
<TextView
android:id="@+id/tv_nickname_opened"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:ellipsize="end"
android:lines="1"
android:maxLength="10"
android:text="风吹来的少女"
android:textColor="#fffdcd00"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/iv_avatar_opened"
app:layout_constraintEnd_toStartOf="@id/tv_of_red"
app:layout_constraintStart_toEndOf="@id/iv_avatar_opened"
app:layout_constraintTop_toTopOf="@id/iv_avatar_opened" />
<TextView
android:id="@+id/tv_of_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="的红包"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/iv_avatar_opened"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_nickname_opened"
app:layout_constraintTop_toTopOf="@id/iv_avatar_opened" />
<TextView
android:id="@+id/tv_content_opened"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="1"
android:text="恭喜发财,大吉大利!"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line2_opened" />
<TextView
android:id="@+id/tv_diamond_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
tools:text="88"
android:textColor="#ffffffff"
android:textSize="40sp"
app:layout_constraintBottom_toTopOf="@id/tv_tips"
app:layout_constraintEnd_toStartOf="@id/tv_diamond"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_content_opened"
app:layout_constraintVertical_bias="0.66" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/tv_tips"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_content_opened"
tools:itemCount="1"
tools:listitem="@layout/item_red_package_gift_top" />
<TextView
android:id="@+id/tv_diamond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="水晶"
android:textColor="#ffffffff"
android:textSize="20sp"
app:layout_constraintBaseline_toBaselineOf="@id/tv_diamond_num"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_diamond_num" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="已存入钱包,请到我的收益确认"
android:textColor="#80ffffff"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line3_opened" />
<TextView
android:id="@+id/tv_no_get"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="抢完了,下次来早点哦"
android:textColor="#ffffffff"
android:textSize="20sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/tv_red_num"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_content_opened" />
<TextView
android:id="@+id/tv_red_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginEnd="65dp"
android:includeFontPadding="false"
android:text="领取200/200个"
android:textColor="#80ffffff"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/line4" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_users"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginBottom="40dp"
android:src="@drawable/room_red_package_open_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line5" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="cl_opened,cl_red" />
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/room_red_package_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/banner" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,374 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_red"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:background="@drawable/room_red_package_bg"
app:layout_constraintDimensionRatio="325:450"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1333" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line2"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.2445" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line3"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.3667" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line4"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5167" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/line5"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.7667" />
<ImageView
android:id="@+id/iv_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:layout_marginBottom="5dp"
android:src="@drawable/room_red_package_help"
app:layout_constraintBottom_toTopOf="@id/line1"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/tv_room_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:text="厅内红包"
android:textColor="#ffffffff"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@id/tv_all_red"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1" />
<View
android:id="@+id/indicator_room_red"
android:layout_width="8dp"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="@drawable/shape_white_round_2dp"
app:layout_constraintEnd_toEndOf="@id/tv_room_red"
app:layout_constraintStart_toStartOf="@id/tv_room_red"
app:layout_constraintTop_toBottomOf="@id/tv_room_red" />
<TextView
android:id="@+id/tv_all_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:alpha="0.5"
android:text="全服红包"
android:textColor="#ffffff"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_room_red"
app:layout_constraintTop_toTopOf="@id/tv_room_red" />
<View
android:id="@+id/indicator_all_red"
android:layout_width="8dp"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="@drawable/shape_white_round_2dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@id/tv_all_red"
app:layout_constraintStart_toStartOf="@id/tv_all_red"
app:layout_constraintTop_toBottomOf="@id/tv_all_red" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_red_num"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:background="@drawable/shape_ffbdcc_round_100dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
app:layout_constraintTop_toBottomOf="@id/line2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="红包个数"
android:textColor="#ffffffff"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/edit_red_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:background="@null"
android:gravity="end"
android:hint="1-200"
android:inputType="number"
android:maxLength="8"
android:minWidth="30dp"
android:textColor="#ffffffff"
android:textColorHint="#80ffffff"
android:textCursorDrawable="@null"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_red_num"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_red_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="个"
android:textColor="#ffffffff"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_red_type_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="当前为手气红包,"
android:textColor="#ffffffff"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@id/cl_red_num"
app:layout_constraintTop_toBottomOf="@id/cl_red_num" />
<TextView
android:id="@+id/tv_change_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="改为礼物红包"
android:textColor="#FECF00"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="@id/tv_red_type_hint"
app:layout_constraintStart_toEndOf="@id/tv_red_type_hint"
app:layout_constraintTop_toTopOf="@id/tv_red_type_hint" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_gold_num"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:background="@drawable/shape_ffbdcc_round_100dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
app:layout_constraintTop_toBottomOf="@id/line3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="总钻石数"
android:textColor="#ffffffff"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/edit_gold_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:background="@null"
android:gravity="end"
android:hint="0"
android:inputType="number"
android:maxLength="8"
android:minWidth="30dp"
android:textColor="#ffffffff"
android:textColorHint="#80ffffff"
android:textCursorDrawable="@null"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_gold_num"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gold_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="钻石"
android:textColor="#ffffffff"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_gold_num_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="3dp"
android:alpha="0.5"
android:text="红包总金额不低于100钻石且必须为100的倍数"
android:textColor="#ffffffff"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@id/cl_gold_num"
app:layout_constraintTop_toBottomOf="@id/cl_gold_num" />
<FrameLayout
android:id="@+id/fl_red_text"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:background="@drawable/shape_eb203e_round_10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line4">
<EditText
android:id="@+id/edit_red_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:background="@null"
android:gravity="center"
android:hint="恭喜发财,大吉大利!"
android:maxLength="20"
android:maxLines="2"
android:textColor="#ffffffff"
android:textColorHint="#80ffffff"
android:textCursorDrawable="@null"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_red_text_limit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="5dp"
android:layout_marginBottom="4dp"
android:text="0/20"
android:textColor="#ffff8c9d"
android:textSize="10sp" />
</FrameLayout>
<TextView
android:id="@+id/tv_return_gold_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="未抢完的红包将在30分钟后返还你的钱包"
android:textColor="#ffffffff"
android:textSize="10sp"
android:alpha="0.5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl_red_text" />
<ImageView
android:id="@+id/iv_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/room_red_package_send"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line5" />
<TextView
android:id="@+id/tv_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginBottom="35dp"
android:text="钻石:"
android:alpha="0.5"
android:textColor="#ffffffff"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/tv_balance_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffffff"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="@id/tv_balance"
app:layout_constraintStart_toEndOf="@id/tv_balance"
app:layout_constraintTop_toTopOf="@id/tv_balance"
tools:text="12531" />
<TextView
android:id="@+id/tv_charge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="50dp"
android:layout_marginBottom="35dp"
android:autoLink="all"
android:text="充值钻石"
android:textColor="#ffffffff"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/room_red_package_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_red" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
tools:layout_width="200dp"
tools:background="#fd2772">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:src="@drawable/default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginEnd="20dp"
android:ellipsize="end"
android:lines="1"
android:text="风吹来得少女"
android:textColor="#fffdcd00"
android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@id/tv_time"
app:layout_constraintEnd_toStartOf="@id/tv_diamond_num"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020/01/01 00:00"
android:textColor="#ffffffff"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/tv_nickname"
app:layout_constraintTop_toBottomOf="@id/tv_nickname" />
<TextView
android:id="@+id/tv_diamond_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="88"
android:textColor="#ffffffff"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_diamond"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_diamond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="水晶"
android:textColor="#ffffffff"
android:textSize="16sp"
app:layout_constraintBaseline_toBaselineOf="@id/tv_diamond_num"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_gift"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="wrap_content"
android:layout_height="1px"
android:background="#C80C27"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@color/red">
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/iv_gift"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginBottom="5dp"
android:src="@drawable/default_avatar"
app:cborder_color="@color/white"
app:cborder_width="1px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.coorchice.library.SuperTextView
android:id="@+id/tv_gift_num"
android:layout_width="0dp"
android:layout_height="10dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="x10"
android:textColor="#FDCD00"
android:textSize="9sp"
app:corner="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/iv_gift"
app:layout_constraintStart_toStartOf="@id/iv_gift"
app:solid="#FD6178"
app:stroke_color="@color/white"
app:stroke_width="1px" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
tools:context="com.yinyuan.doudou.pay.activity.GiveGoldToUserActivity">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivAvatar"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:src="@drawable/default_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<TextView
android:id="@+id/tvNickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:text="寄情书"
android:textColor="#ff333333"
android:textSize="16sp" />
<TextView
android:id="@+id/tvId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp"
android:text="ID123456"
android:textColor="#ff999999"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:text="转赠钻石数量"
android:textColor="#ff333333"
android:textSize="13sp" />
<EditText
android:id="@+id/editGold"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:background="@drawable/bottom_line"
android:hint="请输入转赠钻石数量"
android:inputType="number"
android:textColor="#ff333333"
android:textColorHint="@color/color_999999"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="可转赠额"
android:textColor="#ff999999"
android:textSize="13sp" />
<TextView
android:id="@+id/tvCoin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#EA3B36"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="钻石,另将收取一定比例手续费"
android:textColor="#ff999999"
android:textSize="13sp" />
</LinearLayout>
<TextView
android:id="@+id/tvSure"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="15dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="15dp"
android:background="@drawable/selector_common_button"
android:enabled="false"
android:gravity="center"
android:text="确认转赠"
android:textColor="#ffffffff"
android:textSize="15sp" />
</LinearLayout>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yizhuan.erban.pay.password.GiveGoldPasswordView
android:id="@+id/give_gold_password_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="5dp"
android:paddingEnd="5dp">
<ImageView
android:id="@+id/iv_gift"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="#D21430"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textColor="#ffffffff"
android:textSize="10sp"
app:layout_constraintEnd_toStartOf="@id/tv_gift_num"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_gift"
tools:text="礼物名称" />
<TextView
android:id="@+id/tv_gift_num"
android:layout_width="wrap_content"
android:layout_height="10dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="x10"
android:textColor="#FDCD00"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="@id/tv_gift_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_gift_name"
app:layout_constraintTop_toTopOf="@id/tv_gift_name" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -9,6 +9,8 @@ buildscript {
println "\n\n\n"
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://jitpack.io' }
google()
jcenter()
}
@@ -18,7 +20,7 @@ buildscript {
//realm 数据库插件
classpath "io.realm:realm-gradle-plugin:5.3.0"
// android 资源混淆插件
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.15'
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.16'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
@@ -28,6 +30,8 @@ allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://jitpack.io' }
maven { url "http://mvn.mob.com/android" }
maven { url 'https://dl.bintray.com/umsdk/release' }

View File

@@ -346,4 +346,13 @@ public class UriProvider {
return JAVA_WEB_URL.concat("/accompany/activity/explore/index.html");
}
/**
* 红包规则
*
* @return
*/
public static String getRedPacketRule() {
return JAVA_WEB_URL.concat("seekdreams/modules/rules/rule-red-packet.html");
}
}

View File

@@ -16,10 +16,13 @@ import com.yizhuan.xchat_android_core.initial.SplashComponent;
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
import com.yizhuan.xchat_android_core.noble.NobleConfig;
import com.yizhuan.xchat_android_core.noble.NobleRight;
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils;
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
import com.yizhuan.xchat_android_library.utils.pref.ObjectPref;
import com.yizhuan.xchat_android_library.utils.pref.SettingsPref;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -51,6 +54,7 @@ public class DemoCache {
private static final String KEY_IS_FIRST_HIGH_PARTY_DIALOG = "IsFirstHighPartyDialog";
private static final String KEY_FILTRATE_TYPE = "FilTrateType";
public static final String KEY_IS_FIRST_HOME_HIGH_PARTY_DIALOG = "IsFirstHomeHighPartyDialog";
private static final String KEY_RED_PACKAGE = "RedPackage";
/**保存网页域名*/
private static final String KEY_INIT_DATA_WEBHOSTNAME = "InitDataWebHostName";
@@ -83,6 +87,27 @@ public class DemoCache {
}.getType());
}
public static Map<String, Long> readRedPackage() {
String string = SettingsPref.instance().getString(KEY_RED_PACKAGE, null);
if (TextUtils.isEmpty(string)) return null;
return new Gson().fromJson(string,
new TypeToken<Map<String, Long>>() {
}.getType());
}
public static void saveRedPackage(String id) {
Map<String, Long> map = readRedPackage();
if (map == null) map = new HashMap<>();
for (Iterator<Map.Entry<String, Long>> it = map.entrySet().iterator(); it.hasNext(); ) {
if (CurrentTimeUtils.getCurrentTime() - it.next().getValue() > 60 * 60 * 24 * 7 * 1000) {
it.remove();
}
}
map.put(id, CurrentTimeUtils.getCurrentTime());
SettingsPref.instance().putString(KEY_RED_PACKAGE, new Gson().toJson(map));
}
public static void saveBoolean(String key, boolean value) {
SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(key, value);
}

View File

@@ -21,6 +21,7 @@ import lombok.Data;
public class InitInfo implements Serializable {
private FaceComponent faceJson;
private SplashComponent splashVo;
private RedEnvelopeConfig redEnvelopeConfig;
private List<NobleRight> rights;
@SerializedName("nobleZip")
private NobleResourceComponent nobleResource;
@@ -84,6 +85,18 @@ public class InitInfo implements Serializable {
private int gameTime;//游戏链接有效期
private int gameFrequency;// 游戏发起间隔时间
/**
* 1厅内 2全服
*/
private int redEnvelopedPosition;
/**
* 1 水晶 2礼物
*/
private int redEnvelopeType;
/**
* 注册图片验证码开关
*/

View File

@@ -0,0 +1,51 @@
package com.yizhuan.xchat_android_core.initial.bean;
import java.io.Serializable;
import lombok.Data;
@Data
public class RedEnvelopeConfig implements Serializable {
/**
* 钻石转赠手续费
*/
private double rate;
private int roomRedEnvelopeMinNum;
private int roomRedEnvelopeMaxNum;
private int serverRedEnvelopeMinNum;
private int serverRedEnvelopeMaxNum;
private int roomRedEnvelopeMinAmount;
private int serverRedEnvelopeMinAmount;
private double exchangeDiamondsRate;//手气红包兑换水晶比率
/**
* 全服红包最大金额
*/
private int serverRedEnvelopeMaxAmount;
/**
* 房间红包最大金额
*/
private int roomRedEnvelopeMaxAmount;
private boolean redEnvelopeSwitch;
@Override
public String toString() {
return "RedEnvelopeConfig{" +
"rate=" + rate +
", roomRedEnvelopeMinNum=" + roomRedEnvelopeMinNum +
", roomRedEnvelopeMaxNum=" + roomRedEnvelopeMaxNum +
", serverRedEnvelopeMinNum=" + serverRedEnvelopeMinNum +
", serverRedEnvelopeMaxNum=" + serverRedEnvelopeMaxNum +
", roomRedEnvelopeMinAmount=" + roomRedEnvelopeMinAmount +
", serverRedEnvelopeMinAmount=" + serverRedEnvelopeMinAmount +
", exchangeDiamondsRate=" + exchangeDiamondsRate +
", serverRedEnvelopeMaxAmount=" + serverRedEnvelopeMaxAmount +
", roomRedEnvelopeMaxAmount=" + roomRedEnvelopeMaxAmount +
", redEnvelopeSwitch=" + redEnvelopeSwitch +
'}';
}
}

View File

@@ -174,6 +174,8 @@ public class RoomEvent {
*/
public static final int MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN = 60;
public static final int RECEIVE_RED_PACKAGE = 63;
private int event = NONE;
private int micPosition = Integer.MIN_VALUE;
private int posState = -1;

View File

@@ -29,6 +29,7 @@ public interface IPayModel extends IModel {
// 查询钱包的方法需要加权限ticket
Single<WalletInfo> getWalletInfo(long uid, String cache);
Single<WalletInfo> getWalletInfo(long uid);
Single<WalletInfo> getWalletInfo();
/*
获取充值产品列表
1,支付宝
@@ -94,4 +95,6 @@ public interface IPayModel extends IModel {
void setFirstChargeSuccess(boolean firstChargeSuccess);
Single<String> giveGold(long toUid, String goldNum,String password);
}

View File

@@ -34,6 +34,8 @@ import io.reactivex.Single;
import io.reactivex.SingleSource;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
@@ -159,6 +161,19 @@ public class PayModel extends BaseModel implements IPayModel {
return getWalletInfo(uid, CACHE_STRATEGY_NO_CACHE);
}
//获取钱包信息
@Override
public Single<WalletInfo> getWalletInfo() {
return api.getMyWallet()
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchedulers())
.doOnSuccess(info -> {
walletInfo = info;
EventBus.getDefault().post(new GetWalletInfoEvent());
});
}
@Override
public Single<List<ChargeBean>> getChargeList(int channelType) {
return api.getChargeList(
@@ -400,6 +415,13 @@ public class PayModel extends BaseModel implements IPayModel {
this.firstChargeSuccess = firstChargeSuccess;
}
@Override
public Single<String> giveGold(long toUid, String goldNum,String password) {
return api.giveGold(toUid, goldNum,password)
.compose(RxHelper.handleStringData())
.compose(RxHelper.handleSchedulers());
}
public interface Api {
/**
@@ -416,6 +438,12 @@ public class PayModel extends BaseModel implements IPayModel {
@Query("ticket") String ticket,
@Header("Cache-Control") String cacheStrategy);
/**
* 获取钱包
* @return
*/
@GET("/purse/query")
Single<ServiceResult<WalletInfo>> getMyWallet();
/**
* 获取充值产品列表
@@ -534,6 +562,17 @@ public class PayModel extends BaseModel implements IPayModel {
*/
@GET("/charge/wxpay/type")
Single<ServiceResult<WxPayType>> getWxpayType();
/**
* 钻石转赠
*
* @return
*/
@FormUrlEncoded
@POST("/user/gold/give")
Single<ServiceResult<String>> giveGold(@Field("toUid") long toUid,
@Field("goldNum") String goldNum,
@Field("password") String password);
}
}

View File

@@ -34,6 +34,9 @@ public class WalletInfo implements Parcelable {
*/
private double crystals;
/** 可转赠的钻石 */
private double canGiveGoldNum;
public WalletInfo() {
}
@@ -46,6 +49,7 @@ public class WalletInfo implements Parcelable {
amount = in.readInt();
chargeGoldNum = in.readDouble();
nobleGoldNum = in.readDouble();
canGiveGoldNum = in.readDouble();
}
@Override
@@ -57,6 +61,7 @@ public class WalletInfo implements Parcelable {
dest.writeInt(amount);
dest.writeDouble(chargeGoldNum);
dest.writeDouble(nobleGoldNum);
dest.writeDouble(canGiveGoldNum);
}
@Override
@@ -117,6 +122,14 @@ public class WalletInfo implements Parcelable {
this.amount = amount;
}
public double getCanGiveGoldNum() {
return canGiveGoldNum;
}
public void setCanGiveGoldNum(double canGiveGoldNum) {
this.canGiveGoldNum = canGiveGoldNum;
}
@Override
public String toString() {
return "WalletInfo{" +
@@ -124,6 +137,7 @@ public class WalletInfo implements Parcelable {
", goldNum=" + golds +
", diamondNum=" + diamonds +
", depositNum=" + depositNum +
", canGiveGoldNum=" + canGiveGoldNum +
", amount=" + amount +
'}';
}

View File

@@ -1,4 +1,4 @@
package com.yinyuan.xchat_android_core.redpackage
package com.yizhuan.xchat_android_core.redpackage
const val ROOM_DIAMOND = 1
const val ROOM_GIFT = 3

View File

@@ -45,6 +45,8 @@ public class SearchRoomInfo extends RoomInfo implements Parcelable, MultiItemEnt
//角标相关的
public String badge;
private long birth;
/** 是否是靓号1靓号 */
public boolean hasPrettyErbanNo;
public NobleInfo nobleUsers;

View File

@@ -468,6 +468,12 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key) {
return mRoomService.roomSearch(key)
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<RoomResult> getUserRoom(long uid) {
return mRoomService.getUserRoom(String.valueOf(uid))

View File

@@ -793,6 +793,13 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(@Query("key") String key, @Query("type") int type);
/**
* @param key
* @return
*/
@GET("/search/room")
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(@Query("key") String key);
/**
* 获取该Uid 所在的房间信息,如果不在房间 返回的房间实体uid==0,或者roomId == 0
*

View File

@@ -134,4 +134,9 @@ public interface IAvRoomModel extends IModel {
Single<RoomWelcomeConfig> getWelcomeConfig(long toUid);
/**
* 搜索房间
*/
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key);
}

View File

@@ -215,4 +215,6 @@ public interface IUserModel extends IModel {
*/
Single<String> getRandomAvatar();
Single<List<UserInfo>> getGiveUserList();
}

View File

@@ -785,6 +785,13 @@ public final class UserModel extends BaseModel implements IUserModel {
.compose(RxHelper.handleCommon());
}
@Override
public Single<List<UserInfo>> getGiveUserList() {
return api.getGiveUserList()
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchedulers());
}
private interface Api {
/**
* 获取某个用户的用户信息
@@ -987,5 +994,13 @@ public final class UserModel extends BaseModel implements IUserModel {
@GET("/userRandom/getAvatar")
Single<ServiceResult<String>> apiRandomAvatar();
/**
* 最近转赠联系人信息
*
* @return -
*/
@GET("user/gold/give/recent")
Single<ServiceResult<List<UserInfo>>> getGiveUserList();
}
}

View File

@@ -3,6 +3,8 @@ package com.yizhuan.xchat_android_library.utils.pref;
import android.content.Context;
import android.content.SharedPreferences;
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
/**
* Creator: 舒强睿
* Date:2015/1/12
@@ -30,6 +32,14 @@ public class SettingsPref extends YSharedPref {
return instanse;
}
public synchronized static SettingsPref instance() {
if(instanse == null){
SharedPreferences pref = BasicConfig.INSTANCE.getAppContext().getSharedPreferences("SettingsPrefs", Context.MODE_PRIVATE);
instanse = new SettingsPref(pref);
}
return instanse;
}
public String getString(String key, String defaultValue) {
return get(key) == null ? defaultValue : get(key);
}