[Modify]首页修改
This commit is contained in:
@@ -17,15 +17,15 @@ class HomeChatAdapter :
|
||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||
when(item.gender){
|
||||
0 ->{
|
||||
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
}
|
||||
1 ->{
|
||||
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
}
|
||||
2 ->{
|
||||
helper.getView<View>(R.id.mViewBg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_women)
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_women)
|
||||
}
|
||||
}
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.mCirImage), item.avatar)
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_avatar), item.avatar)
|
||||
}
|
||||
}
|
@@ -14,16 +14,14 @@ import com.yizhuan.xchat_android_core.utils.TextUtils
|
||||
* create by lvzebiao @2019/11/13
|
||||
*/
|
||||
class HomeHotAdapter :
|
||||
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_room_common) {
|
||||
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_room_recommend) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||
helper.apply {
|
||||
getView<ImageView>(R.id.iv_room_image).load(item.avatar)
|
||||
setText(R.id.tv_online_number, "${item.onlineNum}")
|
||||
setText(R.id.tv_room_title, item.title)
|
||||
setText(R.id.tv_id, "ID:${item.erbanNo}")
|
||||
}
|
||||
helper.setVisible(R.id.tv_in_pk, item.isCrossPking)
|
||||
helper.setGone(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
|
||||
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
|
||||
|
||||
|
@@ -0,0 +1,197 @@
|
||||
package com.yizhuan.erban.home.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.IReportConstants
|
||||
import com.yizhuan.erban.application.ReportManager
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
|
||||
import com.yizhuan.erban.base.BaseActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.databinding.FragmentAccompanyBinding
|
||||
import com.yizhuan.erban.databinding.FragmentRecommendBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
import com.yizhuan.erban.home.adapter.HomeChatAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeHotAdapter
|
||||
import com.yizhuan.erban.home.adapter.HomeTopAdapter
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTabMapInfo
|
||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
|
||||
import com.yizhuan.xchat_android_core.room.event.RoomShieldEvent
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import com.zhpan.bannerview.BannerViewPager
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* Peko首页
|
||||
*/
|
||||
class AccompanyFragment : BaseViewBindingFragment<FragmentAccompanyBinding>() {
|
||||
private lateinit var charAdapter: HomeChatAdapter
|
||||
private lateinit var roomHotAdapter: HomeHotAdapter
|
||||
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
//是否需要刷新接口进行屏蔽房间操作
|
||||
private var isShield = false
|
||||
|
||||
override fun init() {
|
||||
initRefreshView()
|
||||
initChatTab()
|
||||
initHotRoomTab()
|
||||
showGameGuide()
|
||||
|
||||
binding.ivGameGuide.setOnClickListener {
|
||||
//首页_扩列聊天-创建游戏房
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.NINE),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
CreateRoomDialog().apply { setGameVisible() }.show(context)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initRefreshView() {
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
binding.refreshLayout.finishRefresh()
|
||||
EventBus.getDefault().post(RefreshHomeDataEvent())
|
||||
}
|
||||
binding.refreshLayout.isEnableLoadmore = false
|
||||
binding.refreshLayout.isEnableOverScrollBounce = false
|
||||
}
|
||||
|
||||
private fun initChatTab() {
|
||||
charAdapter = HomeChatAdapter()
|
||||
charAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val homePlayInfo: HomeRoomInfo? = charAdapter.getItem(position)
|
||||
if (homePlayInfo != null) {
|
||||
//首页_扩列聊天-用户房间
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SEVEN),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
AVRoomActivity.startForFromType(
|
||||
mContext,
|
||||
homePlayInfo.uid,
|
||||
AVRoomActivity.FROM_TYPE_RECOMMEND
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.mRecyclerChat.adapter = charAdapter
|
||||
binding.mLiCreateRoom.setOnClickListener {
|
||||
//首页_扩列聊天-创建普通房
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.EIGHT),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
OpenRoomHelper.openRoom(context as BaseActivity?)
|
||||
}
|
||||
homeViewModel.homePlayInfoData.observe(this) {
|
||||
it?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
binding.mLiCreateRoom.visibility = View.GONE
|
||||
binding.mRecyclerChat.visibility = View.VISIBLE
|
||||
charAdapter.setNewData(it)
|
||||
} else {
|
||||
binding.mLiCreateRoom.visibility = View.VISIBLE
|
||||
binding.mRecyclerChat.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initHotRoomTab() {
|
||||
roomHotAdapter = HomeHotAdapter()
|
||||
roomHotAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val homePlayInfo: HomeRoomInfo? = roomHotAdapter.getItem(position)
|
||||
if (homePlayInfo != null) {
|
||||
//首页_房间派对
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TEN),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
AVRoomActivity.start(mContext, homePlayInfo.uid)
|
||||
}
|
||||
}
|
||||
binding.mRecyclerRoom.adapter = roomHotAdapter
|
||||
homeViewModel.homeHotRoomLiveData.observe(this) {
|
||||
it?.let {
|
||||
roomHotAdapter.setNewData(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLazyLoad() {
|
||||
super.onLazyLoad()
|
||||
loadData()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (isShield) {
|
||||
loadData()
|
||||
isShield = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadData() {
|
||||
homeViewModel.getHomePlayV2()
|
||||
homeViewModel.getHotRoom()
|
||||
}
|
||||
|
||||
private fun showGameGuide(){
|
||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||
if (userInfo?.isHasPermitRoom == true) {
|
||||
binding.ivGameGuide.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.ivGameGuide.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onLoginUserInfoUpdateEvent(event: LoginUserInfoUpdateEvent?) {
|
||||
showGameGuide()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
||||
if (isResumed) {
|
||||
loadData()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onRoomShieldEvent(event: RoomShieldEvent?) {
|
||||
isShield = true
|
||||
}
|
||||
|
||||
}
|
@@ -1,20 +1,15 @@
|
||||
package com.yizhuan.erban.home.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.application.IReportConstants
|
||||
import com.yizhuan.erban.application.ReportManager
|
||||
import com.yizhuan.erban.avroom.adapter.CommonVPAdapter
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.databinding.FragmentHomeBinding
|
||||
import com.yizhuan.erban.home.HomeViewModel
|
||||
@@ -28,9 +23,6 @@ import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.Commo
|
||||
import com.yizhuan.xchat_android_core.DemoCache
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo
|
||||
import com.yizhuan.xchat_android_library.common.SpConstants
|
||||
import com.yizhuan.xchat_android_library.common.util.Logger
|
||||
import com.yizhuan.xchat_android_library.common.util.SPUtils
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
/**
|
||||
@@ -50,11 +42,6 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
override fun init() {
|
||||
initTitleTab()
|
||||
initListener()
|
||||
homeViewModel.tagLiveData.observe(this) {
|
||||
it?.let {
|
||||
onGetHomeTagSuccess(it)
|
||||
}
|
||||
}
|
||||
homeViewModel.bannerLiveData.observe(this) {
|
||||
it?.let {
|
||||
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
|
||||
@@ -68,7 +55,6 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
}
|
||||
}
|
||||
}
|
||||
homeViewModel.getTagInfo()
|
||||
homeViewModel.getBannerInfo()
|
||||
}
|
||||
|
||||
@@ -128,36 +114,16 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
0
|
||||
)
|
||||
)
|
||||
mTabInfoList.add(
|
||||
HomeTagInfo(
|
||||
7,
|
||||
ResUtil.getString(R.string.home_fragment_homefragment_07),
|
||||
0
|
||||
)
|
||||
)
|
||||
mFragments.add(RecommendFragment::class.java)
|
||||
val homeTabInfo = SPUtils.getString(SpConstants.TAB_INFO_LIST, "")
|
||||
if (!TextUtils.isEmpty(homeTabInfo)) {
|
||||
val homeTagInfoList: List<HomeTagInfo> =
|
||||
Gson().fromJson(homeTabInfo, object : TypeToken<List<HomeTagInfo?>?>() {}.type)
|
||||
if (homeTagInfoList.isNotEmpty()) {
|
||||
for (i in homeTagInfoList.indices) {
|
||||
//过滤对象是空和没有标签名同时也没有子标签的情况
|
||||
var title: CharSequence?
|
||||
var name = homeTagInfoList[i].name
|
||||
if (name != null) {
|
||||
name = name.trim { it <= ' ' }
|
||||
}
|
||||
title = name
|
||||
mTabInfoList.add(homeTagInfoList[i])
|
||||
val fragment: Class<out Fragment> = when (title) {
|
||||
getString(R.string.home_fragment_partyfragment_01) -> {
|
||||
RoomLikeFragment::class.java
|
||||
}
|
||||
getString(R.string.home_fragment_partyfragment_02) -> {
|
||||
RoomGameFragment::class.java
|
||||
}
|
||||
else -> {
|
||||
RoomCommonFragment::class.java
|
||||
}
|
||||
}
|
||||
mFragments.add(fragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
mFragments.add(AccompanyFragment::class.java)
|
||||
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.setTitleWrapContent(false)
|
||||
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
||||
@@ -170,15 +136,7 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
binding.viewPager.adapter =
|
||||
object : FragmentStateAdapter(childFragmentManager, lifecycle) {
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
val tabEntity = mFragments[position].newInstance()
|
||||
val bundle = Bundle()
|
||||
if (mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_01)
|
||||
&& mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_02)
|
||||
) {
|
||||
bundle.putInt("tab_id", mTabInfoList[position].id)
|
||||
}
|
||||
tabEntity.arguments = bundle
|
||||
return tabEntity
|
||||
return mFragments[position].newInstance()
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
@@ -189,96 +147,6 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
||||
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
||||
}
|
||||
|
||||
private fun onGetHomeTagSuccess(tagInfo: List<HomeTagInfo>) {
|
||||
var changed = false
|
||||
mTabInfoList.filter { it.id != 6 }
|
||||
val homeTabInfo = SPUtils.getString(SpConstants.TAB_INFO_LIST, "")
|
||||
if (!TextUtils.isEmpty(homeTabInfo)) {
|
||||
val homeTagInfoList: List<HomeTagInfo> =
|
||||
Gson().fromJson(homeTabInfo, object : TypeToken<List<HomeTagInfo?>?>() {}.type)
|
||||
if (homeTagInfoList.isNotEmpty()) {
|
||||
if (homeTagInfoList != tagInfo) {
|
||||
changed = true
|
||||
}
|
||||
} else {
|
||||
changed = true
|
||||
}
|
||||
} else {
|
||||
changed = true
|
||||
}
|
||||
//只有HomeTagInfo发生改变才刷新数据
|
||||
if (changed) {
|
||||
Logger.info(TAG, "oldTabInfoList:change");
|
||||
mTabInfoList.clear()
|
||||
mFragments.clear()
|
||||
mTabInfoList.add(
|
||||
HomeTagInfo(
|
||||
6,
|
||||
ResUtil.getString(R.string.home_fragment_homefragment_04),
|
||||
0
|
||||
)
|
||||
)
|
||||
mFragments.add(RecommendFragment::class.java)
|
||||
for (i in tagInfo.indices) {
|
||||
//过滤对象是空和没有标签名同时也没有子标签的情况
|
||||
var title: CharSequence?
|
||||
var name = tagInfo[i].name
|
||||
if (name != null) {
|
||||
name = name.trim { it <= ' ' }
|
||||
}
|
||||
title = name
|
||||
mTabInfoList.add(tagInfo[i])
|
||||
val fragment: Class<out Fragment> = when (title) {
|
||||
getString(R.string.home_fragment_partyfragment_01) -> {
|
||||
RoomLikeFragment::class.java
|
||||
}
|
||||
getString(R.string.home_fragment_partyfragment_02) -> {
|
||||
RoomGameFragment::class.java
|
||||
}
|
||||
else -> {
|
||||
RoomCommonFragment::class.java
|
||||
}
|
||||
}
|
||||
mFragments.add(fragment)
|
||||
}
|
||||
|
||||
SPUtils.putString(
|
||||
SpConstants.TAB_INFO_LIST,
|
||||
Gson().toJson(mTabInfoList.filter { it.id != 6 })
|
||||
)
|
||||
|
||||
val commonNavigator = CommonNavigator(context)
|
||||
commonNavigator.setTitleWrapContent(false)
|
||||
commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
||||
commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
||||
val magicIndicatorAdapter = PartyMagicIndicatorAdapter(mTabInfoList.map { it.name })
|
||||
magicIndicatorAdapter.textSize = 14
|
||||
magicIndicatorAdapter.setOnItemSelectListener(this)
|
||||
commonNavigator.adapter = magicIndicatorAdapter
|
||||
binding.magicIndicator.navigator = commonNavigator
|
||||
binding.viewPager.adapter =
|
||||
object : FragmentStateAdapter(childFragmentManager, lifecycle) {
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
val tabEntity = mFragments[position].newInstance()
|
||||
val bundle = Bundle()
|
||||
if (mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_01)
|
||||
&& mTabInfoList[position].name != getString(R.string.home_fragment_partyfragment_02)
|
||||
) {
|
||||
bundle.putInt("tab_id", mTabInfoList[position].id)
|
||||
}
|
||||
tabEntity.arguments = bundle
|
||||
return tabEntity
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mFragments.size
|
||||
}
|
||||
|
||||
}
|
||||
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemSelect(position: Int, view: TextView?) {
|
||||
binding.viewPager.currentItem = position
|
||||
//点击顶部tab上报
|
||||
|
@@ -35,7 +35,6 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
* Peko首页
|
||||
*/
|
||||
class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
private lateinit var charAdapter: HomeChatAdapter
|
||||
private lateinit var roomHotAdapter: HomeHotAdapter
|
||||
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
@@ -45,20 +44,7 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
|
||||
override fun init() {
|
||||
initRefreshView()
|
||||
initChatTab()
|
||||
initHotRoomTab()
|
||||
showGameGuide()
|
||||
|
||||
binding.ivGameGuide.setOnClickListener {
|
||||
//首页_扩列聊天-创建游戏房
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.NINE),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
CreateRoomDialog().apply { setGameVisible() }.show(context)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initRefreshView() {
|
||||
@@ -70,51 +56,6 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
binding.refreshLayout.isEnableOverScrollBounce = false
|
||||
}
|
||||
|
||||
private fun initChatTab() {
|
||||
charAdapter = HomeChatAdapter()
|
||||
charAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val homePlayInfo: HomeRoomInfo? = charAdapter.getItem(position)
|
||||
if (homePlayInfo != null) {
|
||||
//首页_扩列聊天-用户房间
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SEVEN),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
AVRoomActivity.startForFromType(
|
||||
mContext,
|
||||
homePlayInfo.uid,
|
||||
AVRoomActivity.FROM_TYPE_RECOMMEND
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.mRecyclerChat.adapter = charAdapter
|
||||
binding.mLiCreateRoom.setOnClickListener {
|
||||
//首页_扩列聊天-创建普通房
|
||||
ReportManager.get().reportEvent(
|
||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.EIGHT),
|
||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
||||
)
|
||||
)
|
||||
OpenRoomHelper.openRoom(context as BaseActivity?)
|
||||
}
|
||||
homeViewModel.homePlayInfoData.observe(this) {
|
||||
it?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
binding.mLiCreateRoom.visibility = View.GONE
|
||||
binding.mRecyclerChat.visibility = View.VISIBLE
|
||||
charAdapter.setNewData(it)
|
||||
} else {
|
||||
binding.mLiCreateRoom.visibility = View.VISIBLE
|
||||
binding.mRecyclerChat.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initHotRoomTab() {
|
||||
roomHotAdapter = HomeHotAdapter()
|
||||
roomHotAdapter.onItemClickListener =
|
||||
@@ -153,24 +94,9 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
|
||||
}
|
||||
|
||||
private fun loadData() {
|
||||
homeViewModel.getHomePlayV2()
|
||||
homeViewModel.getHotRoom()
|
||||
}
|
||||
|
||||
private fun showGameGuide(){
|
||||
val userInfo = UserModel.get().cacheLoginUserInfo
|
||||
if (userInfo?.isHasPermitRoom == true) {
|
||||
binding.ivGameGuide.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivGameGuide.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onLoginUserInfoUpdateEvent(event: LoginUserInfoUpdateEvent?) {
|
||||
showGameGuide()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
||||
if (isResumed) {
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_recommend_weekly_list.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_recommend_weekly_list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
105
app/src/main/res/layout/fragment_accompany.xml
Normal file
105
app/src/main/res/layout/fragment_accompany.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?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">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="android.view.View.OnClickListener" />
|
||||
|
||||
</data>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llListChat"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mLiCreateRoom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/bg_home_chat"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:src="@drawable/ic_home_chat_add" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:text="@string/create_home_play"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecyclerChat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/ivGameGuide"
|
||||
android:src="@drawable/ic_game_guide"
|
||||
android:visibility="gone"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="75dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.yizhuan.xchat_android_library.common.widget.VpRecyclerView
|
||||
android:id="@+id/mRecyclerRoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:spanCount="2"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
</layout>
|
@@ -18,108 +18,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<com.yizhuan.xchat_android_library.common.widget.VpRecyclerView
|
||||
android:id="@+id/mRecyclerRoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/extender_column_chat"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llListChat"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mLiCreateRoom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/bg_home_chat"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:src="@drawable/ic_home_chat_add" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:text="@string/create_home_play"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecyclerChat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/ivGameGuide"
|
||||
android:src="@drawable/ic_game_guide"
|
||||
android:visibility="gone"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="75dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/extender_room_party"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.yizhuan.xchat_android_library.common.widget.VpRecyclerView
|
||||
android:id="@+id/mRecyclerRoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:spanCount="2"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" />
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
|
@@ -7,24 +7,43 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/mViewBg"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:background="@drawable/bg_home_chat_man"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="92dp"
|
||||
android:background="@drawable/bg_white_round_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_aperture"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/bg_home_chat_man"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/mCirImage"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:layout_constraintStart_toStartOf="@+id/mViewBg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/mViewBg"
|
||||
app:layout_constraintTop_toTopOf="@+id/mViewBg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/mViewBg"/>
|
||||
app:layout_constraintStart_toStartOf="@+id/view_aperture"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_aperture"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_aperture"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_aperture"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view_aperture"
|
||||
tools:text="音樂與你"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
77
app/src/main/res/layout/item_room_recommend.xml
Normal file
77
app/src/main/res/layout/item_room_recommend.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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_marginBottom="@dimen/dp_6"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<com.yizhuan.erban.common.widget.RectRoundImageView
|
||||
android:id="@+id/iv_room_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:type="round"
|
||||
app:borderRadius="@dimen/dp_14"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_top_list"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:background="@drawable/bg_recommend_weekly_list"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_room_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_room_image"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_room_image"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_room_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_room_image"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_room_image"
|
||||
tools:src="@drawable/tag_101" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_room_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_room_image"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_online_number"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_online_number"
|
||||
tools:text="@string/layout_item_room_common_02" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_online_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:drawablePadding="2dp"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="10sp"
|
||||
app:drawableStartCompat="@drawable/ic_home_hot_hot"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_room_image"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_room_image"
|
||||
tools:text="266" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -2081,9 +2081,10 @@
|
||||
<string name="home_fragment_homefragment_01">進入搜索頁</string>
|
||||
<string name="home_fragment_homefragment_02">首頁_榜單</string>
|
||||
<string name="home_fragment_homefragment_03">首頁_我的房間</string>
|
||||
<string name="home_fragment_homefragment_04">推薦</string>
|
||||
<string name="home_fragment_homefragment_04">熱門推薦</string>
|
||||
<string name="home_fragment_homefragment_05">派對</string>
|
||||
<string name="home_fragment_homefragment_06">直播</string>
|
||||
<string name="home_fragment_homefragment_07">優質陪伴</string>
|
||||
<string name="home_fragment_homeplayfragment_01">暫無數據</string>
|
||||
<string name="home_fragment_homeplayfragment_02">點擊組隊開黑進入房間</string>
|
||||
<string name="home_fragment_livefragment_01">曾經看過的人</string>
|
||||
|
Reference in New Issue
Block a user