转赠礼物功能开发
This commit is contained in:
@@ -857,6 +857,10 @@
|
||||
android:name=".pay.activity.GiveGoldActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".pay.activity.GiveGoldDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".pay.activity.GiveGoldToUserActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package com.yizhuan.erban.common
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
|
||||
@SuppressLint("WrongConstant")
|
||||
class CommonPagerAdapter(fm:FragmentManager, private val list:List<Fragment>) :FragmentPagerAdapter(fm,
|
||||
BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT){
|
||||
override fun getCount()=list.size
|
||||
|
||||
override fun getItem(position: Int)=list[position]
|
||||
}
|
@@ -233,22 +233,25 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
mBinding.tvConstellation.text = star
|
||||
setUserLevel(it.userLevelVo)
|
||||
setWalletInfo()
|
||||
}
|
||||
|
||||
val initInfo = InitialModel.get().cacheInitInfo
|
||||
val list = initInfo?.giveDiamondErbanNoList
|
||||
if (list?.contains(mUserInfo?.erbanNo ?: 0L) == true) {
|
||||
mBinding.tvMyRoomRight.visibility = View.GONE
|
||||
mBinding.tvMyRoom.visibility = View.VISIBLE
|
||||
mBinding.tvEarnRight.visibility = View.GONE
|
||||
mBinding.tvEarn.visibility = View.VISIBLE
|
||||
mBinding.llCleanDiamonds.visibility = View.VISIBLE
|
||||
} else {
|
||||
mBinding.tvMyRoomRight.visibility = View.VISIBLE
|
||||
mBinding.tvMyRoom.visibility = View.GONE
|
||||
mBinding.tvEarnRight.visibility = View.VISIBLE
|
||||
mBinding.tvEarn.visibility = View.GONE
|
||||
mBinding.llCleanDiamonds.visibility = View.GONE
|
||||
val initInfo = InitialModel.get().cacheInitInfo
|
||||
val diamondList = initInfo?.giveDiamondErbanNoList
|
||||
val giftList = initInfo?.giveGiftErbanNoList
|
||||
val levelSep = it.userLevelVo.experLevelSeq
|
||||
if (diamondList?.contains(it.erbanNo) == true || giftList?.contains(it.erbanNo) == true
|
||||
|| levelSep > (initInfo?.giveDiamondExperLevel ?: 0) || levelSep > (initInfo?.giveGiftExperLevel ?: 0)) {
|
||||
mBinding.tvMyRoomRight.visibility = View.GONE
|
||||
mBinding.tvMyRoom.visibility = View.VISIBLE
|
||||
mBinding.tvEarnRight.visibility = View.GONE
|
||||
mBinding.tvEarn.visibility = View.VISIBLE
|
||||
mBinding.llCleanDiamonds.visibility = View.VISIBLE
|
||||
} else {
|
||||
mBinding.tvMyRoomRight.visibility = View.VISIBLE
|
||||
mBinding.tvMyRoom.visibility = View.GONE
|
||||
mBinding.tvEarnRight.visibility = View.VISIBLE
|
||||
mBinding.tvEarn.visibility = View.GONE
|
||||
mBinding.llCleanDiamonds.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,12 +11,20 @@ import com.yizhuan.xchat_android_core.utils.toast
|
||||
class GiveGoldModel : BaseViewModel() {
|
||||
|
||||
private val _diamondGiveHistoryLiveData = MutableLiveData<ListResult<DiamondGiveHistoryInfo>?>()
|
||||
val diamondGiveHistoryLiveData: MutableLiveData<ListResult<DiamondGiveHistoryInfo>?> = _diamondGiveHistoryLiveData
|
||||
val diamondGiveHistoryLiveData: MutableLiveData<ListResult<DiamondGiveHistoryInfo>?> =
|
||||
_diamondGiveHistoryLiveData
|
||||
|
||||
private val _searchUserLiveData = MutableLiveData<SearchUserInfo?>()
|
||||
val searchUserLiveData: MutableLiveData<SearchUserInfo?> = _searchUserLiveData
|
||||
|
||||
fun getDiamondListInfo(pageNum:Int, pageSize: Int) {
|
||||
private val _giveGiftLiveData = MutableLiveData<String?>()
|
||||
val giveGiftLiveData: MutableLiveData<String?> = _giveGiftLiveData
|
||||
|
||||
private val _giveDetailLiveData = MutableLiveData<ListResult<DiamondGiveHistoryInfo>?>()
|
||||
val giveDetailLiveData: MutableLiveData<ListResult<DiamondGiveHistoryInfo>?> =
|
||||
_giveDetailLiveData
|
||||
|
||||
fun getDiamondListInfo(pageNum: Int, pageSize: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_diamondGiveHistoryLiveData.value = ListResult.failed(pageNum)
|
||||
@@ -28,7 +36,7 @@ class GiveGoldModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
fun getSearchUserInfo(erbanNo:Long) {
|
||||
fun getSearchUserInfo(erbanNo: Long) {
|
||||
safeLaunch(
|
||||
true,
|
||||
onError = {
|
||||
@@ -41,4 +49,29 @@ class GiveGoldModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
fun giveGift(toUid: Long, giftId: Int, giftNum: Int) {
|
||||
safeLaunch(
|
||||
true,
|
||||
onError = {
|
||||
it.message.toast()
|
||||
_giveGiftLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_giveGiftLiveData.value = HomeModel.giveGift(toUid, giftId, giftNum)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun giveDetailInfo(uid: Long, type: Int, pageNum: Int, pageSize: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_giveDetailLiveData.value = ListResult.failed(pageNum)
|
||||
},
|
||||
block = {
|
||||
val result = HomeModel.getGiveDetail(uid, type, pageNum, pageSize)
|
||||
_giveDetailLiveData.value = ListResult.success(result, pageNum)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -17,6 +17,7 @@ import com.yizhuan.erban.databinding.ActivityGiveGoldBinding
|
||||
import com.yizhuan.erban.pay.GiveGoldModel
|
||||
import com.yizhuan.erban.pay.adapter.LatelyGiveAdapter
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel
|
||||
import com.yizhuan.xchat_android_core.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
@@ -40,7 +41,7 @@ class GiveGoldActivity : BaseViewBindingActivity<ActivityGiveGoldBinding>() {
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
initTitleBar(ResUtil.getString(R.string.me_clean_diamond))
|
||||
initTitleBar(ResUtil.getString(R.string.me_donation))
|
||||
binding.etSearch.setOnEditorActionListener(OnEditorActionListener { v, actionId, event -> //以下方法防止两次发送请求
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH && event != null || event != null && event.keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (event.action == KeyEvent.ACTION_UP) { //发送请求
|
||||
@@ -80,9 +81,7 @@ class GiveGoldActivity : BaseViewBindingActivity<ActivityGiveGoldBinding>() {
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.build()
|
||||
mAdapter.setOnItemClickListener { _, _, position ->
|
||||
mAdapter.getItem(position)?.let {
|
||||
GiveGoldToUserActivity.start(this, it)
|
||||
}
|
||||
mAdapter.getItem(position)?.targetUid?.let { GiveGoldDetailActivity.start(this, it) }
|
||||
}
|
||||
mAdapter.setOnLoadMoreListener({
|
||||
loadData(false)
|
||||
@@ -102,6 +101,7 @@ class GiveGoldActivity : BaseViewBindingActivity<ActivityGiveGoldBinding>() {
|
||||
if (it) dialogManager.showProgressDialog(this)
|
||||
else dialogManager.dismissDialog()
|
||||
}
|
||||
GiftModel.get().knapList
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@@ -0,0 +1,115 @@
|
||||
package com.yizhuan.erban.pay.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityGiveGoldDetailBinding
|
||||
import com.yizhuan.erban.pay.fragment.GiveDiamondFragment
|
||||
import com.yizhuan.erban.pay.fragment.GiveGiftFragment
|
||||
import com.yizhuan.erban.ui.user.adapter.CommonWrapIndicatorAdapter
|
||||
import com.yizhuan.erban.ui.user.adapter.UserInfoPagerAdapter
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
/**
|
||||
* 轉贈鉆石頁面
|
||||
*/
|
||||
class GiveGoldDetailActivity : BaseViewBindingActivity<ActivityGiveGoldDetailBinding>() {
|
||||
|
||||
companion object {
|
||||
fun start(context: Context, uid: Long) {
|
||||
val intent = Intent(context, GiveGoldDetailActivity::class.java)
|
||||
intent.putExtra("uid", uid)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
initTitleBar(ResUtil.getString(R.string.me_donation_detail))
|
||||
initDetail()
|
||||
}
|
||||
|
||||
/**
|
||||
* 轉贈詳情
|
||||
*/
|
||||
private fun initDetail() {
|
||||
val uid = intent.extras?.getLong("uid", 0L) ?: 0L
|
||||
|
||||
val initInfo = InitialModel.get().cacheInitInfo
|
||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||
val diamondList = initInfo?.giveDiamondErbanNoList
|
||||
val giftList = initInfo?.giveGiftErbanNoList
|
||||
val levelSep = userInfo?.userLevelVo?.experLevelSeq ?: 0
|
||||
|
||||
val viewPager: ViewPager = binding.viewPagerDetail
|
||||
val magicIndicator: MagicIndicator = binding.magicIndicator
|
||||
val fragmentList: MutableList<Fragment> = ArrayList()
|
||||
val pagerAdapter = UserInfoPagerAdapter(supportFragmentManager, fragmentList)
|
||||
val tagList: MutableList<String> = ArrayList()
|
||||
if (diamondList?.contains(userInfo?.erbanNo) == true || levelSep > (initInfo?.giveDiamondExperLevel
|
||||
?: 0)
|
||||
) {
|
||||
tagList.add(getString(R.string.diamond))
|
||||
fragmentList.add(GiveDiamondFragment.newInstance(uid))
|
||||
}
|
||||
if (giftList?.contains(userInfo?.erbanNo) == true || levelSep > (initInfo?.giveGiftExperLevel
|
||||
?: 0)
|
||||
) {
|
||||
tagList.add(getString(R.string.gift_action))
|
||||
fragmentList.add(GiveGiftFragment.newInstance(uid))
|
||||
}
|
||||
if (tagList.size == 0) {
|
||||
return
|
||||
}else if(tagList.size == 1){
|
||||
binding.magicIndicator.visibility = View.GONE
|
||||
}
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.isAdjustMode = true//自我调节位置,实现自我平分
|
||||
val magicIndicatorAdapter = CommonWrapIndicatorAdapter(context, tagList)
|
||||
magicIndicatorAdapter.setOnItemSelectListener { position: Int, view: TextView? ->
|
||||
viewPager.currentItem = position
|
||||
}
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
magicIndicator.navigator = commonNavigator
|
||||
commonNavigator.titleContainer.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE
|
||||
viewPager.adapter = pagerAdapter
|
||||
ViewPagerHelper.bind(magicIndicator, viewPager)
|
||||
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||
override fun onPageScrolled(
|
||||
position: Int,
|
||||
positionOffset: Float,
|
||||
positionOffsetPixels: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
viewPager.requestLayout()
|
||||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
override fun setStatusBar() {
|
||||
super.setStatusBar()
|
||||
StatusBarUtil.transparencyBar(this)
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
override fun needSteepStateBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
@@ -3,39 +3,51 @@ package com.yizhuan.erban.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.InputFilter
|
||||
import android.text.InputFilter.LengthFilter
|
||||
import android.text.TextWatcher
|
||||
import android.util.SparseArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.viewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.jungly.gridpasswordview.GridPasswordView
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityGiveGoldToUserBinding
|
||||
import com.yizhuan.erban.miniworld.listener.DoubleClickCheckListener
|
||||
import com.yizhuan.erban.pay.GiveGoldModel
|
||||
import com.yizhuan.erban.pay.adapter.GiveGiftAdapter
|
||||
import com.yizhuan.erban.pay.password.GiveGoldPassWordFragment
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.erban.ui.widget.OnPageSelectedListener
|
||||
import com.yizhuan.erban.ui.widget.dialog.CommonTipDialog
|
||||
import com.yizhuan.erban.ui.widget.dialog.GiveDiamondTipDialog
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration
|
||||
import com.yizhuan.xchat_android_core.DemoCache
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.SearchUserInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import kotlinx.android.synthetic.main.activity_give_gold_to_user.*
|
||||
|
||||
class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChangedListener,
|
||||
class GiveGoldToUserActivity : BaseViewBindingActivity<ActivityGiveGoldToUserBinding>(),
|
||||
GridPasswordView.OnPasswordChangedListener,
|
||||
TextWatcher {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context, user: DiamondGiveHistoryInfo) {
|
||||
val intent = Intent(context, GiveGoldToUserActivity::class.java)
|
||||
intent.putExtra("user", user)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
private val giveGoldModel: GiveGoldModel by viewModels()
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context, searchUser: SearchUserInfo) {
|
||||
val intent = Intent(context, GiveGoldToUserActivity::class.java)
|
||||
@@ -44,17 +56,13 @@ class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChange
|
||||
}
|
||||
}
|
||||
|
||||
private var userInfo: DiamondGiveHistoryInfo? = null
|
||||
private var searchUserInfo: SearchUserInfo? = null
|
||||
private var passWordFragment: GiveGoldPassWordFragment? = null
|
||||
private var selectGiftPos = -1
|
||||
private var giftAllCount = -1
|
||||
private var giftId = -1
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_give_gold_to_user)
|
||||
userInfo = intent.getSerializableExtra("user") as DiamondGiveHistoryInfo?
|
||||
searchUserInfo = intent.getSerializableExtra("searchUser") as SearchUserInfo?
|
||||
init()
|
||||
}
|
||||
private var centerIndex = 0
|
||||
|
||||
override fun setStatusBar() {
|
||||
super.setStatusBar()
|
||||
@@ -66,153 +74,278 @@ class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChange
|
||||
return true
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun init() {
|
||||
initTitleBar(ResUtil.getString(R.string.me_clean_diamond))
|
||||
override fun init() {
|
||||
initTitleBar(ResUtil.getString(R.string.donation_to))
|
||||
searchUserInfo = intent.getSerializableExtra("searchUser") as SearchUserInfo?
|
||||
searchUserInfo?.apply {
|
||||
binding.tvId.text = "ID:${erbanNo}"
|
||||
binding.tvNickname.text = nick
|
||||
ImageLoadUtils.loadAvatar(context, avatar, binding.ivAvatar)
|
||||
}
|
||||
val initInfo = InitialModel.get().cacheInitInfo
|
||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||
val diamondList = initInfo?.giveDiamondErbanNoList
|
||||
val giftList = initInfo?.giveGiftErbanNoList
|
||||
val levelSep = userInfo?.userLevelVo?.experLevelSeq ?: 0
|
||||
if (diamondList?.contains(userInfo?.erbanNo) == true || levelSep > (initInfo?.giveDiamondExperLevel
|
||||
?: 0)
|
||||
) {
|
||||
binding.tvGiftTab.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvGiftTab.visibility = View.GONE
|
||||
}
|
||||
if (giftList?.contains(userInfo?.erbanNo) == true || levelSep > (initInfo?.giveGiftExperLevel
|
||||
?: 0)
|
||||
) {
|
||||
binding.tvGiftTab.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvGiftTab.visibility = View.GONE
|
||||
}
|
||||
binding.viewPagerEntrance.addOnPageChangeListener(object : OnPageSelectedListener() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
centerIndex = position
|
||||
binding.magicIndicatorEntrance.setSelectedPage(position)
|
||||
}
|
||||
})
|
||||
initDiamond()
|
||||
initGift()
|
||||
initListener()
|
||||
giveGoldModel.loadingLiveData.observe(this) {
|
||||
if (it) dialogManager.showProgressDialog(this)
|
||||
else dialogManager.dismissDialog()
|
||||
}
|
||||
giveGoldModel.giveGiftLiveData.observe(this) {
|
||||
it?.let {
|
||||
toast(getString(R.string.gift_give_success))
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
binding.tvSure.setOnClickListener {
|
||||
val initInfo = DemoCache.readInitInfo()
|
||||
if (binding.groupDiamond.visibility == View.VISIBLE) {
|
||||
searchUserInfo?.apply {
|
||||
val gold = binding.mEditGold.text.toString().toInt()
|
||||
if (gold <= 0) {
|
||||
toast(ResUtil.getString(R.string.pay_activity_givegoldtouseractivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
UserModel.get().cacheLoginUserInfo?.let {
|
||||
if (!it.isBindPaymentPwd) {
|
||||
val tipDialog = CommonTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTipMsg(ResUtil.getString(R.string.setting_pay_pwd_first))
|
||||
tipDialog.setOkText(getString(R.string.to_setting))
|
||||
tipDialog.setOnActionListener(
|
||||
object : CommonTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
ModifyPwdActivity.start(
|
||||
this@GiveGoldToUserActivity,
|
||||
ModifyPwdActivity.PAY_PWD
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
} else {
|
||||
val rateGold = initInfo.giveDiamondRate * 100
|
||||
val tipDialog = GiveDiamondTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTvDiamond(gold.toString())
|
||||
tipDialog.setTipMsg(getString(R.string.give_gold_to_user, nick))
|
||||
if (rateGold == 0.0) {
|
||||
tipDialog.setTipMessageGone(true)
|
||||
} else {
|
||||
tipDialog.setTvSeCharge("${rateGold.toInt()}%")
|
||||
val goldNew = gold + (gold * initInfo.giveDiamondRate)
|
||||
tipDialog.setTvConsumeDiamond(
|
||||
getString(
|
||||
R.string.consume_diamond_num,
|
||||
goldNew.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
tipDialog.setOnActionListener(
|
||||
object : GiveDiamondTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
GiveGoldPassWordFragment.newInstance(
|
||||
supportFragmentManager,
|
||||
gold.toString(),
|
||||
nick,
|
||||
""
|
||||
)
|
||||
.apply {
|
||||
passWordFragment = this
|
||||
setListener(this@GiveGoldToUserActivity)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
}
|
||||
} ?: run {
|
||||
toast(ResUtil.getString(R.string.ui_setting_settingactivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
} else {//赠送礼物
|
||||
searchUserInfo?.apply {
|
||||
val giftNum = binding.editGift.text.toString().toInt()
|
||||
if (selectGiftPos < 0) {
|
||||
toast(ResUtil.getString(R.string.please_select_gift))
|
||||
return@setOnClickListener
|
||||
} else if (giftNum == 0) {
|
||||
toast(ResUtil.getString(R.string.please_enter_gift_num))
|
||||
return@setOnClickListener
|
||||
} else if (giftNum > giftAllCount) {
|
||||
toast(ResUtil.getString(R.string.gift_num_fail))
|
||||
return@setOnClickListener
|
||||
}
|
||||
giveGoldModel.giveGift(uid, giftId, giftNum)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initDiamond() {
|
||||
if (binding.tvGiftTab.visibility == View.VISIBLE) {
|
||||
binding.tvGiftTab.isSelected = false
|
||||
binding.groupGift.visibility = View.GONE
|
||||
}
|
||||
val initInfo = DemoCache.readInitInfo()
|
||||
val length = initInfo.giveDiamondOnceLimitNum.toInt().toString().length
|
||||
mEditGold.text.filters = arrayOf<InputFilter>(LengthFilter(length))
|
||||
userInfo?.apply {
|
||||
tvId.text = "ID:${targetErbanNo}"
|
||||
tvNickname.text = targetNick
|
||||
ImageLoadUtils.loadAvatar(context, targetAvatar, ivAvatar)
|
||||
|
||||
tvSure.setOnClickListener {
|
||||
val gold = mEditGold.text.toString().toInt()
|
||||
if (gold <= 0) {
|
||||
toast(ResUtil.getString(R.string.pay_activity_givegoldtouseractivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
UserModel.get().cacheLoginUserInfo?.let {
|
||||
if (!it.isBindPaymentPwd) {
|
||||
val tipDialog = CommonTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTipMsg(ResUtil.getString(R.string.setting_pay_pwd_first))
|
||||
tipDialog.setOkText(getString(R.string.to_setting))
|
||||
tipDialog.setOnActionListener(
|
||||
object : CommonTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
ModifyPwdActivity.start(
|
||||
this@GiveGoldToUserActivity,
|
||||
ModifyPwdActivity.PAY_PWD
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
} else {
|
||||
val rateGold = initInfo.giveDiamondRate * 100
|
||||
val tipDialog = GiveDiamondTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTvDiamond(gold.toString())
|
||||
tipDialog.setTipMsg(getString(R.string.give_gold_to_user, targetNick))
|
||||
if (rateGold == 0.0) {
|
||||
tipDialog.setTipMessageGone(true)
|
||||
} else {
|
||||
tipDialog.setTvSeCharge("${rateGold.toInt()}%")
|
||||
val goldNew = gold + (gold * initInfo.giveDiamondRate)
|
||||
tipDialog.setTvConsumeDiamond(
|
||||
getString(
|
||||
R.string.consume_diamond_num,
|
||||
goldNew.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
tipDialog.setOnActionListener(
|
||||
object : GiveDiamondTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
GiveGoldPassWordFragment.newInstance(
|
||||
supportFragmentManager,
|
||||
gold.toString(),
|
||||
targetNick,
|
||||
""
|
||||
)
|
||||
.apply {
|
||||
passWordFragment = this
|
||||
setListener(this@GiveGoldToUserActivity)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
}
|
||||
} ?: run {
|
||||
toast(ResUtil.getString(R.string.ui_setting_settingactivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
searchUserInfo?.apply {
|
||||
tvId.text = "ID:${erbanNo}"
|
||||
tvNickname.text = nick
|
||||
ImageLoadUtils.loadAvatar(context, avatar, ivAvatar)
|
||||
|
||||
tvSure.setOnClickListener {
|
||||
val gold = mEditGold.text.toString().toInt()
|
||||
if (gold <= 0) {
|
||||
toast(ResUtil.getString(R.string.pay_activity_givegoldtouseractivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
UserModel.get().cacheLoginUserInfo?.let {
|
||||
if (!it.isBindPaymentPwd) {
|
||||
val tipDialog = CommonTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTipMsg(ResUtil.getString(R.string.setting_pay_pwd_first))
|
||||
tipDialog.setOkText(getString(R.string.to_setting))
|
||||
tipDialog.setOnActionListener(
|
||||
object : CommonTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
ModifyPwdActivity.start(
|
||||
this@GiveGoldToUserActivity,
|
||||
ModifyPwdActivity.PAY_PWD
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
} else {
|
||||
val rateGold = initInfo.giveDiamondRate * 100
|
||||
val tipDialog = GiveDiamondTipDialog(this@GiveGoldToUserActivity)
|
||||
tipDialog.setTvDiamond(gold.toString())
|
||||
tipDialog.setTipMsg(getString(R.string.give_gold_to_user, nick))
|
||||
if (rateGold == 0.0) {
|
||||
tipDialog.setTipMessageGone(true)
|
||||
} else {
|
||||
tipDialog.setTvSeCharge("${rateGold.toInt()}%")
|
||||
val goldNew = gold + (gold * initInfo.giveDiamondRate)
|
||||
tipDialog.setTvConsumeDiamond(
|
||||
getString(
|
||||
R.string.consume_diamond_num,
|
||||
goldNew.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
tipDialog.setOnActionListener(
|
||||
object : GiveDiamondTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
GiveGoldPassWordFragment.newInstance(
|
||||
supportFragmentManager,
|
||||
gold.toString(),
|
||||
nick,
|
||||
""
|
||||
)
|
||||
.apply {
|
||||
passWordFragment = this
|
||||
setListener(this@GiveGoldToUserActivity)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
tipDialog.show()
|
||||
}
|
||||
} ?: run {
|
||||
toast(ResUtil.getString(R.string.ui_setting_settingactivity_06))
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
mTvDiamond.text = getString(
|
||||
binding.mEditGold.text.filters = arrayOf<InputFilter>(LengthFilter(length))
|
||||
binding.mTvDiamond.text = getString(
|
||||
R.string.my_diamond,
|
||||
PayModel.get().currentWalletInfo?.diamondNum?.toString() ?: "0"
|
||||
)
|
||||
mEditGold.addTextChangedListener(this)
|
||||
binding.mEditGold.addTextChangedListener(this)
|
||||
binding.tvDiamondTab.isSelected = true
|
||||
binding.tvDiamondTab.setOnClickListener {
|
||||
if (binding.tvGiftTab.visibility == View.VISIBLE) {
|
||||
binding.tvGiftTab.isSelected = false
|
||||
binding.groupGift.visibility = View.GONE
|
||||
binding.tvDiamondTab.isSelected = true
|
||||
binding.groupDiamond.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initGift() {
|
||||
val giftList = GiftModel.get().knapList
|
||||
if (binding.tvDiamondTab.visibility == View.GONE) {
|
||||
binding.tvGiftTab.isSelected = true
|
||||
binding.tvSure.isEnabled = true
|
||||
}
|
||||
// giftList.map { it.isSelected = false }
|
||||
val list = transformList(giftList, 8)
|
||||
binding.magicIndicatorEntrance.initIndicator(list.size)
|
||||
binding.magicIndicatorEntrance.setSelectedPage(centerIndex)
|
||||
binding.magicIndicatorEntrance.visibility =
|
||||
if (list.size > 1) View.VISIBLE else View.INVISIBLE
|
||||
binding.viewPagerEntrance.adapter = object : PagerAdapter() {
|
||||
var cacheItemView = SparseArray<RecyclerView>()
|
||||
override fun getCount(): Int {
|
||||
return list.size
|
||||
}
|
||||
|
||||
override fun isViewFromObject(view: View, `object`: Any): Boolean {
|
||||
return view == `object`
|
||||
}
|
||||
|
||||
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
||||
val recyclerView: RecyclerView
|
||||
val giveGiftAdapter: GiveGiftAdapter
|
||||
if (cacheItemView[position] == null) {
|
||||
recyclerView = RecyclerView(context)
|
||||
var lp = recyclerView.layoutParams
|
||||
if (lp == null) {
|
||||
lp = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
}
|
||||
recyclerView.layoutParams = lp
|
||||
recyclerView.layoutManager = GridLayoutManager(context, 4)
|
||||
recyclerView.addItemDecoration(
|
||||
GridSpacingItemNewDecoration(
|
||||
UIUtil.dip2px(
|
||||
context,
|
||||
18.0
|
||||
), UIUtil.dip2px(context, 10.0), true
|
||||
)
|
||||
)
|
||||
giveGiftAdapter = GiveGiftAdapter()
|
||||
giveGiftAdapter.onItemClickListener = object : DoubleClickCheckListener() {
|
||||
override fun onItemClickSingle(
|
||||
adapter: BaseQuickAdapter<*, *>?,
|
||||
view: View,
|
||||
position: Int
|
||||
) {
|
||||
val oldBean = giveGiftAdapter.getItem(selectGiftPos)
|
||||
oldBean?.isSelected = false
|
||||
giveGiftAdapter.notifyItemChanged(selectGiftPos)
|
||||
val bean = giveGiftAdapter.getItem(position)
|
||||
bean?.isSelected = true
|
||||
giveGiftAdapter.notifyItemChanged(position)
|
||||
selectGiftPos = position
|
||||
giftAllCount = giveGiftAdapter.getItem(position)?.count ?: -1
|
||||
giftId = giveGiftAdapter.getItem(position)?.giftId ?: -1
|
||||
}
|
||||
}
|
||||
recyclerView.adapter = giveGiftAdapter
|
||||
} else {
|
||||
recyclerView = cacheItemView[position]
|
||||
giveGiftAdapter = recyclerView.adapter as GiveGiftAdapter
|
||||
}
|
||||
giveGiftAdapter.setNewData(list[position])
|
||||
container.addView(recyclerView)
|
||||
return recyclerView
|
||||
}
|
||||
|
||||
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
||||
val recyclerView = cacheItemView[position]
|
||||
container.removeView(recyclerView)
|
||||
}
|
||||
}
|
||||
binding.viewPagerEntrance.setCurrentItem(centerIndex, false)
|
||||
binding.editGift.addTextChangedListener(this)
|
||||
binding.tvGiftTab.setOnClickListener {
|
||||
if (binding.tvDiamondTab.visibility == View.VISIBLE) {
|
||||
binding.tvDiamondTab.isSelected = false
|
||||
binding.groupDiamond.visibility = View.GONE
|
||||
binding.tvGiftTab.isSelected = true
|
||||
binding.groupGift.visibility = View.VISIBLE
|
||||
binding.tvSure.isEnabled = true
|
||||
}
|
||||
}
|
||||
binding.tvAll.setOnClickListener {
|
||||
if (giftAllCount != -1)
|
||||
binding.editGift.setText(giftAllCount)
|
||||
}
|
||||
}
|
||||
|
||||
private fun transformList(
|
||||
data: List<GiftInfo>,
|
||||
pageSize: Int
|
||||
): List<MutableList<GiftInfo>> {
|
||||
val result: MutableList<MutableList<GiftInfo>> = ArrayList()
|
||||
if (data.isEmpty()) {
|
||||
return result
|
||||
}
|
||||
for (i in data.toTypedArray().indices) {
|
||||
var page: MutableList<GiftInfo>? = null
|
||||
if (i % pageSize == 0) {
|
||||
page = ArrayList()
|
||||
result.add(page)
|
||||
} else {
|
||||
if (result.size > 0) {
|
||||
page = result[result.size - 1]
|
||||
}
|
||||
}
|
||||
page?.add(data[i])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -223,23 +356,6 @@ class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChange
|
||||
override fun onTextChanged(psw: String) {
|
||||
val password = passWordFragment?.password?.password ?: ""
|
||||
if (password.length == 6) {
|
||||
userInfo?.apply {
|
||||
dialogManager.showProgressDialog(context)
|
||||
PayModel.get()
|
||||
.giveGold(targetUid, mEditGold.text.toString(), DESAndBase64(password))
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError {
|
||||
toast(it.message)
|
||||
passWordFragment?.password?.clearPassword()
|
||||
dialogManager.dismissDialog()
|
||||
}
|
||||
.subscribe { _ ->
|
||||
passWordFragment?.dismissAllowingStateLoss()
|
||||
dialogManager.dismissDialog()
|
||||
toast(getString(R.string.layout_activity_give_gold_success_01))
|
||||
finish()
|
||||
}
|
||||
}
|
||||
searchUserInfo?.apply {
|
||||
dialogManager.showProgressDialog(context)
|
||||
PayModel.get().giveGold(uid, mEditGold.text.toString(), DESAndBase64(password))
|
||||
@@ -266,13 +382,7 @@ class GiveGoldToUserActivity : BaseActivity(), GridPasswordView.OnPasswordChange
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (s.isNullOrBlank()) {
|
||||
mEditGold.textSize = 15f
|
||||
tvSure.isEnabled = false
|
||||
} else {
|
||||
mEditGold.textSize = 35f
|
||||
tvSure.isEnabled = true
|
||||
}
|
||||
binding.tvSure.isEnabled = !s.isNullOrBlank()
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package com.yizhuan.erban.pay.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.widget.TextView
|
||||
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.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils
|
||||
|
||||
|
||||
class GiveDiamondDetailAdapter :
|
||||
BaseQuickAdapter<DiamondGiveHistoryInfo, BaseViewHolder>(R.layout.item_give_diamond_detail) {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun convert(helper: BaseViewHolder, item: DiamondGiveHistoryInfo) {
|
||||
helper.getView<TextView>(R.id.tv_number).text = item.diamondNum.toString()
|
||||
helper.getView<TextView>(R.id.tv_pay_diamond).text =
|
||||
mContext.getString(R.string.all_pay_diamond, item.realDiamondNum.toString())
|
||||
helper.setText(R.id.tv_date, TimeUtils.getDateTimeString(item.createTime,"yyyy-MM-dd HH:mm:ss"))
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.yizhuan.erban.pay.adapter;
|
||||
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
|
||||
/**
|
||||
* 赠送礼物
|
||||
*/
|
||||
public class GiveGiftAdapter extends BaseQuickAdapter<GiftInfo, BaseViewHolder> {
|
||||
|
||||
|
||||
public GiveGiftAdapter() {
|
||||
super(R.layout.item_give_gift);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftInfo item) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
helper.setText(R.id.tvName, item.getGiftName())
|
||||
.setText(R.id.tvNum, "x" + item.getCount());
|
||||
ImageView giftPic = helper.itemView.findViewById(R.id.ivGift);
|
||||
ImageLoadUtils.loadImage(mContext, item.getGiftUrl(), giftPic);
|
||||
helper.getView(R.id.viewBg).setSelected(item.isSelected);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.yizhuan.erban.pay.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.erban.utils.TimeUiUtils
|
||||
import com.yizhuan.xchat_android_core.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils
|
||||
|
||||
|
||||
class GiveGiftDetailAdapter :
|
||||
BaseQuickAdapter<DiamondGiveHistoryInfo, BaseViewHolder>(R.layout.item_give_gift_detail) {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun convert(helper: BaseViewHolder, item: DiamondGiveHistoryInfo) {
|
||||
helper.getView<TextView>(R.id.tv_gift_name).text = "${item.giftName}x${item.giftNum}"
|
||||
ImageLoadUtils.loadAvatar(mContext, item.giftUrl, helper.getView(R.id.iv_avatar))
|
||||
helper.setText(R.id.tv_date, TimeUtils.getDateTimeString(item.createTime,"yyyy-MM-dd HH:mm:ss"))
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
package com.yizhuan.erban.pay.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentGiveDiamondBinding
|
||||
import com.yizhuan.erban.pay.GiveGoldModel
|
||||
import com.yizhuan.erban.pay.activity.GiveGoldDetailActivity
|
||||
import com.yizhuan.erban.pay.adapter.GiveDiamondDetailAdapter
|
||||
import com.yizhuan.erban.pay.adapter.LatelyGiveAdapter
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
class GiveDiamondFragment : BaseViewBindingFragment<FragmentGiveDiamondBinding>() {
|
||||
|
||||
private var pageNum: Int = 1
|
||||
private val pageSize = 20
|
||||
private lateinit var mAdapter: GiveDiamondDetailAdapter
|
||||
private lateinit var rvDelegate: RVDelegate<DiamondGiveHistoryInfo>
|
||||
|
||||
private val giveGoldModel: GiveGoldModel by viewModels()
|
||||
|
||||
private var uid: Long = 0L
|
||||
|
||||
companion object {
|
||||
fun newInstance(uid: Long): GiveDiamondFragment {
|
||||
val args = Bundle()
|
||||
args.putLong("uid", uid)
|
||||
val fragment = GiveDiamondFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
uid = arguments?.getLong("uid") ?: 0L
|
||||
mAdapter = GiveDiamondDetailAdapter()
|
||||
rvDelegate = RVDelegate.Builder<DiamondGiveHistoryInfo>()
|
||||
.setAdapter(mAdapter)
|
||||
.setLayoutManager(LinearLayoutManager(context))
|
||||
.setPageSize(20)
|
||||
.setEmptyView(
|
||||
EmptyViewHelper.createEmptyView(
|
||||
context,
|
||||
ResUtil.getString(R.string.me_give_gold_empty)
|
||||
)
|
||||
)
|
||||
.setRefreshLayout(binding.refreshLayout)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.build()
|
||||
mAdapter.setOnLoadMoreListener({
|
||||
loadData(false)
|
||||
}, binding.recyclerView)
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
loadData(true)
|
||||
}
|
||||
giveGoldModel.giveDetailLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun loadData(isRefresh: Boolean) {
|
||||
binding.refreshLayout.isRefreshing = isRefresh
|
||||
pageNum = if (isRefresh) 1 else (pageNum + 1)
|
||||
giveGoldModel.giveDetailInfo(uid, 0, pageNum, pageSize)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package com.yizhuan.erban.pay.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentGiveDiamondBinding
|
||||
import com.yizhuan.erban.databinding.FragmentGiveGiftBinding
|
||||
import com.yizhuan.erban.pay.GiveGoldModel
|
||||
import com.yizhuan.erban.pay.activity.GiveGoldDetailActivity
|
||||
import com.yizhuan.erban.pay.adapter.GiveGiftDetailAdapter
|
||||
import com.yizhuan.erban.pay.adapter.LatelyGiveAdapter
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.user.bean.DiamondGiveHistoryInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
class GiveGiftFragment : BaseViewBindingFragment<FragmentGiveGiftBinding>() {
|
||||
|
||||
private var pageNum: Int = 1
|
||||
private val pageSize = 20
|
||||
private lateinit var mAdapter: GiveGiftDetailAdapter
|
||||
private lateinit var rvDelegate: RVDelegate<DiamondGiveHistoryInfo>
|
||||
|
||||
private val giveGoldModel: GiveGoldModel by viewModels()
|
||||
|
||||
private var uid: Long = 0L
|
||||
|
||||
companion object {
|
||||
fun newInstance(uid: Long): GiveGiftFragment {
|
||||
val args = Bundle()
|
||||
args.putLong("uid", uid)
|
||||
val fragment = GiveGiftFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
uid = arguments?.getLong("uid") ?: 0L
|
||||
mAdapter = GiveGiftDetailAdapter()
|
||||
rvDelegate = RVDelegate.Builder<DiamondGiveHistoryInfo>()
|
||||
.setAdapter(mAdapter)
|
||||
.setLayoutManager(LinearLayoutManager(context))
|
||||
.setPageSize(20)
|
||||
.setEmptyView(
|
||||
EmptyViewHelper.createEmptyView(
|
||||
context,
|
||||
ResUtil.getString(R.string.me_give_gold_empty)
|
||||
)
|
||||
)
|
||||
.setRefreshLayout(binding.refreshLayout)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.build()
|
||||
mAdapter.setOnLoadMoreListener({
|
||||
loadData(false)
|
||||
}, binding.recyclerView)
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
loadData(true)
|
||||
}
|
||||
giveGoldModel.giveDetailLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun loadData(isRefresh: Boolean) {
|
||||
binding.refreshLayout.isRefreshing = isRefresh
|
||||
pageNum = if (isRefresh) 1 else (pageNum + 1)
|
||||
giveGoldModel.giveDetailInfo(uid, 1, pageNum, pageSize)
|
||||
}
|
||||
|
||||
}
|
@@ -16,8 +16,6 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingFragment;
|
||||
import com.yizhuan.erban.databinding.FragmentUserInfoGiftBinding;
|
||||
import com.yizhuan.erban.ui.user.adapter.UserGiftAdapter;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration;
|
||||
import com.yizhuan.xchat_android_core.bean.UserInfoItem;
|
||||
import com.yizhuan.xchat_android_core.user.UserInfoUiMgr;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.yizhuan.erban.ui.widget.viewpager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
public class NoScrollViewPager extends ViewPager {
|
||||
// false 禁止ViewPager左右滑动。
|
||||
// true 普通ViewPager
|
||||
private boolean isScroll = false;
|
||||
|
||||
public NoScrollViewPager(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
public NoScrollViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
public void setScrollable(boolean isScroll) {
|
||||
this.isScroll = isScroll;
|
||||
}
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (!isScroll){
|
||||
// 不允许拦截事件就返回false
|
||||
return isScroll;
|
||||
}else {
|
||||
// 正常ViewPager处理拦截事件就请求父类普通ViewPager中的onInterceptTouchEvent()
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if (!isScroll){
|
||||
// 不允许消费事件就返回false.
|
||||
return isScroll;
|
||||
}else {
|
||||
// 正常ViewPager消耗事件就请求父类普通ViewPager中的onTouchEvent.
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
app/src/main/res/color/color_donation_btn.xml
Normal file
9
app/src/main/res/color/color_donation_btn.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_selected="false"
|
||||
android:color="@color/color_6D6B89" />
|
||||
<item
|
||||
android:state_selected="true"
|
||||
android:color="@color/color_FFFFFF" />
|
||||
</selector>
|
BIN
app/src/main/res/drawable-xhdpi/donation_arrow_right.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/donation_arrow_right.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 962 B |
BIN
app/src/main/res/drawable-xhdpi/ic_give_diamond_detail.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_give_diamond_detail.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
9
app/src/main/res/drawable/bg_common_disable_select.xml
Normal file
9
app/src/main/res/drawable/bg_common_disable_select.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/color_E6E6F0" />
|
||||
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
|
||||
</shape>
|
5
app/src/main/res/drawable/bg_common_select.xml
Normal file
5
app/src/main/res/drawable/bg_common_select.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_common_select_normal" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_common_disable_select" android:state_selected="false" />
|
||||
</selector>
|
13
app/src/main/res/drawable/bg_common_select_normal.xml
Normal file
13
app/src/main/res/drawable/bg_common_select_normal.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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="#19EBFF"
|
||||
android:startColor="#ED66FF"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
|
||||
</shape>
|
6
app/src/main/res/drawable/bg_f3f5fa_r4.xml
Normal file
6
app/src/main/res/drawable/bg_f3f5fa_r4.xml
Normal 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="@dimen/dp_4" />
|
||||
<solid android:color="#F3F5FA" />
|
||||
</shape>
|
5
app/src/main/res/drawable/bg_give_gift_bg_selector.xml
Normal file
5
app/src/main/res/drawable/bg_give_gift_bg_selector.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_gradient_cc66ff_9cb3ff_13e2f5_r8" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bg_ffffff_8" android:state_selected="false" />
|
||||
</selector>
|
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
|
||||
<corners android:radius="@dimen/dp_8" />
|
||||
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#CC66FF"
|
||||
android:centerColor="#9CB3FF"
|
||||
android:startColor="#13E2F5"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
|
||||
<corners android:radius="@dimen/dp_8" />
|
||||
|
||||
<solid android:color="@color/color_FFFFFF"/>
|
||||
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
@@ -18,9 +18,9 @@
|
||||
android:id="@+id/ivAvatar"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:src="@drawable/default_avatar"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar" />
|
||||
|
||||
@@ -28,76 +28,104 @@
|
||||
android:id="@+id/tvNickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
tools:text="@string/layout_activity_give_gold_to_user_01"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivAvatar"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivAvatar"/>
|
||||
app:layout_constraintTop_toTopOf="@+id/ivAvatar"
|
||||
tools:text="@string/layout_activity_give_gold_to_user_01" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvId"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="3dp"
|
||||
tools:text="ID:123456"
|
||||
android:textColor="#ff999999"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivAvatar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvNickname"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivAvatar"/>
|
||||
tools:text="ID:123456" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
<LinearLayout
|
||||
android:id="@+id/llTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAvatar"
|
||||
android:text="@string/me_clean_diamond"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="13sp" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDiamondTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_common_select"
|
||||
android:paddingStart="@dimen/dp_12"
|
||||
android:paddingTop="@dimen/dp_7"
|
||||
android:paddingEnd="@dimen/dp_12"
|
||||
android:paddingBottom="@dimen/dp_7"
|
||||
android:layout_marginEnd="@dimen/dp_18"
|
||||
android:text="@string/me_clean_diamond"
|
||||
android:textColor="@color/color_donation_btn"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGiftTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_common_select"
|
||||
android:paddingStart="@dimen/dp_12"
|
||||
android:paddingTop="@dimen/dp_7"
|
||||
android:paddingEnd="@dimen/dp_12"
|
||||
android:paddingBottom="@dimen/dp_7"
|
||||
android:text="@string/me_give_gift"
|
||||
android:textColor="@color/color_donation_btn"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mIvDiamond"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/icon_diamond"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/llTab" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mEditGold"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:layout_marginBottom="-6dp"
|
||||
android:background="@null"
|
||||
android:gravity="end|bottom"
|
||||
android:hint="0"
|
||||
android:inputType="number"
|
||||
android:digits="1234567890"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textColorHint="@color/color_B3B3C3"
|
||||
android:textSize="30sp"
|
||||
android:gravity="end|bottom"
|
||||
android:layout_marginBottom="-6dp"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/mIvDiamond"
|
||||
app:layout_constraintStart_toEndOf="@+id/mIvDiamond"/>
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/mIvDiamond" />
|
||||
|
||||
<View
|
||||
android:id="@+id/mViewLine"
|
||||
android:background="@color/color_F7F7F7"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:background="@color/color_F7F7F7"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mEditGold"/>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mEditGold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mLiDiamond"
|
||||
@@ -105,8 +133,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mViewLine">
|
||||
|
||||
@@ -119,25 +147,123 @@
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/icon_diamond"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_diamond" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/groupDiamond"
|
||||
android:visibility="visible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="mIvDiamond,mEditGold,mViewLine,mLiDiamond" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llGiftList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="290dp"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/bg_f3f5fa_r8"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mLiDiamond">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPagerEntrance"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.yizhuan.erban.home.widget.MePageIndicatorView
|
||||
android:id="@+id/magic_indicator_entrance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/shape_me_indicator_bg" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editGift"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@null"
|
||||
android:gravity="end|bottom"
|
||||
android:hint="0"
|
||||
android:inputType="number"
|
||||
android:digits="1234567890"
|
||||
android:text="1"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textColorHint="@color/color_B3B3C3"
|
||||
android:textSize="@dimen/sp_20"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llGiftList" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/me_num"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/editGift"
|
||||
app:layout_constraintEnd_toStartOf="@+id/editGift" />
|
||||
|
||||
<View
|
||||
android:id="@+id/viewGiftLine"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@color/color_F7F7F7"
|
||||
app:layout_constraintEnd_toEndOf="@+id/editGift"
|
||||
app:layout_constraintStart_toStartOf="@+id/tvNum"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvNum" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/bg_f3f5fa_r4"
|
||||
android:paddingStart="@dimen/dp_6"
|
||||
android:paddingTop="@dimen/dp_2"
|
||||
android:paddingEnd="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_2"
|
||||
android:text="@string/me_all"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewGiftLine" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/groupGift"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="llGiftList,editGift,tvNum,viewGiftLine,tvAll" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSure"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="46dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/selector_common_button"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="@string/sure"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mLiDiamond"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAll" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
22
app/src/main/res/layout/fragment_give_diamond.xml
Normal file
22
app/src/main/res/layout/fragment_give_diamond.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout >
|
||||
|
||||
</LinearLayout>
|
||||
|
22
app/src/main/res/layout/fragment_give_gift.xml
Normal file
22
app/src/main/res/layout/fragment_give_gift.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout >
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -651,7 +651,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:text="@string/me_clean_diamond"
|
||||
android:text="@string/me_donation"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
|
57
app/src/main/res/layout/item_give_diamond_detail.xml
Normal file
57
app/src/main/res/layout/item_give_diamond_detail.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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_marginTop="@dimen/dp_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:src="@drawable/ic_give_diamond_detail"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_pay_diamond"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="1000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pay_diamond"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/color_b3b3b3"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_number"
|
||||
tools:text="@string/all_pay_diamond" />
|
||||
|
||||
<TextView
|
||||
android:id="@id/tv_date"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:text="2022-10.25 19:43:00"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
55
app/src/main/res/layout/item_give_gift.xml
Normal file
55
app/src/main/res/layout/item_give_gift.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/viewBg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_72"
|
||||
android:background="@drawable/bg_give_gift_bg_selector"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivGift"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
android:layout_marginEnd="@dimen/dp_6"
|
||||
android:layout_marginBottom="@dimen/dp_9"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/viewBg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBg"
|
||||
app:layout_constraintStart_toStartOf="@+id/viewBg"
|
||||
app:layout_constraintTop_toTopOf="@+id/viewBg" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:textColor="@color/color_6D6B89"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBg"
|
||||
app:layout_constraintStart_toStartOf="@+id/viewBg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBg"
|
||||
tools:text="礼物名称" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:textColor="@color/color_6D6B89"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvName"
|
||||
tools:text="x1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
44
app/src/main/res/layout/item_give_gift_detail.xml
Normal file
44
app/src/main/res/layout/item_give_gift_detail.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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_marginTop="@dimen/dp_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="15dp"
|
||||
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_gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="禮物名稱 x1" />
|
||||
|
||||
<TextView
|
||||
android:id="@id/tv_date"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:text="2022-10.25 19:43:00"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -42,4 +42,13 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
|
||||
tools:text="ID:123456" />
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/donation_arrow_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -626,5 +626,6 @@
|
||||
<color name="color_4cFFFFFF">#4cFFFFFF</color>
|
||||
<color name="color_67D7D7">#67D7D7</color>
|
||||
<color name="color_92F9E8">#92F9E8</color>
|
||||
<color name="color_E6E6F0">#E6E6F0</color>
|
||||
|
||||
</resources>
|
||||
|
@@ -167,6 +167,7 @@
|
||||
|
||||
<string name="no_attention_text">你還沒有關註任何Peko好友哦! \n快去添加關註吧!</string>
|
||||
<string name="search_hint">搜索昵稱或ID</string>
|
||||
<string name="search_user_id">搜索用戶ID</string>
|
||||
<string name="online">在線中…</string>
|
||||
<string name="me_customer_server">客服</string>
|
||||
|
||||
@@ -967,7 +968,10 @@
|
||||
<string name="me_my_room">我的房間</string>
|
||||
<string name="me_gain_recording">收益記錄</string>
|
||||
<string name="me_clean_diamond">轉贈鉆石</string>
|
||||
<string name="me_give_gift">轉贈禮物</string>
|
||||
<string name="me_donation">我的轉贈</string>
|
||||
<string name="donation_to">轉贈至</string>
|
||||
<string name="me_donation_detail">轉贈明細</string>
|
||||
|
||||
<!--登錄-->
|
||||
<string name="login_contact_service">請聯系客服處理</string>
|
||||
@@ -4927,5 +4931,13 @@
|
||||
<string name="consume_diamond_num">%s鉆</string>
|
||||
<string name="give_gold_to_user">向%s轉贈</string>
|
||||
<string name="have_copy">已複製</string>
|
||||
<string name="donation_record">轉贈記錄</string>
|
||||
<string name="me_num">數量</string>
|
||||
<string name="me_all">全部</string>
|
||||
<string name="please_select_gift">請先選擇禮物</string>
|
||||
<string name="please_enter_gift_num">請輸入禮物數量</string>
|
||||
<string name="gift_num_fail">禮物數量有誤,請重新輸入</string>
|
||||
<string name="gift_give_success">轉贈成功</string>
|
||||
<string name="all_pay_diamond">總支出%s鉆</string>
|
||||
|
||||
</resources>
|
@@ -36,7 +36,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:imeOptions="actionSearch"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/search_hint"
|
||||
android:hint="@string/search_user_id"
|
||||
android:paddingStart="@dimen/dp_15"
|
||||
android:paddingEnd="@dimen/dp_15"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
@@ -67,7 +67,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
android:text="@string/layout_activity_give_gold_01"
|
||||
android:text="@string/donation_record"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold"
|
||||
@@ -95,6 +95,8 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_tip"
|
||||
android:text="@string/displayed_three_month"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
|
@@ -0,0 +1,32 @@
|
||||
<?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"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/magicIndicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPagerDetail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/magicIndicator"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -113,6 +113,21 @@ object HomeModel : BaseModel() {
|
||||
api.getSearchUser(erbanNo)
|
||||
}
|
||||
|
||||
suspend fun giveGift(toUid: Long, giftId: Int, giftNum: Int): String? =
|
||||
launchRequest {
|
||||
api.giveGift(toUid, giftId, giftNum)
|
||||
}
|
||||
|
||||
suspend fun getGiveDetail(
|
||||
uid: Long,
|
||||
type: Int,
|
||||
page: Int,
|
||||
pageSize: Int
|
||||
): List<DiamondGiveHistoryInfo>? =
|
||||
launchRequest {
|
||||
api.getGiveDetail(uid, type, page, pageSize)
|
||||
}
|
||||
|
||||
suspend fun getHotRoom(): List<HomeRoomInfo>? =
|
||||
launchRequest {
|
||||
api.getHotRoom()
|
||||
@@ -427,6 +442,31 @@ object HomeModel : BaseModel() {
|
||||
@Query("erbanNo") erbanNo: Long?
|
||||
): ServiceResult<SearchUserInfo>
|
||||
|
||||
/**
|
||||
* 贈送禮物
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST("/user/diamond/giveGift")
|
||||
suspend fun giveGift(
|
||||
@Query("toUid") toUid: Long?,
|
||||
@Query("giftId") giftId: Int?,
|
||||
@Query("giftNum") giftNum: Int?
|
||||
): ServiceResult<String>
|
||||
|
||||
/**
|
||||
* 轉贈詳情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/user/diamond/giveRecordVoByType")
|
||||
suspend fun getGiveDetail(
|
||||
@Query("toUid") toUid: Long?,
|
||||
@Query("type") type: Int?,
|
||||
@Query("pageNum") pageNum: Int?,
|
||||
@Query("pageSize") pageSize: Int?
|
||||
): ServiceResult<List<DiamondGiveHistoryInfo>>
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -46,6 +46,8 @@ public class GiftInfo implements Serializable {
|
||||
@SerializedName("nobleName")
|
||||
private String nobleName;
|
||||
|
||||
public boolean isSelected;
|
||||
|
||||
/**
|
||||
* 是否全服通知
|
||||
*/
|
||||
|
@@ -27,6 +27,7 @@ public class InitInfo implements Serializable {
|
||||
private NobleResourceComponent nobleResource;
|
||||
|
||||
private List<MonsterInitInfo> monsters;
|
||||
/** 转赠钻石白名单 */
|
||||
private List<Long> giveDiamondErbanNoList;
|
||||
/** 每日转赠钻石总额限制 */
|
||||
private Long giveDiamondDailyNum;
|
||||
@@ -34,6 +35,12 @@ public class InitInfo implements Serializable {
|
||||
private Long giveDiamondOnceLimitNum;
|
||||
/** 转赠手续费率 */
|
||||
private Double giveDiamondRate;
|
||||
/** 转赠钻石财富等级 */
|
||||
private Integer giveDiamondExperLevel;
|
||||
/** 转赠礼物白名单 */
|
||||
private List<Long> giveGiftErbanNoList;
|
||||
/** 转赠礼物财富等级 */
|
||||
private Integer giveGiftExperLevel;
|
||||
private double exchangeGoldRate;// 钻石兑换钻石比率
|
||||
private double exchangeRate;// 钻石兑换钻石比率
|
||||
|
||||
|
@@ -16,7 +16,15 @@ public class DiamondGiveHistoryInfo implements Serializable {
|
||||
|
||||
private Long diamondNum;//转赠给对方的数量
|
||||
private Double realDiamondNum;//转赠实际支出的数量,包含手续费
|
||||
private String createTime;//创建时间
|
||||
private String updateTime;//更新时间
|
||||
private Long createTime;//创建时间
|
||||
private Long updateTime;//更新时间
|
||||
|
||||
private int type;//转赠类型: 0转赠钻石 1转赠礼物
|
||||
private Integer giftId;//转赠礼物id
|
||||
private Integer giftNum;//转赠礼物数
|
||||
private String giftUrl;//轉贈禮物url
|
||||
private String giftName;//轉贈禮物名字
|
||||
private Long giftGoldNum;//转赠礼物单价
|
||||
private Long totalGiftGoldNum;//转赠礼物总价值
|
||||
|
||||
}
|
||||
|
@@ -70,6 +70,7 @@
|
||||
<color name="robot_link_element_text_blue">#248DFA</color>
|
||||
<color name="color_FAFAFA">#FAFAFA</color>
|
||||
<color name="color_B3B3B3">#B3B3B3</color>
|
||||
<color name="color_B3B3C3">#B3B3C3</color>
|
||||
<color name="color_7154EE">#FFBC52</color>
|
||||
<color name="color_BAB0FF">#BAB0FF</color>
|
||||
<color name="color_2a2a39">#2A2A39</color>
|
||||
|
Reference in New Issue
Block a user