|
@@ -14,6 +14,7 @@ import com.swago.baseswago.constant.ARouteConstant
|
|
|
import com.swago.baseswago.model.live.audio.PositionBean
|
|
|
import com.swago.baseswago.model.mine.StoreItemBean
|
|
|
import com.swago.baseswago.util.AppContext
|
|
|
+import com.swago.baseswago.util.SpUtil
|
|
|
import com.swago.user.R
|
|
|
import com.swago.user.databinding.ActivityStoreListBinding
|
|
|
import com.swago.user.vm.StoreVm
|
|
@@ -178,6 +179,10 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
if (it.isNullOrEmpty()){
|
|
|
binding.clEmpty.visibility = View.VISIBLE
|
|
|
} else {
|
|
|
+ enterList.clear()
|
|
|
+ avatarList.clear()
|
|
|
+ badgeList.clear()
|
|
|
+ bubbleList.clear()
|
|
|
it.forEach { item ->
|
|
|
when (item.product_category){
|
|
|
1 -> {
|
|
@@ -274,7 +279,56 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
isBubbleExpanded = !isBubbleExpanded
|
|
|
}
|
|
|
enterAdapter.setOnItemClickListener { _, _, position ->
|
|
|
- StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
|
|
|
+ if (type == 1){
|
|
|
+ StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
|
|
|
+ } else if (type == 2){
|
|
|
+ storeVm.chooseProduct(enterAdapter.data[position].id)
|
|
|
+ enterList.forEachIndexed { index, storeItemBean ->
|
|
|
+ enterList[index].product_status = 0
|
|
|
+ return@forEachIndexed
|
|
|
+ }
|
|
|
+ enterList[position].product_status = 1
|
|
|
+ enterAdapter.notifyDataSetChanged()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ avatarAdapter.setOnItemClickListener { _, _, position ->
|
|
|
+ if (type == 1){
|
|
|
+ StoreBuyDialog.newInstance(avatarAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
|
|
|
+ } else if (type == 2){
|
|
|
+ storeVm.chooseProduct(avatarAdapter.data[position].id)
|
|
|
+ avatarList.forEachIndexed { index, storeItemBean ->
|
|
|
+ avatarList[index].product_status = 0
|
|
|
+ return@forEachIndexed
|
|
|
+ }
|
|
|
+ avatarList[position].product_status = 1
|
|
|
+ avatarAdapter.notifyDataSetChanged()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ badgeAdapter.setOnItemClickListener { _, _, position ->
|
|
|
+ if (type == 1){
|
|
|
+ StoreBuyDialog.newInstance(badgeAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
|
|
|
+ } else if (type == 2){
|
|
|
+ storeVm.chooseProduct(badgeAdapter.data[position].id)
|
|
|
+ badgeList.forEachIndexed { index, storeItemBean ->
|
|
|
+ badgeList[index].product_status = 0
|
|
|
+ return@forEachIndexed
|
|
|
+ }
|
|
|
+ badgeList[position].product_status = 1
|
|
|
+ badgeAdapter.notifyDataSetChanged()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bubbleAdapter.setOnItemClickListener { _, _, position ->
|
|
|
+ if (type == 1){
|
|
|
+ StoreBuyDialog.newInstance(bubbleAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
|
|
|
+ } else if (type == 2){
|
|
|
+ storeVm.chooseProduct(bubbleAdapter.data[position].id)
|
|
|
+ bubbleList.forEachIndexed { index, storeItemBean ->
|
|
|
+ bubbleList[index].product_status = 0
|
|
|
+ return@forEachIndexed
|
|
|
+ }
|
|
|
+ bubbleList[position].product_status = 1
|
|
|
+ bubbleAdapter.notifyDataSetChanged()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|