夺宝精灵:兑换商店
@@ -61,6 +61,26 @@ class FairyViewModel : BaseViewModel() {
|
|||||||
private val _testRecordLiveData = MutableLiveData<ListResult<TestFairyRecordInfo>>()
|
private val _testRecordLiveData = MutableLiveData<ListResult<TestFairyRecordInfo>>()
|
||||||
val testRecordLiveData: LiveData<ListResult<TestFairyRecordInfo>> = _testRecordLiveData
|
val testRecordLiveData: LiveData<ListResult<TestFairyRecordInfo>> = _testRecordLiveData
|
||||||
|
|
||||||
|
private val _exchangeGiftListLiveData = MutableLiveData<List<ExchangeGiftInfo>>()
|
||||||
|
val exchangeGiftListLiveData: LiveData<List<ExchangeGiftInfo>> = _exchangeGiftListLiveData
|
||||||
|
|
||||||
|
private val _exchangeGiftLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
|
||||||
|
val exchangeGiftLiveData: LiveData<Event<ExchangeGiftInfo>> = _exchangeGiftLiveData
|
||||||
|
|
||||||
|
private val _debrisExchangeListLiveData = MutableLiveData<List<ExchangeGiftInfo>>()
|
||||||
|
val debrisExchangeListLiveData: LiveData<List<ExchangeGiftInfo>> = _debrisExchangeListLiveData
|
||||||
|
|
||||||
|
private val _debrisExchangeLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
|
||||||
|
val debrisExchangeLiveData: LiveData<Event<ExchangeGiftInfo>> = _debrisExchangeLiveData
|
||||||
|
|
||||||
|
private val _exchangeFairyRecordLiveData = MutableLiveData<ListResult<ExchangeGiftInfo>>()
|
||||||
|
val exchangeFairyRecordLiveData: LiveData<ListResult<ExchangeGiftInfo>> =
|
||||||
|
_exchangeFairyRecordLiveData
|
||||||
|
|
||||||
|
private val _exchangeDebrisRecordLiveData = MutableLiveData<ListResult<ExchangeGiftInfo>>()
|
||||||
|
val exchangeDebrisRecordLiveData: LiveData<ListResult<ExchangeGiftInfo>> =
|
||||||
|
_exchangeDebrisRecordLiveData
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initPrizeInfoList()
|
initPrizeInfoList()
|
||||||
}
|
}
|
||||||
@@ -227,13 +247,14 @@ class FairyViewModel : BaseViewModel() {
|
|||||||
|
|
||||||
fun cleanTestParam() {
|
fun cleanTestParam() {
|
||||||
_compoundFairyInfosLiveData.value = null
|
_compoundFairyInfosLiveData.value = null
|
||||||
_myFairyInfoLiveData.value?.lowElves?.forEach {
|
val myFairyInfo = _myFairyInfoLiveData.value
|
||||||
|
myFairyInfo?.lowElves?.forEach {
|
||||||
it.selectedNum = 0
|
it.selectedNum = 0
|
||||||
}
|
}
|
||||||
_myFairyInfoLiveData.value?.middleElves?.forEach {
|
myFairyInfo?.middleElves?.forEach {
|
||||||
it.selectedNum = 0
|
it.selectedNum = 0
|
||||||
}
|
}
|
||||||
_myFairyInfoLiveData.value = _myFairyInfoLiveData.value
|
_myFairyInfoLiveData.value = myFairyInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addTestFairy(fairyInfo: FairyInfo) {
|
fun addTestFairy(fairyInfo: FairyInfo) {
|
||||||
@@ -246,7 +267,6 @@ class FairyViewModel : BaseViewModel() {
|
|||||||
"你还未捕捉到该精灵".toast()
|
"你还未捕捉到该精灵".toast()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
array.put(nextIndex(array), fairyInfo)
|
|
||||||
var selectedNum = 0
|
var selectedNum = 0
|
||||||
array.forEach { _, value ->
|
array.forEach { _, value ->
|
||||||
if (value.elfId == fairyInfo.elfId) {
|
if (value.elfId == fairyInfo.elfId) {
|
||||||
@@ -254,11 +274,13 @@ class FairyViewModel : BaseViewModel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedNum > fairyInfo.elfNum) {
|
if (selectedNum + 1 > fairyInfo.elfNum) {
|
||||||
"精灵数量不足".toast()
|
"精灵数量不足".toast()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fairyInfo.selectedNum = selectedNum
|
array.put(nextIndex(array), fairyInfo)
|
||||||
|
|
||||||
|
fairyInfo.selectedNum = selectedNum + 1
|
||||||
|
|
||||||
_compoundFairyInfosLiveData.value = array
|
_compoundFairyInfosLiveData.value = array
|
||||||
}
|
}
|
||||||
@@ -345,5 +367,75 @@ class FairyViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getExchangeGiftInfoList() {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
_exchangeGiftListLiveData.value = null
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = TreasureFairyModel.getExchangeGiftInfoList()
|
||||||
|
_exchangeGiftListLiveData.value = result
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getDebrisExchangeList() {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
_debrisExchangeListLiveData.value = null
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = TreasureFairyModel.getDebrisExchangeList()
|
||||||
|
_debrisExchangeListLiveData.value = result
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun exchangeGift(itemId: Long) {
|
||||||
|
safeLaunch {
|
||||||
|
val result = TreasureFairyModel.exchangeGift(itemId)
|
||||||
|
_exchangeGiftLiveData.value = result?.let { Event(it) }
|
||||||
|
_myFairyInfoLiveData.value = TreasureFairyModel.getMyFairyInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun debrisExchange(itemId: Long) {
|
||||||
|
safeLaunch {
|
||||||
|
val result = TreasureFairyModel.exchangeGift(itemId)
|
||||||
|
_debrisExchangeLiveData.value = result?.let { Event(it) }
|
||||||
|
_myFairyInfoLiveData.value = TreasureFairyModel.getMyFairyInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getExchangeFairyRecord(
|
||||||
|
page: Int,
|
||||||
|
pageSize: Int
|
||||||
|
) {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
_exchangeFairyRecordLiveData.value = ListResult.failed(page)
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = TreasureFairyModel.getExchangeRecord(1, page, pageSize)
|
||||||
|
_exchangeFairyRecordLiveData.value = ListResult.success(result, page)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getExchangeDebrisRecord(
|
||||||
|
page: Int,
|
||||||
|
pageSize: Int
|
||||||
|
) {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
_exchangeDebrisRecordLiveData.value = ListResult.failed(page)
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = TreasureFairyModel.getExchangeRecord(2, page, pageSize)
|
||||||
|
_exchangeDebrisRecordLiveData.value = ListResult.success(result, page)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
|
class ExchangeDebrisAdapter :
|
||||||
|
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_exchange_debris) {
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_prize_icon).load(item.rewardPicUrl)
|
||||||
|
helper.setText(R.id.tv_prize_name, item.getPrizeName())
|
||||||
|
helper.setText(R.id.tv_need_num, "${item.expendNum}")
|
||||||
|
helper.addOnClickListener(R.id.tv_exchange)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,25 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.PrizeInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ExchangeDebrisRecordAdapter :
|
||||||
|
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_exchange_debris_record) {
|
||||||
|
|
||||||
|
private val formatYear = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA)
|
||||||
|
private val formatHour = SimpleDateFormat("HH:mm:ss", Locale.CHINA)
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_time_year, formatYear.format(item.createTime))
|
||||||
|
helper.setText(R.id.tv_time_hour, formatHour.format(item.createTime))
|
||||||
|
helper.setText(R.id.tv_prize_name, item.rewardName)
|
||||||
|
helper.setText(R.id.tv_prize_num, item.getPrizeUnit())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.PrizeInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ExchangeFairyRecordAdapter :
|
||||||
|
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_exchange_fairy_record) {
|
||||||
|
|
||||||
|
private val formatYear = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA)
|
||||||
|
private val formatHour = SimpleDateFormat("HH:mm:ss", Locale.CHINA)
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_time_year, formatYear.format(item.createTime))
|
||||||
|
helper.setText(R.id.tv_time_hour, formatHour.format(item.createTime))
|
||||||
|
helper.setText(R.id.tv_prize_name, "${item.rewardName}x${item.rewardNum}")
|
||||||
|
helper.setText(
|
||||||
|
R.id.tv_prize_type, when (item.convertLevel) {
|
||||||
|
1 -> "初级召唤"
|
||||||
|
2 -> "史诗召唤"
|
||||||
|
else -> "传说召唤"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.FairyInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
|
class ExchangeFairyResultAdapter :
|
||||||
|
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prize_single) {
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_prize_icon).load(item.rewardPicUrl)
|
||||||
|
helper.setText(R.id.tv_prize_name, item.rewardName)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -21,7 +21,7 @@ class MyFairyRecordAdapter :
|
|||||||
val isSend = item.type == 2
|
val isSend = item.type == 2
|
||||||
helper.setText(
|
helper.setText(
|
||||||
R.id.tv_content,
|
R.id.tv_content,
|
||||||
"${if (isSend) "你" else ""}赠送${if (isSend) "" else "了你"}一张“${item.elfName}”精灵卡"
|
"${if (isSend) "你" else item.targetNick}赠送${if (isSend) "" else "了你"}一张“${item.elfName}”精灵卡"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,68 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.viewpager.widget.ViewPager
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.avroom.adapter.RoomVPAdapter
|
||||||
|
import com.mango.moshen.base.BaseDialog
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyDialogExchangeBinding
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyDialogTestFairyBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.fragment.*
|
||||||
|
import com.mango.moshen.treasurefairy.view.MyFairyItemView
|
||||||
|
|
||||||
|
class ExchangeFairyDialog : BaseDialog<TreasureFairyDialogExchangeBinding>() {
|
||||||
|
|
||||||
|
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
override var gravity = Gravity.BOTTOM
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeFairyDialog {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeFairyDialog()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
binding.ivBack.setOnClickListener {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
binding.tvRecord.setOnClickListener {
|
||||||
|
ExchangeRecordDialog.newInstance().show(context)
|
||||||
|
}
|
||||||
|
binding.rg.setOnCheckedChangeListener { _, checkedId ->
|
||||||
|
when (checkedId) {
|
||||||
|
R.id.rb_epic -> binding.viewPager.currentItem = 0
|
||||||
|
R.id.rb_legend -> binding.viewPager.currentItem = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
|
||||||
|
override fun onPageSelected(position: Int) {
|
||||||
|
when (position) {
|
||||||
|
0 -> binding.rg.check(R.id.rb_epic)
|
||||||
|
1 -> binding.rg.check(R.id.rb_legend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
binding.viewPager.adapter = RoomVPAdapter(
|
||||||
|
childFragmentManager,
|
||||||
|
listOf(
|
||||||
|
ExchangeFairyFragment.newInstance(),
|
||||||
|
ExchangeDebrisFragment.newInstance()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
viewModel.getMyFairyInfo()
|
||||||
|
viewModel.cleanTestParam()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,57 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.FairyInfo
|
||||||
|
import com.mango.moshen.base.BaseDialog
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyDialogTestFairyResultBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.ExchangeFairyResultAdapter
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.TestFairyResultAdapter
|
||||||
|
import com.mango.moshen.ui.utils.RVDelegate
|
||||||
|
|
||||||
|
class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultBinding>() {
|
||||||
|
|
||||||
|
private lateinit var rvDelegate: RVDelegate<ExchangeGiftInfo>
|
||||||
|
private lateinit var prizeAdapter: ExchangeFairyResultAdapter
|
||||||
|
|
||||||
|
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
override var gravity = Gravity.CENTER
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeFairyResultDialog {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeFairyResultDialog()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
binding.tvClose.setOnClickListener {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
val prizeInfoList = viewModel.exchangeGiftLiveData.value
|
||||||
|
|
||||||
|
prizeAdapter = ExchangeFairyResultAdapter()
|
||||||
|
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
|
||||||
|
.setAdapter(prizeAdapter)
|
||||||
|
.setRecyclerView(binding.recyclerView)
|
||||||
|
.setLayoutManager(
|
||||||
|
LinearLayoutManager(context)
|
||||||
|
)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
rvDelegate.setNewData(arrayListOf(prizeInfoList?.peekContent()))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,62 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.dialog
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.viewpager.widget.ViewPager
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.avroom.adapter.RoomVPAdapter
|
||||||
|
import com.mango.moshen.base.BaseDialog
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyDialogExchangeRecordBinding
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyDialogForestRecordBinding
|
||||||
|
import com.mango.moshen.treasurefairy.fragment.ExchangeDebrisRecordFragment
|
||||||
|
import com.mango.moshen.treasurefairy.fragment.ExchangeFairyRecordFragment
|
||||||
|
import com.mango.moshen.treasurefairy.fragment.ForestPrizesFragment
|
||||||
|
import com.mango.moshen.treasurefairy.fragment.ForestRecordFragment
|
||||||
|
|
||||||
|
class ExchangeRecordDialog : BaseDialog<TreasureFairyDialogExchangeRecordBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
override var gravity = Gravity.CENTER
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeRecordDialog {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeRecordDialog()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
binding.rootView.setOnClickListener {
|
||||||
|
dismissAllowingStateLoss()
|
||||||
|
}
|
||||||
|
binding.rg.setOnCheckedChangeListener { _, checkedId ->
|
||||||
|
when (checkedId) {
|
||||||
|
R.id.rb_prizes -> binding.viewPager.currentItem = 0
|
||||||
|
R.id.rb_record -> binding.viewPager.currentItem = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
|
||||||
|
override fun onPageSelected(position: Int) {
|
||||||
|
when (position) {
|
||||||
|
0 -> binding.rg.check(R.id.rb_prizes)
|
||||||
|
1 -> binding.rg.check(R.id.rb_record)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
binding.viewPager.adapter = RoomVPAdapter(
|
||||||
|
childFragmentManager,
|
||||||
|
listOf(
|
||||||
|
ExchangeFairyRecordFragment.newInstance(),
|
||||||
|
ExchangeDebrisRecordFragment.newInstance()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -45,10 +45,12 @@ class ForestFairyDialog : BaseDialog<TreasureFairyDialogForestBinding>() {
|
|||||||
binding.ivMyFairy.setOnClickListener {
|
binding.ivMyFairy.setOnClickListener {
|
||||||
MyFairyDialog.newInstance().show(context)
|
MyFairyDialog.newInstance().show(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.ivFairyTest.setOnClickListener {
|
binding.ivFairyTest.setOnClickListener {
|
||||||
TestFairyDialog.newInstance().show(context)
|
TestFairyDialog.newInstance().show(context)
|
||||||
}
|
}
|
||||||
|
binding.ivFairyStore.setOnClickListener {
|
||||||
|
ExchangeFairyDialog.newInstance().show(context)
|
||||||
|
}
|
||||||
|
|
||||||
binding.ivPrevious.setOnClickListener {
|
binding.ivPrevious.setOnClickListener {
|
||||||
currentType--
|
currentType--
|
||||||
|
@@ -0,0 +1,76 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.fragment
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.user.UserModel
|
||||||
|
import com.mango.core.utils.subAndReplaceDot
|
||||||
|
import com.mango.core.utils.toast
|
||||||
|
import com.mango.moshen.base.BaseViewBindingFragment
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentExchangeDebrisBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.ExchangeDebrisAdapter
|
||||||
|
import com.mango.moshen.ui.utils.RVDelegate
|
||||||
|
import com.mango.moshen.ui.utils.loadAvatar
|
||||||
|
|
||||||
|
class ExchangeDebrisFragment :
|
||||||
|
BaseViewBindingFragment<TreasureFairyFragmentExchangeDebrisBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeDebrisFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeDebrisFragment()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
private lateinit var rvDelegate: RVDelegate<ExchangeGiftInfo>
|
||||||
|
private lateinit var debrisAdapter: ExchangeDebrisAdapter
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
debrisAdapter = ExchangeDebrisAdapter()
|
||||||
|
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
|
||||||
|
.setAdapter(debrisAdapter)
|
||||||
|
.setRecyclerView(binding.recyclerView)
|
||||||
|
.setLayoutManager(GridLayoutManager(context, 2, LinearLayoutManager.VERTICAL, false))
|
||||||
|
.build()
|
||||||
|
viewModel.getDebrisExchangeList()
|
||||||
|
viewModel.debrisExchangeListLiveData.observe(viewLifecycleOwner) {
|
||||||
|
rvDelegate.setNewData(it)
|
||||||
|
}
|
||||||
|
debrisAdapter.setOnItemChildClickListener { _, _, position ->
|
||||||
|
debrisAdapter.getItem(position)?.let {
|
||||||
|
dialogManager.showTipsDialog("您将要兑换“${it.getPrizeName()}”", "兑换") {
|
||||||
|
viewModel.debrisExchange(it.itemId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.getMyFairyInfo()
|
||||||
|
|
||||||
|
viewModel.myFairyInfoLiveData.observe(viewLifecycleOwner) {
|
||||||
|
it?.let {
|
||||||
|
binding.tvDebrisNum.text = it.chipNum.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UserModel.get().cacheLoginUserInfo?.let {
|
||||||
|
binding.ivAvatar.loadAvatar(it.avatar)
|
||||||
|
binding.tvNickname.text = it.nick.subAndReplaceDot(7)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.debrisExchangeLiveData.observe(viewLifecycleOwner) {
|
||||||
|
it?.getContentIfNotHandled()?.let {
|
||||||
|
"兑换成功~".toast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,56 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.fragment
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.moshen.base.BaseViewBindingFragment
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentExchangeRecordDebrisBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.ExchangeDebrisRecordAdapter
|
||||||
|
import com.mango.moshen.ui.utils.RVDelegate
|
||||||
|
|
||||||
|
class ExchangeDebrisRecordFragment : BaseViewBindingFragment<TreasureFairyFragmentExchangeRecordDebrisBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeDebrisRecordFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeDebrisRecordFragment()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var page = 1
|
||||||
|
private val pageSize = 20
|
||||||
|
private lateinit var rvDelegate: RVDelegate<ExchangeGiftInfo>
|
||||||
|
private lateinit var prizeAdapter: ExchangeDebrisRecordAdapter
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
prizeAdapter = ExchangeDebrisRecordAdapter()
|
||||||
|
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
|
||||||
|
.setAdapter(prizeAdapter)
|
||||||
|
.setPageSize(pageSize)
|
||||||
|
.setRecyclerView(binding.recyclerView)
|
||||||
|
.setLayoutManager(LinearLayoutManager(context))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
viewModel.exchangeDebrisRecordLiveData.observe(viewLifecycleOwner) {
|
||||||
|
rvDelegate.loadData(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
prizeAdapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
|
||||||
|
|
||||||
|
loadData(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData(isRefresh: Boolean) {
|
||||||
|
page = if (isRefresh) 1 else (page + 1)
|
||||||
|
viewModel.getExchangeDebrisRecord(page, pageSize)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,128 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.fragment
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.core.view.isInvisible
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.MyFairyInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.base.BaseViewBindingFragment
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentExchangeFairyBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.dialog.ExchangeFairyResultDialog
|
||||||
|
import com.mango.moshen.treasurefairy.view.MyFairyItemView
|
||||||
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
|
class ExchangeFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentExchangeFairyBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeFairyFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeFairyFragment()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
private var fairyType = MyFairyItemView.BASE
|
||||||
|
private val fairyItems by lazy {
|
||||||
|
arrayListOf(
|
||||||
|
binding.fairyItem0,
|
||||||
|
binding.fairyItem1,
|
||||||
|
binding.fairyItem2,
|
||||||
|
binding.fairyItem3,
|
||||||
|
binding.fairyItem4
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
binding.ivPrevious.setOnClickListener {
|
||||||
|
fairyType--
|
||||||
|
switchLevel()
|
||||||
|
}
|
||||||
|
binding.ivNext.setOnClickListener {
|
||||||
|
fairyType++
|
||||||
|
switchLevel()
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivCompound.isEnabled = false
|
||||||
|
|
||||||
|
viewModel.getMyFairyInfo()
|
||||||
|
|
||||||
|
viewModel.getExchangeGiftInfoList()
|
||||||
|
|
||||||
|
viewModel.myFairyInfoLiveData.observe(viewLifecycleOwner) {
|
||||||
|
it?.let { setupMyFairyInfo(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.exchangeGiftListLiveData.observe(viewLifecycleOwner) {
|
||||||
|
it?.let { setupExchangeGiftList(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.exchangeGiftLiveData.observe(viewLifecycleOwner) {
|
||||||
|
it?.getContentIfNotHandled()?.let {
|
||||||
|
ExchangeFairyResultDialog.newInstance().show(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun switchLevel() {
|
||||||
|
viewModel.myFairyInfoLiveData.value?.let {
|
||||||
|
setupMyFairyInfo(it)
|
||||||
|
}
|
||||||
|
viewModel.exchangeGiftListLiveData.value?.let {
|
||||||
|
setupExchangeGiftList(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private fun setupExchangeGiftList(exchangeGiftList: List<ExchangeGiftInfo>) {
|
||||||
|
val exchangeGift = exchangeGiftList.firstOrNull { it.level == fairyType } ?: return
|
||||||
|
binding.ivGift.load(exchangeGift.rewardPicUrl)
|
||||||
|
binding.tvGiftName.text = exchangeGift.rewardName
|
||||||
|
binding.tvGiftPrice.text = "${exchangeGift.rewardShowValue}钻"
|
||||||
|
binding.ivCompound.setOnClickListener {
|
||||||
|
viewModel.exchangeGift(exchangeGift.itemId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private fun setupMyFairyInfo(myFairyInfo: MyFairyInfo) {
|
||||||
|
val fairyInfos = when (fairyType) {
|
||||||
|
MyFairyItemView.BASE -> {
|
||||||
|
binding.ivPrevious.isInvisible = true
|
||||||
|
binding.ivTitle.setImageResource(R.drawable.treasure_fairy_ic_exchange_fairy_base)
|
||||||
|
myFairyInfo.lowElves
|
||||||
|
}
|
||||||
|
MyFairyItemView.EPIC -> {
|
||||||
|
binding.ivNext.isInvisible = false
|
||||||
|
binding.ivPrevious.isInvisible = false
|
||||||
|
binding.ivTitle.setImageResource(R.drawable.treasure_fairy_ic_exchange_fairy_epic)
|
||||||
|
myFairyInfo.middleElves
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
binding.ivNext.isInvisible = true
|
||||||
|
binding.ivTitle.setImageResource(R.drawable.treasure_fairy_ic_exchange_fairy_legend)
|
||||||
|
myFairyInfo.highElves
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var isEnabled = true
|
||||||
|
fairyInfos?.let {
|
||||||
|
fairyItems.forEachIndexed { index, itemView ->
|
||||||
|
itemView.setFairyInfo(it.getOrNull(index))
|
||||||
|
if (it.getOrNull(index)?.elfNum ?: 0 < 1) {
|
||||||
|
isEnabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.ivCompound.isEnabled = isEnabled
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,60 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.fragment
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||||
|
import com.mango.core.treasurefairy.PrizeInfo
|
||||||
|
import com.mango.moshen.base.BaseViewBindingFragment
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentExchangeFairyBinding
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentExchangeRecordFairyBinding
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyFragmentForestRecordBinding
|
||||||
|
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.ExchangeFairyRecordAdapter
|
||||||
|
import com.mango.moshen.treasurefairy.adapter.ForestPrizesRecordAdapter
|
||||||
|
import com.mango.moshen.ui.utils.RVDelegate
|
||||||
|
|
||||||
|
class ExchangeFairyRecordFragment : BaseViewBindingFragment<TreasureFairyFragmentExchangeRecordFairyBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(): ExchangeFairyRecordFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
val fragment = ExchangeFairyRecordFragment()
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var page = 1
|
||||||
|
private val pageSize = 20
|
||||||
|
private lateinit var rvDelegate: RVDelegate<ExchangeGiftInfo>
|
||||||
|
private lateinit var prizeAdapter: ExchangeFairyRecordAdapter
|
||||||
|
private val viewModel: FairyViewModel by activityViewModels()
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun init() {
|
||||||
|
prizeAdapter = ExchangeFairyRecordAdapter()
|
||||||
|
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
|
||||||
|
.setAdapter(prizeAdapter)
|
||||||
|
.setPageSize(pageSize)
|
||||||
|
.setRecyclerView(binding.recyclerView)
|
||||||
|
.setLayoutManager(LinearLayoutManager(context))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
viewModel.exchangeFairyRecordLiveData.observe(viewLifecycleOwner) {
|
||||||
|
rvDelegate.loadData(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
prizeAdapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
|
||||||
|
|
||||||
|
loadData(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadData(isRefresh: Boolean) {
|
||||||
|
page = if (isRefresh) 1 else (page + 1)
|
||||||
|
viewModel.getExchangeFairyRecord(page, pageSize)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,35 @@
|
|||||||
|
package com.mango.moshen.treasurefairy.view
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.annotation.Nullable
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import com.mango.core.treasurefairy.FairyInfo
|
||||||
|
import com.mango.moshen.R
|
||||||
|
import com.mango.moshen.databinding.TreasureFairyItemExchangeBinding
|
||||||
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
|
class ExchangeItemView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
@Nullable attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
private val binding: TreasureFairyItemExchangeBinding
|
||||||
|
|
||||||
|
init {
|
||||||
|
inflate(context, R.layout.treasure_fairy_item_exchange, this)
|
||||||
|
binding = TreasureFairyItemExchangeBinding.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
fun setFairyInfo(fairyInfo: FairyInfo?) {
|
||||||
|
fairyInfo?.let {
|
||||||
|
binding.ivFairyIcon.load(it.elfPicUrl)
|
||||||
|
binding.tvFairyName.text = it.elfName
|
||||||
|
binding.tvFairyNum.text = "x${it.elfNum}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -10,9 +10,6 @@ import com.mango.moshen.R
|
|||||||
import com.mango.moshen.databinding.TreasureFairyItemHomeBinding
|
import com.mango.moshen.databinding.TreasureFairyItemHomeBinding
|
||||||
import com.mango.moshen.ui.utils.load
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
/**
|
|
||||||
* 技能卡
|
|
||||||
*/
|
|
||||||
class HomeItemView @JvmOverloads constructor(
|
class HomeItemView @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
@Nullable attrs: AttributeSet? = null,
|
@Nullable attrs: AttributeSet? = null,
|
||||||
|
@@ -14,9 +14,6 @@ import com.mango.moshen.R
|
|||||||
import com.mango.moshen.databinding.TreasureFairyItemMyFairyBaseBinding
|
import com.mango.moshen.databinding.TreasureFairyItemMyFairyBaseBinding
|
||||||
import com.mango.moshen.ui.utils.load
|
import com.mango.moshen.ui.utils.load
|
||||||
|
|
||||||
/**
|
|
||||||
* 技能卡
|
|
||||||
*/
|
|
||||||
class MyFairyItemView @JvmOverloads constructor(
|
class MyFairyItemView @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
@Nullable attrs: AttributeSet? = null,
|
@Nullable attrs: AttributeSet? = null,
|
||||||
|
After Width: | Height: | Size: 393 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 809 B |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_compound" android:state_enabled="true" />
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_compound_disable" />
|
||||||
|
|
||||||
|
</selector>
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_debris_select" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_debris_unselect" />
|
||||||
|
|
||||||
|
</selector>
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_fairy_select" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_ic_exchange_fairy_unselect" />
|
||||||
|
|
||||||
|
</selector>
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_bg_exchange_title_debris_checked" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_bg_exchange_title_debris_unchecked" />
|
||||||
|
|
||||||
|
</selector>
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_bg_exchange_title_fairy_checked" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/treasure_fairy_bg_exchange_title_fairy_unchecked" />
|
||||||
|
|
||||||
|
</selector>
|
9
app/src/main/res/drawable/shape_3aeac7_to_fffebb_4dp.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">
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:endColor="#3AEAC7"
|
||||||
|
android:startColor="#FFFEBB" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
</shape>
|
110
app/src/main/res/layout/treasure_fairy_dialog_exchange.xml
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?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:id="@+id/root_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/bg_elf"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="750:1100"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="42dp"
|
||||||
|
android:src="@drawable/treasure_fairy_ic_back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="54dp"
|
||||||
|
android:src="@drawable/treasure_fairy_bg_exchange_title"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/view_pager"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rg" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_rg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="22dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_my_fairy_rg"
|
||||||
|
app:layout_constraintDimensionRatio="690:82"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_title"
|
||||||
|
app:layout_constraintWidth_percent="0.92" />
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/rg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg_rg"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/view_bg_rg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/view_bg_rg"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg_rg">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_epic"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/selector_bg_fairy_exchange_fairy"
|
||||||
|
android:button="@null"
|
||||||
|
android:checked="true" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_legend"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/selector_bg_fairy_exchange_debris"
|
||||||
|
android:button="@null" />
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_record"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="65dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_test_fairy_record"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:lineSpacingExtra="-5dp"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:text="兑换记录"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@@ -0,0 +1,71 @@
|
|||||||
|
<?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:id="@+id/root_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_forest_record"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="631:772"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.75" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_line"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="3dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/rg"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/view_line">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_prizes"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="39dp"
|
||||||
|
android:background="@drawable/selector_bg_fairy_exchange_record_fairy"
|
||||||
|
android:button="@null"
|
||||||
|
android:checked="true" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_record"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="39dp"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:background="@drawable/selector_bg_fairy_exchange_record_debris"
|
||||||
|
android:button="@null" />
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/view_pager"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:layout_marginBottom="30dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rg" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@@ -19,7 +19,7 @@
|
|||||||
android:id="@+id/iv_title"
|
android:id="@+id/iv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="54dp"
|
||||||
android:src="@drawable/treasure_fairy_bg_my_fairy_friend_title"
|
android:src="@drawable/treasure_fairy_bg_my_fairy_friend_title"
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@@ -37,6 +37,15 @@
|
|||||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||||
app:layout_constraintWidth_percent="0.408" />
|
app:layout_constraintWidth_percent="0.408" />
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/view_pager"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/rg" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/view_bg_rg"
|
android:id="@+id/view_bg_rg"
|
||||||
@@ -82,16 +91,6 @@
|
|||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<androidx.viewpager.widget.ViewPager
|
|
||||||
android:id="@+id/view_pager"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/rg" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_record"
|
android:id="@+id/tv_record"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
|
@@ -0,0 +1,88 @@
|
|||||||
|
<?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:id="@+id/root_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="100dp"
|
||||||
|
android:paddingStart="7dp"
|
||||||
|
android:paddingEnd="7dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_bottom"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_forest_bottom"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="751:183"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<com.mango.moshen.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg_bottom" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_nickname"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="用户昵称~"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_avatar" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_avatar">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="我的碎片:"
|
||||||
|
android:textColor="#ff1f5764"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/treasure_fairy_ic_exchange_debris" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_debris_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="3dp"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@@ -0,0 +1,194 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.core.widget.NestedScrollView 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">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/root_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:layout_marginBottom="18dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_exchange_compound"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="698:972"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.93" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:src="@drawable/treasure_fairy_ic_exchange_fairy_base"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_gift"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_exchange_fairy_gift"
|
||||||
|
app:layout_constraintDimensionRatio="500:200"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_title"
|
||||||
|
app:layout_constraintWidth_percent="0.67" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_previous"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:src="@drawable/treasure_fairy_ic_forest_next"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintVertical_bias="0.56" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_next"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:rotation="180"
|
||||||
|
android:src="@drawable/treasure_fairy_ic_forest_next"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_previous" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_gift"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintDimensionRatio="72:92"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/iv_previous"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg_gift" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_gift_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="3dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/view_bg_gift_line"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/iv_gift"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
|
tools:text="可乐可可可乐" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_gift_line"
|
||||||
|
android:layout_width="83dp"
|
||||||
|
android:layout_height="3dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_exchange_gift_space"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/tv_gift_price"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_gift_name"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_gift_name"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_gift_name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_gift_price"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textColor="#ffe8aa"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg_gift"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_gift_name"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_gift_name"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/view_bg_gift_line"
|
||||||
|
tools:text="34650钻" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_compound"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:src="@drawable/selector_bg_fairy_exchange_compound"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||||
|
app:layout_constraintDimensionRatio="248:238"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||||
|
app:layout_constraintVertical_bias="0.73"
|
||||||
|
app:layout_constraintWidth_percent="0.33" />
|
||||||
|
|
||||||
|
<com.mango.moshen.treasurefairy.view.ExchangeItemView
|
||||||
|
android:id="@+id/fairy_item_0"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintCircle="@id/iv_compound"
|
||||||
|
app:layout_constraintCircleAngle="0"
|
||||||
|
app:layout_constraintCircleRadius="120dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintWidth_percent="0.21"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
<com.mango.moshen.treasurefairy.view.ExchangeItemView
|
||||||
|
android:id="@+id/fairy_item_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintCircle="@id/iv_compound"
|
||||||
|
app:layout_constraintCircleAngle="72"
|
||||||
|
app:layout_constraintCircleRadius="120dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintWidth_percent="0.21"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.mango.moshen.treasurefairy.view.ExchangeItemView
|
||||||
|
android:id="@+id/fairy_item_2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintCircle="@id/iv_compound"
|
||||||
|
app:layout_constraintCircleAngle="144"
|
||||||
|
app:layout_constraintCircleRadius="130dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintWidth_percent="0.21"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.mango.moshen.treasurefairy.view.ExchangeItemView
|
||||||
|
android:id="@+id/fairy_item_3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintCircle="@id/iv_compound"
|
||||||
|
app:layout_constraintCircleAngle="216"
|
||||||
|
app:layout_constraintCircleRadius="130dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintWidth_percent="0.21"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.mango.moshen.treasurefairy.view.ExchangeItemView
|
||||||
|
android:id="@+id/fairy_item_4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintCircle="@id/iv_compound"
|
||||||
|
app:layout_constraintCircleAngle="288"
|
||||||
|
app:layout_constraintCircleRadius="120dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintWidth_percent="0.21"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
@@ -0,0 +1,39 @@
|
|||||||
|
<?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:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="兑换时间"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="获得奖励"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -0,0 +1,47 @@
|
|||||||
|
<?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:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="召唤时间"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="类型"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="获得奖励"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
64
app/src/main/res/layout/treasure_fairy_item_exchange.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?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="match_parent"
|
||||||
|
tools:layout_height="79dp"
|
||||||
|
tools:layout_width="79dp">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_exchange_item"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_fairy_icon"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.48"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.36"
|
||||||
|
app:layout_constraintWidth_percent="0.76" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_fairy_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="1dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="精灵球"
|
||||||
|
android:textColor="#FFE8AA"
|
||||||
|
android:textSize="12dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_fairy_num"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="x5"
|
||||||
|
android:textColor="#1f5764"
|
||||||
|
android:textSize="10sp"
|
||||||
|
app:layout_constraintBaseline_toTopOf="@id/tv_fairy_name"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -0,0 +1,76 @@
|
|||||||
|
<?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:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/treasure_fairy_bg_exchange_debris_item"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="332:467"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_prize_icon"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.3"
|
||||||
|
app:layout_constraintWidth_percent="0.55" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_prize_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_prize_icon"
|
||||||
|
tools:text="我的可爱头饰(1天)" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_need_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:drawableStart="@drawable/treasure_fairy_ic_exchange_debris"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="3"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_prize_name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_exchange"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="@drawable/shape_3aeac7_to_fffebb_4dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="兑换"
|
||||||
|
android:textColor="@color/color_1f5764"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_need_num" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -0,0 +1,65 @@
|
|||||||
|
<?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="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:background="@color/black">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time_year"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="2023.03.02" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time_hour"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
tools:text="18:25:56" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_prize_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#FEF8A8"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="获得奖励" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_prize_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
tools:text="520钻" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -0,0 +1,59 @@
|
|||||||
|
<?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="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:background="@color/black">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time_year"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="2023.03.02" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time_hour"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
tools:text="18:25:56" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_prize_type"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
tools:text="类型" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_prize_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#FEF8A8"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="获得奖励" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -0,0 +1,34 @@
|
|||||||
|
package com.mango.core.treasurefairy
|
||||||
|
|
||||||
|
data class ExchangeGiftInfo(
|
||||||
|
val expendNum: Int = 0,
|
||||||
|
val itemId: Long = 0,
|
||||||
|
val level: Int = 0,
|
||||||
|
val rewardId: Int = 0,
|
||||||
|
val rewardName: String = "",
|
||||||
|
val rewardNum: Int = 0,
|
||||||
|
val rewardPicUrl: String = "",
|
||||||
|
val rewardShowValue: String = "",
|
||||||
|
val rewardUnit: String = "",
|
||||||
|
val rewardType: String = "",
|
||||||
|
val type: Int = 0,
|
||||||
|
val createTime: Long = 0,
|
||||||
|
val convertLevel: Int = 0
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun getPrizeName(): String {
|
||||||
|
return if (rewardType == "gift") {
|
||||||
|
"${rewardName}(${rewardShowValue}钻)"
|
||||||
|
} else {
|
||||||
|
"${rewardName}(${rewardNum}${rewardUnit})"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getPrizeUnit(): String {
|
||||||
|
return if (rewardType == "gift") {
|
||||||
|
"${rewardShowValue}钻)"
|
||||||
|
} else {
|
||||||
|
"${rewardNum}${rewardUnit}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -6,4 +6,5 @@ data class MyFairyInfo(
|
|||||||
val middleElves: ArrayList<FairyInfo>? = null,
|
val middleElves: ArrayList<FairyInfo>? = null,
|
||||||
val avatar: String = "",
|
val avatar: String = "",
|
||||||
val nick: String = "",
|
val nick: String = "",
|
||||||
|
val chipNum: Int
|
||||||
)
|
)
|
@@ -77,6 +77,27 @@ object TreasureFairyModel {
|
|||||||
api.getTestFairyRecordList(page, pageSize)
|
api.getTestFairyRecordList(page, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getExchangeGiftInfoList(): List<ExchangeGiftInfo>? = launchRequest {
|
||||||
|
api.getExchangeGiftInfoList()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun exchangeGift(itemId: Long): ExchangeGiftInfo? = launchRequest {
|
||||||
|
api.exchangeGift(itemId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getDebrisExchangeList(): List<ExchangeGiftInfo>? = launchRequest {
|
||||||
|
api.getDebrisExchangeList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun getExchangeRecord(
|
||||||
|
convertType: Int,
|
||||||
|
page: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): List<ExchangeGiftInfo>? = launchRequest {
|
||||||
|
api.getExchangeRecord(convertType,page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
|
|
||||||
@@ -204,6 +225,39 @@ object TreasureFairyModel {
|
|||||||
@Query("pageSize") pageSize: Int
|
@Query("pageSize") pageSize: Int
|
||||||
): ServiceResult<List<TestFairyRecordInfo>>
|
): ServiceResult<List<TestFairyRecordInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精灵兑换-礼物列表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET("act/seize-treasure/convert/elf/list")
|
||||||
|
suspend fun getExchangeGiftInfoList(): ServiceResult<List<ExchangeGiftInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精灵兑换-兑换
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("act/seize-treasure/convert")
|
||||||
|
suspend fun exchangeGift(@Field("itemId") itemId: Long): ServiceResult<ExchangeGiftInfo>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兑换-碎片兑换列表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET("act/seize-treasure/convert/chip/list")
|
||||||
|
suspend fun getDebrisExchangeList(): ServiceResult<List<ExchangeGiftInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 猛犸森林抽奖记录
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET("act/seize-treasure/convert/record")
|
||||||
|
suspend fun getExchangeRecord(
|
||||||
|
@Query("convertType") convertType: Int,
|
||||||
|
@Query("page") page: Int,
|
||||||
|
@Query("pageSize") pageSize: Int
|
||||||
|
): ServiceResult<List<ExchangeGiftInfo>>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|