|
@@ -11,6 +11,7 @@ import android.widget.Toast
|
|
|
import androidx.fragment.app.activityViewModels
|
|
|
import androidx.fragment.app.viewModels
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
|
import com.facebook.internal.AppCall
|
|
@@ -73,11 +74,13 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
private var hotFragment: GiftFragment? = null
|
|
|
private var luxuryFragment: GiftFragment? = null
|
|
|
private var specialFragment: GiftFragment? = null
|
|
|
+ private var mingRenTangFragment: GiftFragment? = null
|
|
|
|
|
|
private var luckyData = ArrayList<GiftModel>()
|
|
|
private var hotData = ArrayList<GiftModel>()
|
|
|
private var luxuryData = ArrayList<GiftModel>()
|
|
|
private var specialData = ArrayList<GiftModel>()
|
|
|
+ private var mingRenTangData = ArrayList<GiftModel>()
|
|
|
private var viewPagerAdapter: SwagoAdapter? = null
|
|
|
|
|
|
private var type = 1
|
|
@@ -121,6 +124,17 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
//获取语音房麦位用户列表
|
|
|
binding.tvSender.visibility = View.GONE
|
|
|
binding.rvAudioUser.visibility = View.VISIBLE
|
|
|
+ binding.rvAudioUser.layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL,false)
|
|
|
+ binding.rvAudioUser.adapter = adapter
|
|
|
+ adapter.setOnItemClickListener { _, view, position ->
|
|
|
+ adapter.data[position].selected = !adapter.data[position].selected
|
|
|
+ if (adapter.data[position].selected){
|
|
|
+ selectedUserList.add(adapter.data[position].user_id)
|
|
|
+ }else{
|
|
|
+ selectedUserList.remove(adapter.data[position].user_id)
|
|
|
+ }
|
|
|
+ adapter.notifyItemChanged(position)
|
|
|
+ }
|
|
|
getAudioMaiList()
|
|
|
json = SpUtil.readString("audioGiftList")
|
|
|
}
|
|
@@ -159,6 +173,11 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
specialData.clear()
|
|
|
specialData.addAll(giftAllModel.data)
|
|
|
}
|
|
|
+ 5 -> {
|
|
|
+ //特殊礼物
|
|
|
+ mingRenTangData.clear()
|
|
|
+ mingRenTangData.addAll(giftAllModel.data)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
binding.tvToSend.visibility = View.VISIBLE
|
|
@@ -172,10 +191,12 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
hotFragment = GiftFragment.newInstance(1, hotData)
|
|
|
luxuryFragment = GiftFragment.newInstance(2, luxuryData)
|
|
|
specialFragment = GiftFragment.newInstance(4, specialData)
|
|
|
+ mingRenTangFragment = GiftFragment.newInstance(5, mingRenTangData)
|
|
|
|
|
|
giftFragmentList.add(luckyFragment!!)
|
|
|
giftFragmentList.add(hotFragment!!)
|
|
|
- giftFragmentList.add(luxuryFragment!!)
|
|
|
+// giftFragmentList.add(luxuryFragment!!)
|
|
|
+ giftFragmentList.add(mingRenTangFragment!!)
|
|
|
giftFragmentList.add(specialFragment!!)
|
|
|
|
|
|
|
|
@@ -187,24 +208,35 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
hotFragment?.reset()
|
|
|
luxuryFragment?.reset()
|
|
|
specialFragment?.reset()
|
|
|
+ mingRenTangFragment?.reset()
|
|
|
}
|
|
|
hotFragment?.listener = {
|
|
|
resetSendState()
|
|
|
luckyFragment?.reset()
|
|
|
luxuryFragment?.reset()
|
|
|
specialFragment?.reset()
|
|
|
+ mingRenTangFragment?.reset()
|
|
|
}
|
|
|
luxuryFragment?.listener = {
|
|
|
resetSendState()
|
|
|
luckyFragment?.reset()
|
|
|
hotFragment?.reset()
|
|
|
specialFragment?.reset()
|
|
|
+ mingRenTangFragment?.reset()
|
|
|
}
|
|
|
specialFragment?.listener = {
|
|
|
resetSendState()
|
|
|
luckyFragment?.reset()
|
|
|
hotFragment?.reset()
|
|
|
luxuryFragment?.reset()
|
|
|
+ mingRenTangFragment?.reset()
|
|
|
+ }
|
|
|
+ mingRenTangFragment?.listener = {
|
|
|
+ resetSendState()
|
|
|
+ luckyFragment?.reset()
|
|
|
+ hotFragment?.reset()
|
|
|
+ luxuryFragment?.reset()
|
|
|
+ specialFragment?.reset()
|
|
|
}
|
|
|
|
|
|
binding.viewPager.offscreenPageLimit = 3
|
|
@@ -288,6 +320,9 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
4 -> {
|
|
|
binding.viewPager.currentItem = 3
|
|
|
}
|
|
|
+ 5 -> {
|
|
|
+ binding.viewPager.currentItem = 2
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
binding.combo.setOnClick(object : ComboView.OnClick {
|
|
@@ -334,9 +369,14 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
}
|
|
|
|
|
|
3 -> {
|
|
|
- //高级
|
|
|
+// //高级
|
|
|
+// val gifModel =
|
|
|
+// luxuryData[GiftConfig.giftSelectedPageIndex * 8 + GiftConfig.giftSelectedPageSelectedPosition]
|
|
|
+// LogUtil.d("礼物id", "${gifModel.gift_name}")
|
|
|
+// sendGift(gifModel, 0)
|
|
|
+
|
|
|
val gifModel =
|
|
|
- luxuryData[GiftConfig.giftSelectedPageIndex * 8 + GiftConfig.giftSelectedPageSelectedPosition]
|
|
|
+ mingRenTangData[GiftConfig.giftSelectedPageIndex * 8 + GiftConfig.giftSelectedPageSelectedPosition]
|
|
|
LogUtil.d("礼物id", "${gifModel.gift_name}")
|
|
|
sendGift(gifModel, 0)
|
|
|
}
|
|
@@ -452,6 +492,12 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
specialData.clear()
|
|
|
specialData.addAll(giftAllModel.data)
|
|
|
}
|
|
|
+
|
|
|
+ 5 -> {
|
|
|
+ //名人堂礼物
|
|
|
+ mingRenTangData.clear()
|
|
|
+ mingRenTangData.addAll(giftAllModel.data)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
viewPagerAdapter?.notifyDataSetChanged()
|
|
@@ -462,7 +508,7 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
giftVm.sendResultLiveData.observe(this) {
|
|
|
if (it != null) {
|
|
|
if (it.im_data != null) {
|
|
|
- if(it.im_data.giftType==3){
|
|
|
+ if(it.im_data.giftType==3 || it.im_data.giftType==5){
|
|
|
msgVm.showGiftDanDao?.invoke(it.im_data)
|
|
|
}
|
|
|
msgVm.inComeChange?.invoke(it.im_data.incomeCount)
|
|
@@ -508,18 +554,7 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
|
|
|
it.selected = true
|
|
|
selectedUserList.add(it.user_id)
|
|
|
}
|
|
|
- binding.rvAudioUser.layoutManager = LinearLayoutManager(it)
|
|
|
- binding.rvAudioUser.adapter = adapter
|
|
|
adapter.setNewData(data)
|
|
|
- adapter.setOnItemClickListener { _, view, position ->
|
|
|
- adapter.data[position].selected = !adapter.data[position].selected
|
|
|
- if (adapter.data[position].selected){
|
|
|
- selectedUserList.add(adapter.data[position].user_id)
|
|
|
- }else{
|
|
|
- selectedUserList.remove(adapter.data[position].user_id)
|
|
|
- }
|
|
|
- adapter.notifyItemChanged(position)
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|