|
@@ -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 -> {
|
|
@@ -217,6 +222,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
binding.clEnterMore.setOnClickListener {
|
|
|
if (type == 2)
|
|
|
return@setOnClickListener
|
|
|
+ isEnterExpanded = !isEnterExpanded
|
|
|
if (isEnterExpanded) {
|
|
|
enterAdapter.setNewData(enterList)
|
|
|
binding.tvEnterMore.text = "Show Less"
|
|
@@ -226,12 +232,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
binding.tvEnterMore.text = "Show More"
|
|
|
binding.ivEnterMore.setImageResource(R.mipmap.ic_show_more)
|
|
|
}
|
|
|
- isEnterExpanded = !isEnterExpanded
|
|
|
}
|
|
|
|
|
|
binding.clAvatarMore.setOnClickListener {
|
|
|
if (type == 2)
|
|
|
return@setOnClickListener
|
|
|
+ isAvatarExpanded = !isAvatarExpanded
|
|
|
if (isAvatarExpanded) {
|
|
|
avatarAdapter.setNewData(avatarList)
|
|
|
binding.tvAvatarMore.text = "Show Less"
|
|
@@ -241,12 +247,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
binding.tvAvatarMore.text = "Show More"
|
|
|
binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_more)
|
|
|
}
|
|
|
- isAvatarExpanded = !isAvatarExpanded
|
|
|
}
|
|
|
|
|
|
binding.clBadgeMore.setOnClickListener {
|
|
|
if (type == 2)
|
|
|
return@setOnClickListener
|
|
|
+ isBadgeExpanded = !isBadgeExpanded
|
|
|
if (isBadgeExpanded) {
|
|
|
badgeAdapter.setNewData(badgeList)
|
|
|
binding.tvBadgeMore.text = "Show Less"
|
|
@@ -256,12 +262,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
binding.tvBadgeMore.text = "Show More"
|
|
|
binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_more)
|
|
|
}
|
|
|
- isBadgeExpanded = !isBadgeExpanded
|
|
|
}
|
|
|
|
|
|
binding.clBubbleMore.setOnClickListener {
|
|
|
if (type == 2)
|
|
|
return@setOnClickListener
|
|
|
+ isBubbleExpanded = !isBubbleExpanded
|
|
|
if (isBubbleExpanded) {
|
|
|
bubbleAdapter.setNewData(bubbleList)
|
|
|
binding.tvBubbleMore.text = "Show Less"
|
|
@@ -271,10 +277,58 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
|
|
|
binding.tvBubbleMore.text = "Show More"
|
|
|
binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_more)
|
|
|
}
|
|
|
- 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()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|