精灵夺宝 回退旧版本

This commit is contained in:
wzq
2023-09-28 16:25:22 +08:00
parent 3237a772d7
commit d7ce32b101
14 changed files with 36 additions and 128 deletions

View File

@@ -1,33 +0,0 @@
package com.yizhuan.erban.treasurefairy.adapter
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yizhuan.erban.R
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
import com.yizhuan.xchat_android_core.treasurefairy.ExchangeGiftInfo
import com.yizhuan.xchat_android_core.treasurefairy.PropItemInfo
class ExchangeSummonAdapter :
BaseQuickAdapter<ExchangeGiftInfo, BaseViewHolder>(R.layout.treasure_fairy_item_exchange_summon) {
override fun convert(helper: BaseViewHolder, item: ExchangeGiftInfo) {
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_prize_icon), item.rewardPicUrl)
helper.setText(R.id.tv_prize_name, item.getPrizeName())
val adapter: BaseQuickAdapter<PropItemInfo, BaseViewHolder> =
object : BaseQuickAdapter<PropItemInfo, BaseViewHolder>(R.layout.item_exchange_debris) {
override fun convert(helper: BaseViewHolder, item: PropItemInfo) {
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_icon), item.picUrl)
helper.setText(R.id.tv_num, "${item.propName}x${item.propNum}")
}
}
helper.getView<RecyclerView>(R.id.mRecyclerView).adapter = adapter
item.propItems?.let {
adapter.setNewData(it)
}
helper.addOnClickListener(R.id.tv_exchange)
}
}

View File

@@ -1,89 +0,0 @@
package com.yizhuan.erban.treasurefairy.fragment
import android.annotation.SuppressLint
import android.os.Bundle
import androidx.activity.viewModels
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseViewBindingFragment
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.databinding.TreasureFairyFragmentExchangeDebrisBinding
import com.yizhuan.erban.treasurefairy.FairyViewModel
import com.yizhuan.erban.treasurefairy.adapter.ExchangeDebrisAdapter
import com.yizhuan.erban.treasurefairy.adapter.ExchangeSummonAdapter
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.erban.ui.utils.loadAvatar
import com.yizhuan.xchat_android_core.treasurefairy.ExchangeGiftInfo
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
import com.yizhuan.xchat_android_core.utils.toast
class ExchangeSummonFragment :
BaseViewBindingFragment<TreasureFairyFragmentExchangeDebrisBinding>() {
companion object {
fun newInstance(): ExchangeSummonFragment {
val args = Bundle()
val fragment = ExchangeSummonFragment()
fragment.arguments = args
return fragment
}
}
private val viewModel: FairyViewModel by viewModels()
private lateinit var rvDelegate: RVDelegate<ExchangeGiftInfo>
private lateinit var exchangeSummonAdapter: ExchangeSummonAdapter
@SuppressLint("CheckResult")
override fun init() {
exchangeSummonAdapter = ExchangeSummonAdapter()
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
.setAdapter(exchangeSummonAdapter)
.setRecyclerView(binding.recyclerView)
.setEmptyView(
EmptyViewHelper.createEmptyTextViewNoImage(
context,
getString(R.string.fairy_no_further_data_is_available)
)
)
.setLayoutManager(GridLayoutManager(context, 2, LinearLayoutManager.VERTICAL, false))
.build()
viewModel.fairyCallInfoLiveData.observe(viewLifecycleOwner) {
rvDelegate.setNewData(it)
}
viewModel.debrisExchangeListLiveData.observe(viewLifecycleOwner) {
rvDelegate.setNewData(it)
}
exchangeSummonAdapter.setOnItemChildClickListener { _, _, position ->
exchangeSummonAdapter.getItem(position)?.let {
dialogManager.showTipsDialog("您將要兌換“${it.getPrizeName()}", "兌換") {
viewModel.debrisExchange(it.itemId)
}
}
}
viewModel.getFairyCallList()
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()
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

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

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#8651e0" />
</shape>

View 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">
<stroke
android:width="0.5dp"
android:color="@color/color_white" />
<corners android:radius="@dimen/dp_15" />
<solid android:color="@color/color_8651E0"/>
</shape>

View File

@@ -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/bg_683fad_10" android:state_selected="true" />
<item android:drawable="@drawable/bg_8651e0" />
</selector>

View File

@@ -49,6 +49,7 @@
<color name="white_op_30">#B3FFFFFF</color>
<color name="white_tran_10">#19FFFFFF</color>
<color name="white_tran_20">#33FFFFFF</color>
<color name="white_tran_40">#66FFFFFF</color>
<color name="white_transparent_12">#1EFFFFFF</color>
<color name="white_transparent_14">#23FFFFFF</color>
@@ -623,7 +624,6 @@
<color name="color_13E2F5">#13E2F5</color>
<color name="color_CC66FF">#CC66FF</color>
<color name="color_9168FA">#9168FA</color>
<color name="color_339168FA">#339168FA</color>
<color name="color_0D344D">#0D344D</color>
<color name="color_75FBE2">#75FBE2</color>
<color name="color_A8041D">#A8041D</color>
@@ -688,13 +688,14 @@
<color name="color_FFFEBB">#FFFEBB</color>
<color name="color_8651E0">#8651E0</color>
<color name="color_7748C7">#7748C7</color>
<color name="color_a974ff">#A974FF</color>
<color name="color_339168FA">#339168FA</color>
<color name="color_ff80cc">#ff80cc</color>
<color name="color_6bb3ff">#6bb3ff</color>
<color name="color_7147E6">#7147E6</color>
<color name="color_FF9A1F">#FF9A1F</color>
<color name="color_A3A0AD">#A3A0AD</color>
<color name="color_ff80cc">#FF80CC</color>
<color name="color_6bb3ff">#6BB3FF</color>
<color name="color_5CF1FF">#5CF1FF</color>
<color name="color_CF70FF">#CF70FF</color>
<color name="color_a974ff">#A974FF</color>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -49,6 +49,8 @@ public class HomeRoomInfo implements MultiItemEntity, Serializable {
private String failContext;
private boolean isPick;
private boolean needOpenSelfRoom;
private int isWeekTop1;
private int isHourTop1;
@Override
public int getItemType() {

View File

@@ -31,8 +31,8 @@ COMPILE_SDK_VERSION=33
MIN_SDK_VERSION=21
TARGET_SDK_VERSION=33
version_name=1.10.5
version_code=1005
version_name=2.0.0
version_code=2000
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=7890