feat:恢复创建游戏房间功能

This commit is contained in:
max
2024-04-29 14:19:56 +08:00
parent ae4dea2ab0
commit 32ac09ef60
2 changed files with 29 additions and 28 deletions

View File

@@ -4,6 +4,8 @@ import android.annotation.SuppressLint
import android.view.Gravity
import android.view.WindowManager
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.chwl.app.R
import com.chwl.app.avroom.adapter.CreateRoomGameAdapter
import com.chwl.app.base.BaseActivity
@@ -30,35 +32,35 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
@SuppressLint("CheckResult")
override fun init() {
// if(isHomeGame){
// binding?.tvPlayType?.isVisible = false
// binding?.rgType?.isVisible = false
// binding?.rvGame?.isVisible = true
// }
// binding?.rvGame?.itemAnimator = null
// rvDelegate = RVDelegate.Builder<GameInfo>()
// .setAdapter(gameAdapter)
// .setRecyclerView(binding?.rvGame)
// .setLayoutManager(LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false))
// .build()
if(isHomeGame){
binding?.tvPlayType?.isVisible = false
binding?.rgType?.isVisible = false
binding?.rvGame?.isVisible = true
}
binding?.rvGame?.itemAnimator = null
rvDelegate = RVDelegate.Builder<GameInfo>()
.setAdapter(gameAdapter)
.setRecyclerView(binding?.rvGame)
.setLayoutManager(LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false))
.build()
// gameAdapter.setOnItemClickListener { _, _, position ->
// if (selectIndex != -1) {
// gameAdapter.data.getOrNull(selectIndex)?.isSelect = false
// gameAdapter.notifyItemChanged(selectIndex)
// }
// selectIndex = position
// gameAdapter.data.getOrNull(selectIndex)?.isSelect = true
// gameAdapter.notifyItemChanged(selectIndex)
// checkCreateEnable()
// }
gameAdapter.setOnItemClickListener { _, _, position ->
if (selectIndex != -1) {
gameAdapter.data.getOrNull(selectIndex)?.isSelect = false
gameAdapter.notifyItemChanged(selectIndex)
}
selectIndex = position
gameAdapter.data.getOrNull(selectIndex)?.isSelect = true
gameAdapter.notifyItemChanged(selectIndex)
checkCreateEnable()
}
// binding?.rbGameRoom?.setOnCheckedChangeListener { _, isChecked ->
// checkCreateEnable()
// if (isChecked) {
// binding?.rvGame?.isVisible = true
// }
// }
binding?.rbGameRoom?.setOnCheckedChangeListener { _, isChecked ->
checkCreateEnable()
if (isChecked) {
binding?.rvGame?.isVisible = true
}
}
binding?.rbPartyRoom?.setOnCheckedChangeListener { _, isChecked ->
checkCreateEnable()

View File

@@ -61,7 +61,6 @@
android:button="@null" />
<RadioButton
android:visibility="gone"
android:id="@+id/rb_game_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"