feat:完成首页-交友UI与数据联调
feat:完成更多游戏房间页面功能
This commit is contained in:
@@ -1177,7 +1177,7 @@
|
|||||||
android:name="com.nnbc123.app.shipantics.RadishRankingActivity"
|
android:name="com.nnbc123.app.shipantics.RadishRankingActivity"
|
||||||
android:theme="@style/room_message_activity" />
|
android:theme="@style/room_message_activity" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.nnbc123.app.home.activity.MoreRoomActivity"
|
android:name="com.nnbc123.app.game_room.GameRoomActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.nnbc123.app.avroom.wishlist.WishListCreateActivity"
|
android:name="com.nnbc123.app.avroom.wishlist.WishListCreateActivity"
|
||||||
|
106
app/src/main/java/com/nnbc123/app/game_room/GameRoomActivity.kt
Normal file
106
app/src/main/java/com/nnbc123/app/game_room/GameRoomActivity.kt
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
package com.nnbc123.app.game_room
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.gyf.immersionbar.BarHide
|
||||||
|
import com.gyf.immersionbar.ImmersionBar
|
||||||
|
import com.nnbc123.app.R
|
||||||
|
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
||||||
|
import com.nnbc123.app.base.BaseBindingActivity
|
||||||
|
import com.nnbc123.app.common.EmptyViewHelper
|
||||||
|
import com.nnbc123.app.databinding.ActivityMoreRoomBinding
|
||||||
|
import com.nnbc123.app.home.dialog.RecommendRoomDialog
|
||||||
|
import com.nnbc123.app.ui.utils.RVDelegate
|
||||||
|
import com.nnbc123.core.home.bean.HomeRoomInfo
|
||||||
|
import com.nnbc123.library.annatation.ActLayoutRes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更多游戏-房间列表
|
||||||
|
*/
|
||||||
|
@ActLayoutRes(R.layout.activity_more_room)
|
||||||
|
class GameRoomActivity : BaseBindingActivity<ActivityMoreRoomBinding>() {
|
||||||
|
|
||||||
|
private val gameTabAdapter = GameTabAdapter()
|
||||||
|
private val roomAdapter = GameRoomAdapter()
|
||||||
|
private lateinit var viewModel: GameRoomViewModel
|
||||||
|
|
||||||
|
private var rvDelegate: RVDelegate<HomeRoomInfo>? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun start(context: Context) {
|
||||||
|
val starter = Intent(context, GameRoomActivity::class.java)
|
||||||
|
context.startActivity(starter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
ImmersionBar.with(this).titleBarMarginTop(mBinding.ivBack).init()
|
||||||
|
viewModel = ViewModelProvider(this)[GameRoomViewModel::class.java]
|
||||||
|
initView()
|
||||||
|
initEvent()
|
||||||
|
initObserve()
|
||||||
|
viewModel.getData()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
mBinding.ivBack.setOnClickListener {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
mBinding.rvTop.adapter = gameTabAdapter
|
||||||
|
|
||||||
|
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
|
||||||
|
.setAdapter(roomAdapter)
|
||||||
|
.setRecyclerView(mBinding.recyclerView)
|
||||||
|
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无数据"))
|
||||||
|
.setLayoutManager(GridLayoutManager(this, 2))
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initObserve() {
|
||||||
|
viewModel.jumpLiveData.observe(this) {
|
||||||
|
dialogManager.dismissDialog()
|
||||||
|
it?.let {
|
||||||
|
if (it.isPick) {
|
||||||
|
AVRoomActivity.start(context, it.uid)
|
||||||
|
} else {
|
||||||
|
RecommendRoomDialog.newInstance(it).show(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewModel.gameTabLiveData.observe(this) {
|
||||||
|
gameTabAdapter.setNewData(it)
|
||||||
|
mBinding.rvTop.isVisible = !it.isNullOrEmpty()
|
||||||
|
}
|
||||||
|
viewModel.roomListLiveData.observe(this) {
|
||||||
|
rvDelegate?.loadData(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initEvent() {
|
||||||
|
gameTabAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
gameTabAdapter.getItem(position)?.let {
|
||||||
|
dialogManager.showProgressDialog(this)
|
||||||
|
val type = if (it.isFriendsType == true) {
|
||||||
|
2
|
||||||
|
} else {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
viewModel.getJumpInfo(it.mgId ?: 0, type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
roomAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
roomAdapter.getItem(position)?.let {
|
||||||
|
AVRoomActivity.start(context, it.uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
dialogManager?.dismissDialog()
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
package com.nnbc123.app.game_room
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.nnbc123.app.R
|
||||||
|
import com.nnbc123.app.ui.utils.load
|
||||||
|
import com.nnbc123.core.home.bean.HomeRoomInfo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/26 11:31
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class GameRoomAdapter :
|
||||||
|
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.game_room_item_room) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_bg).load(item.backgroundPic)
|
||||||
|
helper.getView<ImageView>(R.id.iv_room_cover).load(item.roomAvatar)
|
||||||
|
helper.setText(R.id.tv_room_name, item.title)
|
||||||
|
helper.setText(R.id.tv_online_number, "${item.onlineNum}")
|
||||||
|
|
||||||
|
//gameState=0 (idle 状态,游戏未开始,空闲状态);gameState=1 (loading 状态,所有玩家都准备好,队长点击了开始游戏按钮,等待加载游戏场景开始游戏);gameState=2(playing状态,游戏进行中状态)
|
||||||
|
if (item.mgId > 0) {
|
||||||
|
when (item.state) {
|
||||||
|
0 -> {
|
||||||
|
helper.setText(R.id.tv_message, "游戏未开始,等待加入")
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
helper.setText(R.id.tv_message, "游戏进行中,立即围观")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
helper.setText(R.id.tv_message, "扩列交友")
|
||||||
|
}
|
||||||
|
|
||||||
|
val avatars: Array<ImageView> = arrayOf(
|
||||||
|
helper.getView(R.id.iv_avatar_0),
|
||||||
|
helper.getView(R.id.iv_avatar_1),
|
||||||
|
helper.getView(R.id.iv_avatar_2),
|
||||||
|
helper.getView(R.id.iv_avatar_3)
|
||||||
|
)
|
||||||
|
for (i in avatars.indices) {
|
||||||
|
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
|
||||||
|
avatars[i].load(avatarUrl, defaultRes = R.drawable.game_room_ic_mic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
package com.nnbc123.app.game_room
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.nnbc123.app.base.BaseViewModel
|
||||||
|
import com.nnbc123.core.bean.response.ListResult
|
||||||
|
import com.nnbc123.core.home.bean.HomeGameBean
|
||||||
|
import com.nnbc123.core.home.bean.HomeRoomInfo
|
||||||
|
import com.nnbc123.core.home.model.HomeModel
|
||||||
|
import com.nnbc123.core.utils.toast
|
||||||
|
|
||||||
|
class GameRoomViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
val gameTabLiveData = MutableLiveData<List<HomeGameBean>>()
|
||||||
|
val roomListLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
|
||||||
|
|
||||||
|
val jumpLiveData = MutableLiveData<HomeRoomInfo?>()
|
||||||
|
|
||||||
|
fun getData() {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
roomListLiveData.value = ListResult.failed(1)
|
||||||
|
gameTabLiveData.value = ArrayList<HomeGameBean>().apply {
|
||||||
|
add(HomeGameBean(isFriendsType = true))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = HomeModel.getHomeGame()
|
||||||
|
val gameList = ArrayList<HomeGameBean>()
|
||||||
|
result?.miniGames?.let {
|
||||||
|
gameList.addAll(it)
|
||||||
|
}
|
||||||
|
gameList.add(HomeGameBean(isFriendsType = true))
|
||||||
|
gameTabLiveData.value = gameList
|
||||||
|
roomListLiveData.value = ListResult.success(result?.playRooms, 1)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getJumpInfo(id: Long, type: Int) {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
jumpLiveData.value = null
|
||||||
|
it.message.toast()
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
jumpLiveData.value = HomeModel.getResourceJumpInfo(id, type)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,24 @@
|
|||||||
|
package com.nnbc123.app.game_room
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.nnbc123.app.R
|
||||||
|
import com.nnbc123.app.ui.utils.load
|
||||||
|
import com.nnbc123.core.home.bean.HomeGameBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/26 11:31
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
class GameTabAdapter :
|
||||||
|
BaseQuickAdapter<HomeGameBean, BaseViewHolder>(R.layout.game_room_item_tab) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: HomeGameBean) {
|
||||||
|
if (item.isFriendsType == true) {
|
||||||
|
helper.getView<ImageView>(R.id.iv_cover)
|
||||||
|
.setImageResource(R.drawable.game_room_bg_friends)
|
||||||
|
} else {
|
||||||
|
helper.getView<ImageView>(R.id.iv_cover).load(item.pic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -89,6 +89,8 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
|
|
||||||
val gameTabLiveData = MutableLiveData<MutableList<HomeGameTab>>()
|
val gameTabLiveData = MutableLiveData<MutableList<HomeGameTab>>()
|
||||||
|
|
||||||
|
val friendRecommendModeLiveData = MutableLiveData<ListResult<UserInfo>>()
|
||||||
|
|
||||||
fun getHomeGameTab() {
|
fun getHomeGameTab() {
|
||||||
safeLaunch {
|
safeLaunch {
|
||||||
if (gameTabLiveData.value == null) {
|
if (gameTabLiveData.value == null) {
|
||||||
@@ -128,14 +130,14 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getResourceJumpInfo(id: Int) {
|
fun getResourceJumpInfo(id: Long) {
|
||||||
safeLaunch(
|
safeLaunch(
|
||||||
onError = {
|
onError = {
|
||||||
_resourceJumpLiveData.value = null
|
_resourceJumpLiveData.value = null
|
||||||
it.message.toast()
|
it.message.toast()
|
||||||
},
|
},
|
||||||
block = {
|
block = {
|
||||||
_resourceJumpLiveData.value = HomeModel.getResourceJumpInfo(id)
|
_resourceJumpLiveData.value = HomeModel.getResourceJumpInfo(id, 0)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -364,4 +366,17 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getFriendRecommendMore() {
|
||||||
|
safeLaunch(
|
||||||
|
onError = {
|
||||||
|
friendRecommendModeLiveData.value = ListResult.failed(1)
|
||||||
|
},
|
||||||
|
block = {
|
||||||
|
val result = HomeModel.getFriendRecommendMore()
|
||||||
|
friendRecommendModeLiveData.value = ListResult.success(result, 1)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1,27 +0,0 @@
|
|||||||
package com.nnbc123.app.home
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import com.nnbc123.app.base.BaseViewModel
|
|
||||||
import com.nnbc123.core.bean.response.ListResult
|
|
||||||
import com.nnbc123.core.home.bean.HomeRoomInfo
|
|
||||||
import com.nnbc123.core.home.model.HomeModel
|
|
||||||
|
|
||||||
class RoomCommonViewModel : BaseViewModel() {
|
|
||||||
|
|
||||||
private val _commonRoomLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
|
|
||||||
val commonRoomLiveData: LiveData<ListResult<HomeRoomInfo>> = _commonRoomLiveData
|
|
||||||
|
|
||||||
fun getCommonRoom(tabId: Int, pageNum: Int, pageSize: Int) {
|
|
||||||
safeLaunch(
|
|
||||||
onError = {
|
|
||||||
_commonRoomLiveData.value = ListResult.failed(pageNum)
|
|
||||||
},
|
|
||||||
block = {
|
|
||||||
val result = HomeModel.getCommonRoom(tabId, pageNum, pageSize)
|
|
||||||
_commonRoomLiveData.value = ListResult.success(result, pageNum)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
package com.nnbc123.app.home
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import com.nnbc123.app.base.BaseViewModel
|
|
||||||
import com.nnbc123.core.bean.response.ListResult
|
|
||||||
import com.nnbc123.core.home.bean.HomeRoomInfo
|
|
||||||
import com.nnbc123.core.home.model.HomeModel
|
|
||||||
|
|
||||||
class RoomSingleViewModel : BaseViewModel() {
|
|
||||||
|
|
||||||
private val _singleAnchorMoreLiveData = MutableLiveData<ListResult<HomeRoomInfo>>()
|
|
||||||
val singleAnchorMoreLiveData: LiveData<ListResult<HomeRoomInfo>> = _singleAnchorMoreLiveData
|
|
||||||
|
|
||||||
fun getMoreSingleAnchorList(id: Long?) {
|
|
||||||
safeLaunch(
|
|
||||||
onError = {
|
|
||||||
_singleAnchorMoreLiveData.value = ListResult.failed(1)
|
|
||||||
},
|
|
||||||
block = {
|
|
||||||
val result = HomeModel.getMoreSingleAnchorList(id)
|
|
||||||
_singleAnchorMoreLiveData.value = ListResult.success(result, 1)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
package com.nnbc123.app.home.activity
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import com.nnbc123.app.R
|
|
||||||
import com.nnbc123.app.base.BaseBindingActivity
|
|
||||||
import com.nnbc123.app.databinding.ActivityMoreRoomBinding
|
|
||||||
import com.nnbc123.library.annatation.ActLayoutRes
|
|
||||||
@ActLayoutRes(R.layout.activity_more_room)
|
|
||||||
class MoreRoomActivity : BaseBindingActivity<ActivityMoreRoomBinding>() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
fun start(context: Context) {
|
|
||||||
val starter = Intent(context, MoreRoomActivity::class.java)
|
|
||||||
context.startActivity(starter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,7 +12,6 @@ import com.nnbc123.app.audio.helper.AudioPlayerHelper
|
|||||||
import com.nnbc123.app.audio.helper.OnPlayListener
|
import com.nnbc123.app.audio.helper.OnPlayListener
|
||||||
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
||||||
import com.nnbc123.app.ui.utils.load
|
import com.nnbc123.app.ui.utils.load
|
||||||
import com.nnbc123.app.ui.utils.loadAvatar
|
|
||||||
import com.nnbc123.app.ui.utils.loadFromAssets
|
import com.nnbc123.app.ui.utils.loadFromAssets
|
||||||
import com.nnbc123.app.vip.VipHelper
|
import com.nnbc123.app.vip.VipHelper
|
||||||
import com.nnbc123.core.Constants
|
import com.nnbc123.core.Constants
|
||||||
@@ -52,7 +51,10 @@ class HomeFriendsUserAdapter :
|
|||||||
// 头像
|
// 头像
|
||||||
helper.getView<ImageView>(R.id.iv_avatar).load(item.avatar)
|
helper.getView<ImageView>(R.id.iv_avatar).load(item.avatar)
|
||||||
// 星座
|
// 星座
|
||||||
val star = StarUtils.getConstellation(Date(item.birth))
|
var star: String? = null
|
||||||
|
if (item.birth > 0) {
|
||||||
|
star = StarUtils.getConstellation(Date(item.birth))
|
||||||
|
}
|
||||||
helper.setGone(R.id.tv_constellation, !star.isNullOrEmpty())
|
helper.setGone(R.id.tv_constellation, !star.isNullOrEmpty())
|
||||||
.setText(R.id.tv_constellation, star)
|
.setText(R.id.tv_constellation, star)
|
||||||
// 状态
|
// 状态
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
package com.nnbc123.app.home.fragment.home
|
|
||||||
|
|
||||||
import androidx.fragment.app.activityViewModels
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
|
||||||
import com.nnbc123.app.R
|
|
||||||
import com.nnbc123.app.base.BaseBindingFragment
|
|
||||||
import com.nnbc123.app.common.EmptyViewHelper
|
|
||||||
import com.nnbc123.app.databinding.HomeFriendsListFragmentBinding
|
|
||||||
import com.nnbc123.app.home.HomeViewModel
|
|
||||||
import com.nnbc123.app.home.adapter.HomeFriendsUserAdapter
|
|
||||||
import com.nnbc123.app.ui.user.UserInfoActivity
|
|
||||||
import com.nnbc123.app.ui.utils.RVDelegate
|
|
||||||
import com.nnbc123.core.user.bean.UserInfo
|
|
||||||
import com.nnbc123.library.annatation.ActLayoutRes
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Max on 2023/12/18 19:35
|
|
||||||
* Desc:
|
|
||||||
**/
|
|
||||||
@ActLayoutRes(R.layout.home_friends_list_fragment)
|
|
||||||
class FriendsListFragment : BaseBindingFragment<HomeFriendsListFragmentBinding>() {
|
|
||||||
private val adapter = HomeFriendsUserAdapter()
|
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
|
||||||
override fun initiate() {
|
|
||||||
adapter.setOnItemClickListener { adapter, view, position ->
|
|
||||||
(adapter.getItem(position) as? UserInfo)?.let { item ->
|
|
||||||
UserInfoActivity.Companion.start(mContext, item.uid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val rvDelegate = RVDelegate.Builder<UserInfo>()
|
|
||||||
.setAdapter(adapter)
|
|
||||||
.setRecyclerView(mBinding.recyclerView)
|
|
||||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无数据"))
|
|
||||||
.setLayoutManager(GridLayoutManager(mContext, 2))
|
|
||||||
.build()
|
|
||||||
homeViewModel.newFriendLiveData.observe(this) {
|
|
||||||
rvDelegate.loadData(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -10,6 +10,8 @@ import com.nnbc123.app.avroom.adapter.RoomVPAdapter
|
|||||||
import com.nnbc123.app.base.BaseBindingFragment
|
import com.nnbc123.app.base.BaseBindingFragment
|
||||||
import com.nnbc123.app.databinding.HomeFragmentBinding
|
import com.nnbc123.app.databinding.HomeFragmentBinding
|
||||||
import com.nnbc123.app.home.adapter.HomeMagicIndicatorAdapter
|
import com.nnbc123.app.home.adapter.HomeMagicIndicatorAdapter
|
||||||
|
import com.nnbc123.app.home.fragment.home.friends.FriendsFragment
|
||||||
|
import com.nnbc123.app.home.fragment.home.party.PartyFragment
|
||||||
import com.nnbc123.app.home.helper.OpenRoomHelper
|
import com.nnbc123.app.home.helper.OpenRoomHelper
|
||||||
import com.nnbc123.app.ui.search.SearchActivity
|
import com.nnbc123.app.ui.search.SearchActivity
|
||||||
import com.nnbc123.app.ui.webview.CommonWebViewActivity
|
import com.nnbc123.app.ui.webview.CommonWebViewActivity
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment.home
|
package com.nnbc123.app.home.fragment.home.friends
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@@ -39,7 +39,7 @@ class FriendsFragment : BaseBindingFragment<HomeFriendsFragmentBinding>() {
|
|||||||
|
|
||||||
override fun initiate() {
|
override fun initiate() {
|
||||||
initResource()
|
initResource()
|
||||||
initTab()
|
initFilterTab()
|
||||||
mBinding.tvGender.singleClick {
|
mBinding.tvGender.singleClick {
|
||||||
showFilterGender()
|
showFilterGender()
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ class FriendsFragment : BaseBindingFragment<HomeFriendsFragmentBinding>() {
|
|||||||
.commitAllowingStateLoss()
|
.commitAllowingStateLoss()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initTab() {
|
private fun initFilterTab() {
|
||||||
mBinding.rvTab.adapter = tabAdapter
|
mBinding.rvTab.adapter = tabAdapter
|
||||||
tabAdapter.setOnItemClickListener { adapter, view, position ->
|
tabAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
tabAdapter.selectItem(position)
|
tabAdapter.selectItem(position)
|
@@ -0,0 +1,119 @@
|
|||||||
|
package com.nnbc123.app.home.fragment.home.friends
|
||||||
|
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chuhai.utils.UiUtils
|
||||||
|
import com.nnbc123.app.R
|
||||||
|
import com.nnbc123.app.base.BaseBindingFragment
|
||||||
|
import com.nnbc123.app.databinding.HomeFriendsListFragmentBinding
|
||||||
|
import com.nnbc123.app.home.HomeViewModel
|
||||||
|
import com.nnbc123.app.home.adapter.HomeFriendsUserAdapter
|
||||||
|
import com.nnbc123.app.ui.user.UserInfoActivity
|
||||||
|
import com.nnbc123.app.ui.utils.RVDelegate
|
||||||
|
import com.nnbc123.core.user.bean.UserInfo
|
||||||
|
import com.nnbc123.library.annatation.ActLayoutRes
|
||||||
|
import com.tencent.mm.opensdk.utils.Log
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/18 19:35
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
@ActLayoutRes(R.layout.home_friends_list_fragment)
|
||||||
|
class FriendsListFragment : BaseBindingFragment<HomeFriendsListFragmentBinding>() {
|
||||||
|
private val adapter = HomeFriendsUserAdapter()
|
||||||
|
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||||
|
private var rvDelegate: RVDelegate<UserInfo>? = null
|
||||||
|
private var headerEmptyView: View? = null
|
||||||
|
private val recommendTitleView get() = headerEmptyView?.findViewById<View>(R.id.layout_title)
|
||||||
|
|
||||||
|
override fun initiate() {
|
||||||
|
initView()
|
||||||
|
initEvent()
|
||||||
|
initObserve()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
val spanCount = 2
|
||||||
|
val listLeftRightPadding = UiUtils.dip2px(15f)
|
||||||
|
val itemLeftRightMargin = UiUtils.dip2px(4.5f)
|
||||||
|
mBinding.recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state)
|
||||||
|
val pos = parent.getChildAdapterPosition(view) - adapter.headerLayoutCount
|
||||||
|
val remainder = pos % spanCount
|
||||||
|
if (pos < 0) {
|
||||||
|
outRect.set(0, 0, 0, 0)
|
||||||
|
} else if (remainder == 0) {
|
||||||
|
// 第一列
|
||||||
|
outRect.set(listLeftRightPadding, 0, itemLeftRightMargin, 0)
|
||||||
|
} else if (remainder == (spanCount - 1)) {
|
||||||
|
// 最后一列
|
||||||
|
outRect.set(itemLeftRightMargin, 0, listLeftRightPadding, 0)
|
||||||
|
} else {
|
||||||
|
// 中间
|
||||||
|
outRect.set(itemLeftRightMargin, 0, itemLeftRightMargin, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
rvDelegate = RVDelegate.Builder<UserInfo>()
|
||||||
|
.setAdapter(adapter)
|
||||||
|
.setRecyclerView(mBinding.recyclerView)
|
||||||
|
.setLayoutManager(GridLayoutManager(mContext, spanCount))
|
||||||
|
.build()
|
||||||
|
initEmptyView()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initEmptyView() {
|
||||||
|
headerEmptyView = LayoutInflater.from(requireContext())
|
||||||
|
.inflate(R.layout.home_friends_list_item_empty, null)
|
||||||
|
headerEmptyView?.isVisible = false
|
||||||
|
adapter.addHeaderView(headerEmptyView)
|
||||||
|
adapter.headerLayout.clipChildren = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initEvent() {
|
||||||
|
adapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
(adapter.getItem(position) as? UserInfo)?.let { item ->
|
||||||
|
UserInfoActivity.Companion.start(mContext, item.uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initObserve() {
|
||||||
|
homeViewModel.newFriendLiveData.observe(this) {
|
||||||
|
if (it.data.isNullOrEmpty()) {
|
||||||
|
headerEmptyView?.isVisible = true
|
||||||
|
val list = homeViewModel.friendRecommendModeLiveData.value?.data?.toMutableList()
|
||||||
|
recommendTitleView?.isVisible = !list.isNullOrEmpty()
|
||||||
|
adapter.setNewData(list)
|
||||||
|
} else {
|
||||||
|
headerEmptyView?.isVisible = false
|
||||||
|
rvDelegate?.loadData(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
homeViewModel.friendRecommendModeLiveData.observe(this) {
|
||||||
|
if (headerEmptyView?.isVisible == true) {
|
||||||
|
recommendTitleView?.isVisible = !it.data.isNullOrEmpty()
|
||||||
|
adapter.setNewData(it.data?.toMutableList())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
if (homeViewModel.friendRecommendModeLiveData.value?.data.isNullOrEmpty()) {
|
||||||
|
homeViewModel.getFriendRecommendMore()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment.home
|
package com.nnbc123.app.home.fragment.home.party
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@@ -10,7 +10,7 @@ import com.nnbc123.app.avroom.activity.AVRoomActivity
|
|||||||
import com.nnbc123.app.base.BaseBindingFragment
|
import com.nnbc123.app.base.BaseBindingFragment
|
||||||
import com.nnbc123.app.databinding.HomePartyFragmentBinding
|
import com.nnbc123.app.databinding.HomePartyFragmentBinding
|
||||||
import com.nnbc123.app.home.HomeViewModel
|
import com.nnbc123.app.home.HomeViewModel
|
||||||
import com.nnbc123.app.home.activity.MoreRoomActivity
|
import com.nnbc123.app.game_room.GameRoomActivity
|
||||||
import com.nnbc123.app.home.adapter.HomePartyMessageAdapter
|
import com.nnbc123.app.home.adapter.HomePartyMessageAdapter
|
||||||
import com.nnbc123.app.home.dialog.RecommendRoomDialog
|
import com.nnbc123.app.home.dialog.RecommendRoomDialog
|
||||||
import com.nnbc123.app.home.helper.BannerHelper
|
import com.nnbc123.app.home.helper.BannerHelper
|
||||||
@@ -96,7 +96,7 @@ class PartyFragment : BaseBindingFragment<HomePartyFragmentBinding>() {
|
|||||||
|
|
||||||
private fun initResource() {
|
private fun initResource() {
|
||||||
mBinding.ivResourceMore.singleClick {
|
mBinding.ivResourceMore.singleClick {
|
||||||
MoreRoomActivity.start(requireContext())
|
GameRoomActivity.start(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
homeViewModel.homeChatPickLiveData.observe(viewLifecycleOwner) {
|
homeViewModel.homeChatPickLiveData.observe(viewLifecycleOwner) {
|
@@ -1,4 +1,4 @@
|
|||||||
package com.nnbc123.app.home.fragment.home
|
package com.nnbc123.app.home.fragment.home.party
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
BIN
app/src/main/res/drawable-xxhdpi/game_room_bg_friends.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/game_room_bg_friends.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
app/src/main/res/drawable-xxhdpi/game_room_ic_mic.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/game_room_ic_mic.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_bg_friends_empty.webp
Normal file
BIN
app/src/main/res/drawable-xxhdpi/home_bg_friends_empty.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
12
app/src/main/res/drawable/base_ic_back_light.xml
Normal file
12
app/src/main/res/drawable/base_ic_back_light.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="18dp"
|
||||||
|
android:height="18dp"
|
||||||
|
android:viewportWidth="18"
|
||||||
|
android:viewportHeight="18">
|
||||||
|
<path
|
||||||
|
android:pathData="M9.63,1.17C9.99,1.531 9.99,2.115 9.63,2.475L3.122,9L9.63,15.525C9.99,15.885 9.99,16.469 9.63,16.83C9.271,17.19 8.688,17.19 8.329,16.83L1.17,9.652C0.81,9.292 0.81,8.708 1.17,8.348L8.329,1.17C8.688,0.81 9.271,0.81 9.63,1.17Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:fillColor="#2B2D33"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/game_room_bg_avatar.xml
Normal file
10
app/src/main/res/drawable/game_room_bg_avatar.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="#ffffffff" />
|
||||||
|
<solid android:color="#99ffffff" />
|
||||||
|
<corners android:radius="13dp" />
|
||||||
|
|
||||||
|
</shape>
|
22
app/src/main/res/drawable/game_room_ic_add.xml
Normal file
22
app/src/main/res/drawable/game_room_ic_add.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="19dp"
|
||||||
|
android:height="20dp"
|
||||||
|
android:viewportWidth="19"
|
||||||
|
android:viewportHeight="20">
|
||||||
|
<path
|
||||||
|
android:pathData="M9.5,10m-9,0a9,9 0,1 1,18 0a9,9 0,1 1,-18 0"
|
||||||
|
android:strokeWidth="0.5"
|
||||||
|
android:fillColor="#FFDA24"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M9.5,10m-9,0a9,9 0,1 1,18 0a9,9 0,1 1,-18 0"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M9.5,5.5C10.052,5.5 10.5,5.948 10.5,6.5L10.5,9L13,9C13.552,9 14,9.448 14,10C14,10.552 13.552,11 13,11L10.5,11L10.5,13.5C10.5,14.052 10.052,14.5 9.5,14.5C8.948,14.5 8.5,14.052 8.5,13.5L8.5,11L6,11C5.448,11 5,10.552 5,10C5,9.448 5.448,9 6,9L8.5,9L8.5,6.5C8.5,5.948 8.948,5.5 9.5,5.5Z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
11
app/src/main/res/drawable/home_bg_friends_more_title.xml
Normal file
11
app/src/main/res/drawable/home_bg_friends_more_title.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:endColor="#00FFFFFF"
|
||||||
|
android:startColor="@color/white"
|
||||||
|
android:type="linear" />
|
||||||
|
<corners android:radius="1dp" />
|
||||||
|
</shape>
|
@@ -1,39 +1,53 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools">
|
<layout xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/white"
|
android:background="#F5F5F7"
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.nnbc123.app.base.TitleBar
|
<View
|
||||||
android:id="@+id/title_bar"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/home_bg_top"
|
||||||
|
app:layout_constraintDimensionRatio="375:250"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:paddingHorizontal="@dimen/dp_16"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/base_ic_back_light"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_top"
|
android:id="@+id/rv_top"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp" />
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="-7dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="@dimen/dp_5"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
app:layout_constraintDimensionRatio="375:67"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_back" />
|
||||||
|
|
||||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/refreshLayout"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_11"
|
||||||
|
android:layout_marginTop="@dimen/dp_11"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rv_top"
|
||||||
|
app:spanCount="2" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/recyclerView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
|
||||||
app:spanCount="2" />
|
|
||||||
|
|
||||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
144
app/src/main/res/layout/game_room_item_room.xml
Normal file
144
app/src/main/res/layout/game_room_item_room.xml
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_4"
|
||||||
|
android:layout_marginVertical="@dimen/dp_5">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintDimensionRatio="168:148"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:src="@drawable/default_cover" />
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.RectRoundImageView
|
||||||
|
android:id="@+id/iv_room_cover"
|
||||||
|
android:layout_width="@dimen/dp_40"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_bg"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/iv_bg"
|
||||||
|
app:type="circle"
|
||||||
|
tools:src="@drawable/default_cover" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_room_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_4"
|
||||||
|
android:layout_marginEnd="@dimen/dp_8"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="#2B2D33"
|
||||||
|
android:textSize="@dimen/dp_14"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_room_cover"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_bg"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/iv_room_cover"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_room_cover"
|
||||||
|
tools:text="Name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_message"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:layout_marginEnd="@dimen/dp_12"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="#696D7A"
|
||||||
|
android:textSize="@dimen/dp_11"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_bg"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_room_cover"
|
||||||
|
tools:text="MESSAGE - MESSAGE - MESSAGE" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_avatar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_22"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
|
android:layout_marginBottom="@dimen/dp_10"
|
||||||
|
android:background="@drawable/game_room_bg_avatar"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="@dimen/dp_6"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_bg">
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar_0"
|
||||||
|
android:layout_width="@dimen/dp_18"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:cborder_color="@color/white"
|
||||||
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar_1"
|
||||||
|
android:layout_width="@dimen/dp_18"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:cborder_color="@color/white"
|
||||||
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar_2"
|
||||||
|
android:layout_width="@dimen/dp_18"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:cborder_color="@color/white"
|
||||||
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar_3"
|
||||||
|
android:layout_width="@dimen/dp_18"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:cborder_color="@color/white"
|
||||||
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
|
<com.nnbc123.app.common.widget.CircleImageView
|
||||||
|
android:id="@+id/iv_avatar_4"
|
||||||
|
android:layout_width="@dimen/dp_18"
|
||||||
|
android:layout_height="@dimen/dp_18"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:src="@drawable/game_room_ic_add"
|
||||||
|
app:cborder_color="@color/white"
|
||||||
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_online_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
|
android:drawableStart="@drawable/ic_home_hot_hot"
|
||||||
|
android:drawablePadding="1dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="#696D7A"
|
||||||
|
android:textSize="@dimen/dp_11"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/layout_avatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_bg"
|
||||||
|
app:layout_constraintHorizontal_bias="1"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/layout_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/layout_avatar"
|
||||||
|
tools:text="99999" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
20
app/src/main/res/layout/game_room_item_tab.xml
Normal file
20
app/src/main/res/layout/game_room_item_tab.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="2.5dp"
|
||||||
|
tools:background="#F5F5F7"
|
||||||
|
tools:layout_height="67dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_cover"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintDimensionRatio="82:67"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:src="@drawable/default_cover" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view"
|
android:id="@+id/recycler_view"
|
||||||
|
android:clipChildren="false"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginHorizontal="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_5"
|
android:layout_marginTop="@dimen/dp_5"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="@dimen/dp_4"
|
|
||||||
android:layout_marginVertical="@dimen/dp_5"
|
android:layout_marginVertical="@dimen/dp_5"
|
||||||
tools:background="#F5F5F7">
|
tools:background="#F5F5F7">
|
||||||
|
|
||||||
|
84
app/src/main/res/layout/home_friends_list_item_empty.xml
Normal file
84
app/src/main/res/layout/home_friends_list_item_empty.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_icon"
|
||||||
|
android:layout_width="159dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="@dimen/dp_24"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/home_bg_friends_empty" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="@dimen/dp_3"
|
||||||
|
android:layout_marginBottom="@dimen/dp_28"
|
||||||
|
android:text="暂未找到合适的伙伴"
|
||||||
|
android:textColor="#696D7A"
|
||||||
|
android:textSize="@dimen/dp_14" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/layout_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="44dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="118dp"
|
||||||
|
android:background="@drawable/home_bg_friends_more_title"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_text">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
|
android:text="大神推荐"
|
||||||
|
android:textColor="#2B2D33"
|
||||||
|
android:textSize="@dimen/dp_14"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/v_line_left"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_28"
|
||||||
|
android:layout_marginEnd="@dimen/dp_20"
|
||||||
|
android:background="#E9EBF2"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_title"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/v_line_right"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_20"
|
||||||
|
android:layout_marginEnd="@dimen/dp_28"
|
||||||
|
android:background="#E9EBF2"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/tv_title"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</layout>
|
@@ -0,0 +1,20 @@
|
|||||||
|
package com.nnbc123.core.home.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/26 11:35
|
||||||
|
* Desc:首页-更多游戏-游戏
|
||||||
|
**/
|
||||||
|
data class HomeGameBean(
|
||||||
|
val backgroundPic: String? = null,
|
||||||
|
val createTime: String? = null,
|
||||||
|
val isShow: Boolean? = null,
|
||||||
|
val mgId: Long? = null,
|
||||||
|
val mgIdStr: String? = null,
|
||||||
|
val micNum: Int? = null,
|
||||||
|
val name: String? = null,
|
||||||
|
val pic: String? = null,
|
||||||
|
val remark: String? = null,
|
||||||
|
val seq: Int? = null,
|
||||||
|
val updateTime: String? = null,
|
||||||
|
val isFriendsType: Boolean? = false
|
||||||
|
)
|
@@ -0,0 +1,7 @@
|
|||||||
|
package com.nnbc123.core.home.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/26 11:32
|
||||||
|
* Desc:首页-更多游戏
|
||||||
|
**/
|
||||||
|
data class HomeGameInfo(val miniGames: List<HomeGameBean>?, val playRooms: List<HomeRoomInfo>?)
|
@@ -2,7 +2,7 @@ package com.nnbc123.core.home.bean
|
|||||||
|
|
||||||
data class ResourceInfo(
|
data class ResourceInfo(
|
||||||
val icon: String? = null,
|
val icon: String? = null,
|
||||||
val id: Int = 0,
|
val id: Long = 0,
|
||||||
val posSeq: Int? = null,
|
val posSeq: Int? = null,
|
||||||
val resourceContent: String? = null,
|
val resourceContent: String? = null,
|
||||||
val resourceType: Int = 0,
|
val resourceType: Int = 0,
|
||||||
|
@@ -128,9 +128,9 @@ object HomeModel : BaseModel() {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getResourceJumpInfo(id: Int): HomeRoomInfo? =
|
suspend fun getResourceJumpInfo(id: Long, type: Int): HomeRoomInfo? =
|
||||||
launchRequest {
|
launchRequest {
|
||||||
api.getResourceJumpInfo(id)
|
api.getResourceJumpInfo(id, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getHomeChatPick(): String? =
|
suspend fun getHomeChatPick(): String? =
|
||||||
@@ -232,6 +232,10 @@ object HomeModel : BaseModel() {
|
|||||||
api.getNewFriendList(gender, gameId)
|
api.getNewFriendList(gender, gameId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getFriendRecommendMore(): List<UserInfo>? =
|
||||||
|
launchRequest {
|
||||||
|
api.getFriendRecommendMore()
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getHomeGameTabListByLocal(): MutableList<HomeGameTab>? {
|
suspend fun getHomeGameTabListByLocal(): MutableList<HomeGameTab>? {
|
||||||
return DemoCache.readHomeGameTabList()
|
return DemoCache.readHomeGameTabList()
|
||||||
@@ -248,6 +252,11 @@ object HomeModel : BaseModel() {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getHomeGame(): HomeGameInfo? =
|
||||||
|
launchRequest {
|
||||||
|
api.getHomeGame()
|
||||||
|
}
|
||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
/**
|
/**
|
||||||
* 提交反馈
|
* 提交反馈
|
||||||
@@ -336,7 +345,7 @@ object HomeModel : BaseModel() {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("home/pickResource")
|
@GET("home/pickResource")
|
||||||
suspend fun getResourceJumpInfo(@Query("id") id: Int): ServiceResult<HomeRoomInfo>
|
suspend fun getResourceJumpInfo(@Query("id") id: Long, @Query("type") type: Int): ServiceResult<HomeRoomInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页资源位跳转
|
* 首页资源位跳转
|
||||||
@@ -513,6 +522,21 @@ object HomeModel : BaseModel() {
|
|||||||
*/
|
*/
|
||||||
@GET("/home/game/tab/list")
|
@GET("/home/game/tab/list")
|
||||||
suspend fun getHomeGameTabList(): ServiceResult<MutableList<HomeGameTab>>
|
suspend fun getHomeGameTabList(): ServiceResult<MutableList<HomeGameTab>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大神推荐
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/home/mahogany")
|
||||||
|
suspend fun getFriendRecommendMore(): ServiceResult<MutableList<UserInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/home/game")
|
||||||
|
suspend fun getHomeGame(): ServiceResult<HomeGameInfo>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -167,7 +167,7 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
|||||||
new MainTabInfo(
|
new MainTabInfo(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"动态",
|
"广场",
|
||||||
MainTabType.TAB_TYPE_SQUARE,
|
MainTabType.TAB_TYPE_SQUARE,
|
||||||
null
|
null
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user