夺宝精灵:精灵密藏
@@ -1290,7 +1290,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".treasurefairy.HomeDialog"
|
||||
android:name=".treasurefairy.HomeFairyActivity"
|
||||
android:theme="@style/dialog_web_view_activity" />
|
||||
|
||||
</application>
|
||||
|
@@ -15,7 +15,7 @@ import com.mango.moshen.R;
|
||||
import com.mango.moshen.databinding.DialogRoomPlayBinding;
|
||||
import com.mango.moshen.shipantics.PullRadishActivity;
|
||||
import com.mango.moshen.treasure_box.widget.GoldBoxHelper;
|
||||
import com.mango.moshen.treasurefairy.HomeDialog;
|
||||
import com.mango.moshen.treasurefairy.HomeFairyActivity;
|
||||
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ public class RoomPlayDialog extends BottomSheetDialog {
|
||||
private void init() {
|
||||
binding.llRadish.setVisibility(GoldBoxHelper.isShowRadish() ? View.VISIBLE : View.GONE);
|
||||
binding.llRadish.setOnClickListener(v -> PullRadishActivity.start(context));
|
||||
binding.llFairy.setOnClickListener(v -> HomeDialog.start(context));
|
||||
binding.llFairy.setOnClickListener(v -> HomeFairyActivity.start(context));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import com.mango.core.bean.response.ListResult
|
||||
import com.mango.core.home.bean.HomeRoomInfo
|
||||
import com.mango.core.home.model.HomeModel
|
||||
import com.mango.core.treasurefairy.DrawInfo
|
||||
import com.mango.core.treasurefairy.ForestInfo
|
||||
import com.mango.core.treasurefairy.PrizeInfo
|
||||
import com.mango.core.treasurefairy.TreasureFairyModel
|
||||
import com.mango.core.utils.net.ServerException
|
||||
@@ -27,6 +28,18 @@ class FairyViewModel : BaseViewModel() {
|
||||
private val _showGetKeyLiveData = MutableLiveData<Event<Boolean>>()
|
||||
val showGetKeyLiveData: LiveData<Event<Boolean>> = _showGetKeyLiveData
|
||||
|
||||
private val _drawForestLiveData = MutableLiveData<Event<List<PrizeInfo>>>()
|
||||
val drawForestLiveData: LiveData<Event<List<PrizeInfo>>> = _drawForestLiveData
|
||||
|
||||
private val _forestInfoLiveData = MutableLiveData<ForestInfo>()
|
||||
val forestInfoLiveData: LiveData<ForestInfo> = _forestInfoLiveData
|
||||
|
||||
private val _forestPoolLiveData = MutableLiveData<Pair<Int,List<PrizeInfo>?>>()
|
||||
val forestPoolLiveData: LiveData<Pair<Int,List<PrizeInfo>?>> = _forestPoolLiveData
|
||||
|
||||
private val _forestRecordLiveData = MutableLiveData<List<PrizeInfo>>()
|
||||
val forestRecordLiveData: LiveData<List<PrizeInfo>> = _forestRecordLiveData
|
||||
|
||||
init {
|
||||
initPrizeInfoList()
|
||||
}
|
||||
@@ -71,4 +84,51 @@ class FairyViewModel : BaseViewModel() {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun drawForestFairy(drawNum: Int, poolLevel: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
it.message.toast()
|
||||
_drawForestLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
val result = TreasureFairyModel.drawForestFairy(drawNum, poolLevel)
|
||||
_drawForestLiveData.value = result?.let { Event(it) }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getForestInfo() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_forestInfoLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_forestInfoLiveData.value = TreasureFairyModel.getForestInfo()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getForestPrizePool(poolLevel: Int) {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_forestPoolLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_forestPoolLiveData.value = Pair(poolLevel,TreasureFairyModel.getForestPrizePool(poolLevel))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getForestRecord() {
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_forestRecordLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_forestRecordLiveData.value = TreasureFairyModel.getForestRecord()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.base.BaseDialog
|
||||
import com.mango.moshen.databinding.TreasureFairyDialogForestBinding
|
||||
|
||||
class ForestFairyDialog : BaseDialog<TreasureFairyDialogForestBinding>() {
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var gravity = Gravity.BOTTOM
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
private var currentType = 1
|
||||
|
||||
companion object {
|
||||
fun newInstance(): ForestFairyDialog {
|
||||
val args = Bundle()
|
||||
val fragment = ForestFairyDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
|
||||
const val BASE = 1
|
||||
const val EPIC = 2
|
||||
const val LEGEND = 3
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
|
||||
binding.ivRecord.setOnClickListener {
|
||||
ForestRecordDialog.newInstance().show(context)
|
||||
}
|
||||
|
||||
binding.ivPrevious.setOnClickListener {
|
||||
currentType--
|
||||
switchType()
|
||||
}
|
||||
binding.ivNext.setOnClickListener {
|
||||
currentType++
|
||||
switchType()
|
||||
}
|
||||
binding.viewBgGrab1.setOnClickListener {
|
||||
viewModel.drawForestFairy(1, currentType)
|
||||
}
|
||||
|
||||
binding.viewBgGrab10.setOnClickListener {
|
||||
viewModel.drawForestFairy(10, currentType)
|
||||
}
|
||||
|
||||
viewModel.drawForestLiveData.observe(viewLifecycleOwner) {
|
||||
it?.getContentIfNotHandled()?.let {
|
||||
ForestPrizeDialog.newInstance().show(context)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun switchType() {
|
||||
when (currentType) {
|
||||
BASE -> {
|
||||
binding.ivPrevious.isVisible = false
|
||||
binding.tvGrabText1.text = "(初级球X1)"
|
||||
binding.tvGrabText10.text = "(初级球X10)"
|
||||
binding.tvTips.text = "使用初级球有一定几率抓到初级精灵"
|
||||
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_base)
|
||||
}
|
||||
EPIC -> {
|
||||
binding.ivNext.isVisible = true
|
||||
binding.ivNext.isVisible = true
|
||||
binding.tvGrabText1.text = "(超级球X1)"
|
||||
binding.tvGrabText10.text = "(超级球X10)"
|
||||
binding.tvTips.text = "使用超级球有一定几率抓到史诗精灵"
|
||||
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_epic)
|
||||
}
|
||||
LEGEND -> {
|
||||
binding.ivNext.isVisible = false
|
||||
binding.tvGrabText1.text = "(大师球X1)"
|
||||
binding.tvGrabText10.text = "(大师球X10)"
|
||||
binding.tvTips.text = "使用大师球必定抓到传说精灵"
|
||||
binding.viewBgForestBase.setBackgroundResource(R.drawable.treasure_fairy_bg_forest_legend)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
import android.widget.ImageView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.ui.utils.load
|
||||
import com.mango.core.treasurefairy.PrizeInfo
|
||||
|
||||
class ForestPrizeAdapter :
|
||||
BaseQuickAdapter<PrizeInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prize) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: PrizeInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_prize_icon).load(item.rewardPicUrl)
|
||||
helper.setText(R.id.tv_prize_name, "${item.rewardName}x${item.rewardNum}")
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
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.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mango.core.treasurefairy.PrizeInfo
|
||||
import com.mango.moshen.base.BaseDialog
|
||||
import com.mango.moshen.databinding.TreasureFairyDialogForestPrizeBinding
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
|
||||
class ForestPrizeDialog : BaseDialog<TreasureFairyDialogForestPrizeBinding>() {
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private lateinit var prizeAdapter: ForestPrizeAdapter
|
||||
|
||||
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(): ForestPrizeDialog {
|
||||
val args = Bundle()
|
||||
val fragment = ForestPrizeDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
binding.tvClose.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
prizeAdapter = ForestPrizeAdapter()
|
||||
rvDelegate = RVDelegate.Builder<PrizeInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setLayoutManager(GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false))
|
||||
.build()
|
||||
|
||||
viewModel.drawForestLiveData.observe(viewLifecycleOwner) { event ->
|
||||
rvDelegate.setNewData(event.peekContent())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
import android.widget.ImageView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.ui.utils.load
|
||||
import com.mango.core.treasurefairy.PrizeInfo
|
||||
|
||||
class ForestPrizesChildAdapter :
|
||||
BaseQuickAdapter<PrizeInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prizes_child) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: PrizeInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_prize_icon).load(item.rewardPicUrl)
|
||||
helper.setText(R.id.tv_prize_name, item.rewardName)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
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.PrizeInfo
|
||||
import com.mango.moshen.base.BaseViewBindingFragment
|
||||
import com.mango.moshen.databinding.TreasureFairyFragmentForestPrizesChildBinding
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
|
||||
class ForestPrizesChildFragment :
|
||||
BaseViewBindingFragment<TreasureFairyFragmentForestPrizesChildBinding>() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(type: Int): ForestPrizesChildFragment {
|
||||
val args = Bundle()
|
||||
args.putInt("poolLevel", type)
|
||||
val fragment = ForestPrizesChildFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private lateinit var prizeAdapter: ForestPrizesChildAdapter
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
prizeAdapter = ForestPrizesChildAdapter()
|
||||
rvDelegate = RVDelegate.Builder<PrizeInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setLayoutManager(GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false))
|
||||
.build()
|
||||
|
||||
val poolLevel = requireArguments().getInt("poolLevel")
|
||||
viewModel.getForestPrizePool(poolLevel)
|
||||
|
||||
viewModel.forestPoolLiveData.observe(viewLifecycleOwner) {
|
||||
it?.let {
|
||||
if (it.first == poolLevel) {
|
||||
rvDelegate.setNewData(it.second)
|
||||
}
|
||||
} ?: run {
|
||||
rvDelegate.setNewData(null)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.mango.moshen.base.BaseViewBindingFragment
|
||||
import com.mango.moshen.databinding.TreasureFairyFragmentForestPrizesBinding
|
||||
import com.mango.moshen.ui.user.UserInfoGiftFragment
|
||||
import com.mango.moshen.ui.user.adapter.UserInfoIndicatorAdapter
|
||||
import com.mango.moshen.ui.user.adapter.UserInfoPagerAdapter
|
||||
import com.mango.moshen.ui.widget.magicindicator.MagicIndicator
|
||||
import com.mango.moshen.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.mango.moshen.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
|
||||
class ForestPrizesFragment : BaseViewBindingFragment<TreasureFairyFragmentForestPrizesBinding>() {
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(): ForestPrizesFragment {
|
||||
val args = Bundle()
|
||||
val fragment = ForestPrizesFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
val viewPager: ViewPager = binding.viewPager
|
||||
val magicIndicator: MagicIndicator = binding.magicIndicator
|
||||
val fragmentList: MutableList<Fragment> = ArrayList()
|
||||
fragmentList.add(ForestPrizesChildFragment.newInstance(1))
|
||||
fragmentList.add(ForestPrizesChildFragment.newInstance(2))
|
||||
fragmentList.add(ForestPrizesChildFragment.newInstance(3))
|
||||
val pagerAdapter = UserInfoPagerAdapter(childFragmentManager, fragmentList)
|
||||
val tagList: MutableList<String> = ArrayList()
|
||||
tagList.add("初级森林")
|
||||
tagList.add("史诗森林")
|
||||
tagList.add("传说森林")
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.setTitleWrapContent(true)
|
||||
val magicIndicatorAdapter = UserInfoIndicatorAdapter(context, tagList)
|
||||
magicIndicatorAdapter.setOnItemSelectListener { position: Int, _: TextView ->
|
||||
viewPager.currentItem = position
|
||||
}
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
magicIndicator.navigator = commonNavigator
|
||||
commonNavigator.titleContainer.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE
|
||||
viewPager.offscreenPageLimit = 1
|
||||
viewPager.adapter = pagerAdapter
|
||||
ViewPagerHelper.bind(magicIndicator, viewPager)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.mango.core.treasurefairy.PrizeInfo
|
||||
import com.mango.moshen.R
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class ForestPrizesRecordAdapter :
|
||||
BaseQuickAdapter<PrizeInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prizes_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: PrizeInfo) {
|
||||
|
||||
helper.setText(R.id.tv_time_year, formatYear.format(item.drawTime))
|
||||
helper.setText(R.id.tv_time_hour, formatHour.format(item.drawTime))
|
||||
helper.setText(R.id.tv_prize_name, "${item.rewardName}x${item.rewardNum}")
|
||||
helper.setText(
|
||||
R.id.tv_prize_type, when (item.poolLevel) {
|
||||
1 -> "初级森林"
|
||||
2 -> "史诗森林"
|
||||
else -> "传说森林"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
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.TreasureFairyDialogForestRecordBinding
|
||||
|
||||
class ForestRecordDialog : BaseDialog<TreasureFairyDialogForestRecordBinding>() {
|
||||
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.CENTER
|
||||
|
||||
companion object {
|
||||
fun newInstance(): ForestRecordDialog {
|
||||
val args = Bundle()
|
||||
val fragment = ForestRecordDialog()
|
||||
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(
|
||||
ForestPrizesFragment.newInstance(),
|
||||
ForestRecordFragment.newInstance(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.mango.moshen.treasurefairy
|
||||
|
||||
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.PrizeInfo
|
||||
import com.mango.moshen.base.BaseViewBindingFragment
|
||||
import com.mango.moshen.databinding.TreasureFairyFragmentForestRecordBinding
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
|
||||
class ForestRecordFragment : BaseViewBindingFragment<TreasureFairyFragmentForestRecordBinding>() {
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(): ForestRecordFragment {
|
||||
val args = Bundle()
|
||||
val fragment = ForestRecordFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private lateinit var prizeAdapter: ForestPrizesRecordAdapter
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
|
||||
prizeAdapter = ForestPrizesRecordAdapter()
|
||||
rvDelegate = RVDelegate.Builder<PrizeInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setLayoutManager(LinearLayoutManager(context))
|
||||
.build()
|
||||
viewModel.getForestRecord()
|
||||
viewModel.forestRecordLiveData.observe(viewLifecycleOwner) {
|
||||
rvDelegate.setNewData(it)
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,6 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Path
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
@@ -26,7 +25,7 @@ import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
class HomeDialog : BaseViewBindingActivity<TreasureFairyDialogHomeBinding>() {
|
||||
class HomeFairyActivity : BaseViewBindingActivity<TreasureFairyDialogHomeBinding>() {
|
||||
private var selectIndex = 0
|
||||
private var targetIndex: Int = -1
|
||||
private val removeRunnable = Runnable { binding.llPrizeHint.removeAllViews() }
|
||||
@@ -39,7 +38,7 @@ class HomeDialog : BaseViewBindingActivity<TreasureFairyDialogHomeBinding>() {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
val starter = Intent(context, HomeDialog::class.java)
|
||||
val starter = Intent(context, HomeFairyActivity::class.java)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
@@ -52,25 +51,23 @@ class HomeDialog : BaseViewBindingActivity<TreasureFairyDialogHomeBinding>() {
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun init() {
|
||||
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
|
||||
window.setLayout(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context)
|
||||
ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(this)
|
||||
)
|
||||
window.setGravity(Gravity.BOTTOM)
|
||||
looperHintPrize()
|
||||
binding.tvKeyNum.setOnClickListener {
|
||||
FairyDialogWebViewActivity.start(context, UriProvider.getFairyKey())
|
||||
FairyDialogWebViewActivity.start(this, UriProvider.getFairyKey())
|
||||
}
|
||||
binding.ivMyFairy.setOnClickListener {
|
||||
MyFairyDialog.newInstance().show(context)
|
||||
MyFairyDialog.newInstance().show(this)
|
||||
}
|
||||
binding.ivFairyTreasure.setOnClickListener {
|
||||
ForestFairyDialog.newInstance().show(this)
|
||||
}
|
||||
binding.ivOpen1.setOnClickListener {
|
||||
rotatePrize()
|
@@ -15,11 +15,11 @@ import com.mango.moshen.ui.utils.RVDelegate
|
||||
|
||||
class HomePrizeDialog : BaseDialog<TreasureFairyDialogHomePrizeBinding>() {
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private val prizeAdapter = HomePrizeAdapter()
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var gravity = Gravity.BOTTOM
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<PrizeInfo>
|
||||
private lateinit var prizeAdapter: HomePrizeAdapter
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
|
||||
companion object {
|
||||
@@ -36,11 +36,11 @@ class HomePrizeDialog : BaseDialog<TreasureFairyDialogHomePrizeBinding>() {
|
||||
binding.rootView.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
prizeAdapter = HomePrizeAdapter()
|
||||
rvDelegate = RVDelegate.Builder<PrizeInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setLayoutManager(GridLayoutManager(context,4, LinearLayoutManager.VERTICAL, false))
|
||||
.setLayoutManager(GridLayoutManager(context, 4, LinearLayoutManager.VERTICAL, false))
|
||||
.build()
|
||||
|
||||
viewModel.resultLiveData.observe(viewLifecycleOwner) { event ->
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/treasure_fairy_bg_forest.png
Normal file
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 544 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 604 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 599 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 203 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 268 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 23 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_bg_forest_title_prize_checked" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/treasure_fairy_bg_forest_title_prize_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_forest_title_record_checked" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/treasure_fairy_bg_forest_title_record_unchecked" />
|
||||
|
||||
</selector>
|
@@ -1,12 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout 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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_elf"
|
||||
>
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_title_bar"
|
||||
@@ -89,5 +92,6 @@
|
||||
|
||||
</WebView>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
281
app/src/main/res/layout/treasure_fairy_dialog_forest.xml
Normal file
@@ -0,0 +1,281 @@
|
||||
<?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_home"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="750:1160"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/treasure_fairy_ic_forest_title"
|
||||
app:layout_constraintDimensionRatio="306:157"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||
app:layout_constraintWidth_percent="0.408" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_my_fairy"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:src="@drawable/treasure_fairy_ic_my_fairy"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_fairy_adventure"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_record" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_adventure"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:src="@drawable/treasure_fairy_bg_forest_adventure"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_fairy_store"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_record" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_store"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:src="@drawable/treasure_fairy_ic_forest_store"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_record"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_record" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_record"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@drawable/treasure_fairy_ic_forest_record"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_title" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_forest_base"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_base"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest"
|
||||
app:layout_constraintDimensionRatio="678:522"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_forest" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_forest"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest"
|
||||
app:layout_constraintDimensionRatio="740:546"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_record" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_previous"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:src="@drawable/treasure_fairy_ic_forest_next"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintVertical_bias="0.56" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_next"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:rotation="180"
|
||||
android:src="@drawable/treasure_fairy_ic_forest_next"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_previous" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="使用初级球有一定几率抓到史诗精灵"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_grab_1"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_grab_1"
|
||||
app:layout_constraintEnd_toStartOf="@id/view_bg_grab_10"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_bg_forest" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="抓捕一次"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_grab_1"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_grab_1"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_grab_1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_grab_text_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="(初级精灵球X1)"
|
||||
android:textColor="@color/color_1f5764"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_grab_1"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_grab_1"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_grab_1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_grab_10"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="25dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_grab_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_grab_1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/view_bg_grab_1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="抓捕十次"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_grab_10"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_grab_10"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_grab_10" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_grab_text_10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="(初级精灵球X10)"
|
||||
android:textColor="@color/color_1f5764"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_grab_10"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_grab_10"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_grab_10" />
|
||||
|
||||
<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="#ffffffff"
|
||||
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">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:text="1000"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:text="1000"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:text="1000"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -0,0 +1,63 @@
|
||||
<?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_prize"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="562:570"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.6"
|
||||
app:layout_constraintWidth_percent="0.75" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="53dp"
|
||||
android:text="意外发现"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_close"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="42dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_prize_close"
|
||||
android:gravity="center"
|
||||
android:text="关 闭"
|
||||
android:textColor="#ff008573"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android: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="562:570"
|
||||
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_forest_prize"
|
||||
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_forest_record"
|
||||
android:button="@null" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
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>
|
||||
|
@@ -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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mango.moshen.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/magic_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
@@ -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="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</LinearLayout>
|
36
app/src/main/res/layout/treasure_fairy_item_forest_prize.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mango.moshen.common.widget.CircleImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:cborder_color="#F4FFC3"
|
||||
app:cborder_width="1px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="精灵球"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
@@ -0,0 +1,36 @@
|
||||
<?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="94dp"
|
||||
android:layout_height="115dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_pool"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="18dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_1f5764"
|
||||
android:textSize="13sp"
|
||||
tools:text="精灵球" />
|
||||
|
||||
</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>
|
@@ -606,4 +606,5 @@
|
||||
<color name="color_5FCCE4">#5FCCE4</color>
|
||||
<color name="color_161958">#161958</color>
|
||||
<color name="color_babbcd">#BABBCD</color>
|
||||
<color name="color_1f5764">#1f5764</color>
|
||||
</resources>
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.mango.core.treasurefairy
|
||||
|
||||
data class ForestInfo(
|
||||
val avatar: String = "",
|
||||
val erbanNo: Int = 0,
|
||||
val highBallNum: Int = 0,
|
||||
val lowBallNum: Int = 0,
|
||||
val middleBallNum: Int = 0,
|
||||
val nick: String = "",
|
||||
val uid: Int = 0
|
||||
)
|
@@ -8,9 +8,10 @@ data class PrizeInfo(
|
||||
val rewardLevel: Int = 0,
|
||||
val rewardPicUrl: String = "",
|
||||
val rewardType: String = "",
|
||||
val rewardUnit: String = ""
|
||||
)
|
||||
{
|
||||
val rewardUnit: String = "",
|
||||
val drawTime: Long = 0,
|
||||
val poolLevel: Int = 0
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
@@ -4,10 +4,7 @@ import com.mango.core.bean.response.ServiceResult
|
||||
import com.mango.core.manager.AvRoomDataManager
|
||||
import com.mango.core.utils.net.launchRequest
|
||||
import com.mango.xchat_android_library.net.rxnet.RxNet
|
||||
import retrofit2.http.Field
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.*
|
||||
|
||||
object TreasureFairyModel {
|
||||
|
||||
@@ -25,10 +22,27 @@ object TreasureFairyModel {
|
||||
api.getPrizeInfoList()
|
||||
}
|
||||
|
||||
suspend fun drawForestFairy(drawNum: Int, poolLevel: Int): List<PrizeInfo>? = launchRequest {
|
||||
api.drawForestFairy(drawNum, poolLevel)
|
||||
}
|
||||
|
||||
suspend fun getForestRecord(): List<PrizeInfo>? = launchRequest {
|
||||
api.getForestRecord()
|
||||
}
|
||||
|
||||
suspend fun getForestPrizePool(poolLevel: Int): List<PrizeInfo>? = launchRequest {
|
||||
api.getForestPrizePool(poolLevel)
|
||||
}
|
||||
|
||||
suspend fun getForestInfo(): ForestInfo? = launchRequest {
|
||||
api.getForestInfo()
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
*
|
||||
* 夺宝
|
||||
*
|
||||
* @param drawNum
|
||||
* @return
|
||||
@@ -43,8 +57,46 @@ object TreasureFairyModel {
|
||||
@GET("act/seize-treasure/user/draw/info")
|
||||
suspend fun getDrawInfo(): ServiceResult<DrawInfo>
|
||||
|
||||
/**
|
||||
* 奖池列表
|
||||
*
|
||||
*/
|
||||
@GET("act/seize-treasure/draw/pool/list")
|
||||
suspend fun getPrizeInfoList(): ServiceResult<List<PrizeInfo>>
|
||||
|
||||
/**
|
||||
* 猛犸森林抽奖
|
||||
*
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("act/seize-treasure/forest/draw")
|
||||
suspend fun drawForestFairy(
|
||||
@Field("drawNum") drawNum: Int,
|
||||
@Field("poolLevel") poolLevel: Int
|
||||
): ServiceResult<List<PrizeInfo>>
|
||||
|
||||
/**
|
||||
* 猛犸森林抽奖记录
|
||||
*
|
||||
*/
|
||||
@GET("act/seize-treasure/forest/draw/record")
|
||||
suspend fun getForestRecord(): ServiceResult<List<PrizeInfo>>
|
||||
|
||||
/**
|
||||
*
|
||||
* 猛犸森林奖池配置列表
|
||||
*
|
||||
*/
|
||||
@GET("act/seize-treasure/draw/forest/item")
|
||||
suspend fun getForestPrizePool(@Query("poolLevel") poolLevel: Int): ServiceResult<List<PrizeInfo>>
|
||||
|
||||
/**
|
||||
*
|
||||
* 猛犸森林奖池配置列表
|
||||
*
|
||||
*/
|
||||
@GET("act/seize-treasure/user/forest/info")
|
||||
suspend fun getForestInfo(): ServiceResult<ForestInfo>
|
||||
}
|
||||
|
||||
}
|