Resolve GHZSCY-5310 "Feat/ pr"
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IMiniGameRecentlyPlayedProvider
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
|
||||
@Route(path = RouteConsts.provider.miniGameRecentPlayed, name = "MiniGameRecentlyPlayed暴露服务")
|
||||
class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
|
||||
override fun clearMiniGameRecentlyPlayed(gameType: String) {
|
||||
MiniGameRecentlyPlayUseCase.clearRecentlyPlayedMiniGameList(gameType)
|
||||
}
|
||||
|
||||
override fun refreshQQMiniRecentPlayed() {
|
||||
MiniGameRecentlyPlayUseCase.loadRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// no implement
|
||||
}
|
||||
}
|
||||
@ -63,9 +63,11 @@ class DiscoveryAdapter(
|
||||
itemData.interestCardLabels != null -> {
|
||||
ITEM_RECOMMEND_INTEREST
|
||||
}
|
||||
|
||||
itemData.interestImageCardLabel != null -> {
|
||||
ITEM_RECOMMEND_INTEREST_IMAGE
|
||||
}
|
||||
|
||||
else -> {
|
||||
ItemViewType.GAME_NORMAL
|
||||
}
|
||||
@ -90,18 +92,23 @@ class DiscoveryAdapter(
|
||||
ItemViewType.GAME_NORMAL -> {
|
||||
DiscoveryGameViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
ItemViewType.ITEM_FOOTER -> {
|
||||
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
|
||||
}
|
||||
|
||||
ITEM_DIRECT_GAME_BLOCK -> {
|
||||
DirectGameBlockViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
ITEM_RECOMMEND_INTEREST -> {
|
||||
RecommendInterestViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
ITEM_RECOMMEND_INTEREST_IMAGE -> {
|
||||
RecommendInterestImageViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
else -> {
|
||||
throw NullPointerException()
|
||||
}
|
||||
@ -139,6 +146,12 @@ class DiscoveryAdapter(
|
||||
mExposureEventSparseArray.put(position, event)
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"游戏",
|
||||
"详情页",
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
)
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
mContext,
|
||||
gameEntity,
|
||||
@ -159,8 +172,16 @@ class DiscoveryAdapter(
|
||||
StringUtils.buildString("(${mEntrance}", "-列表[", (position).toString(), "])"),
|
||||
location = StringUtils.buildString(mEntrance, ":", gameEntity.name),
|
||||
traceEvent = event
|
||||
)
|
||||
) {
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"按钮",
|
||||
"详情页",
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is RecommendInterestViewHolder -> {
|
||||
holder.binding.root.setBackgroundColor(R.color.ui_surface.toColor(mContext))
|
||||
holder.binding.backgroundView.background = R.drawable.bg_shape_space_radius_8.toDrawable(mContext)
|
||||
@ -175,24 +196,42 @@ class DiscoveryAdapter(
|
||||
labels[index].text = labels[index].linkText
|
||||
labelTv.text = labels[index].title
|
||||
labelTv.setOnClickListener {
|
||||
DirectUtils.directToLinkPage(holder.binding.root.context, labels[index], mEntrance, "")
|
||||
val link = labels[index]
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"内容标签",
|
||||
"详情页",
|
||||
linkType = link.type ?: "",
|
||||
linkId = link.link ?: "",
|
||||
linkText = link.text ?: "",
|
||||
buttonType = link.title ?: ""
|
||||
)
|
||||
DirectUtils.directToLinkPage(holder.binding.root.context, link, mEntrance, "")
|
||||
logDiscoverPageRecommendedInterestCardClick(
|
||||
mEntityList[position].cardPosition,
|
||||
labels[index]
|
||||
link
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is RecommendInterestImageViewHolder -> {
|
||||
holder.binding.root.setBackgroundColor(R.color.ui_surface.toColor(mContext))
|
||||
val label = mEntityList[position].interestImageCardLabel ?: return
|
||||
label.text = label.linkText
|
||||
holder.binding.root.setOnClickListener {
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"内容标签",
|
||||
"详情页",
|
||||
linkType = label.type ?: "",
|
||||
linkId = label.link ?: "",
|
||||
linkText = label.text ?: "",
|
||||
)
|
||||
DirectUtils.directToLinkPage(holder.binding.root.context, label, mEntrance, "")
|
||||
logDiscoverPageRecommendedInterestCardClick(mEntityList[position].cardPosition, label)
|
||||
}
|
||||
}
|
||||
|
||||
is DirectGameBlockViewHolder -> {
|
||||
holder.binding.run {
|
||||
val userInterestedGame = Config.getUserInterestedGame()
|
||||
@ -202,6 +241,10 @@ class DiscoveryAdapter(
|
||||
interestedGameTv.goneIf(!userInterestedGame) {
|
||||
interestedGameTv.text = mContext.getString(R.string.interested_game_footer_hint).fromHtml()
|
||||
interestedGameTv.setOnClickListener {
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"偏好设置",
|
||||
"详情页",
|
||||
)
|
||||
mContext.ifLogin("发现页-底部") {
|
||||
mFragment.startActivityForResult(
|
||||
InterestedGameActivity.getIntent(
|
||||
@ -215,8 +258,23 @@ class DiscoveryAdapter(
|
||||
}
|
||||
}
|
||||
recommendIv.setOnClickListener {
|
||||
|
||||
val blockData = HomeBottomBarHelper.getDefaultGameBarData()
|
||||
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mBaseExposureSource, mEntrance))
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
"内容标签",
|
||||
"详情页",
|
||||
linkType = blockData.type ?: "",
|
||||
linkId = blockData.link ?: "",
|
||||
linkText = blockData.text ?: ""
|
||||
)
|
||||
mContext.startActivity(
|
||||
BlockActivity.getIntent(
|
||||
mContext,
|
||||
blockData,
|
||||
mBaseExposureSource,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
NewFlatLogUtils.logDiscoverPageJumpGamesLibraries()
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,8 +10,12 @@ data class MultiTabNav(
|
||||
val id: String = "",
|
||||
val title: String = "",
|
||||
@SerializedName("link_multi_tab_nav")
|
||||
val linkMultiTabNav: List<LinkMultiTabNav> = ArrayList()
|
||||
private val _linkMultiTabNav: List<LinkMultiTabNav>?
|
||||
) {
|
||||
|
||||
val linkMultiTabNav:List<LinkMultiTabNav>
|
||||
get() = _linkMultiTabNav?: emptyList()
|
||||
|
||||
data class LinkMultiTabNav(
|
||||
@SerializedName("_id")
|
||||
val id: String = "",
|
||||
|
||||
@ -177,6 +177,20 @@ class GameFragmentAdapter(
|
||||
return ItemViewType.LOADING
|
||||
}
|
||||
|
||||
override fun onViewAttachedToWindow(holder: ViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
if (holder is QGameRecentlyPlayViewHolder) {
|
||||
holder.onAttached()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(holder: ViewHolder) {
|
||||
super.onViewDetachedFromWindow(holder)
|
||||
if (holder is QGameRecentlyPlayViewHolder) {
|
||||
holder.onDetached()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return when (viewType) {
|
||||
// 轮播图+导航栏+专题入口
|
||||
@ -195,7 +209,7 @@ class GameFragmentAdapter(
|
||||
ItemViewType.GAME_SUBJECT -> GameHorizontalListViewHolder(parent.toBinding())
|
||||
// 游戏专题-横屏滑动
|
||||
ItemViewType.GAME_SUBJECT_SLIDE -> GameHorizontalSlideListViewHolder(parent.toBinding())
|
||||
ItemViewType.QQ_GAME_SUBJECT_SLIDE -> QGameRecentlyPlayViewHolder(parent.toBinding())
|
||||
ItemViewType.QQ_GAME_SUBJECT_SLIDE -> QGameRecentlyPlayViewHolder(mLifecycleOwner, parent.toBinding())
|
||||
// 正常游戏
|
||||
ItemViewType.GAME_NORMAL -> GameItemViewHolder(parent.toBinding())
|
||||
// 游戏专题-大图-显示/只显示
|
||||
|
||||
@ -69,6 +69,7 @@ class CustomPageViewModel(
|
||||
|
||||
private val _dataList = MediatorLiveData<List<CustomPageItem>>().apply {
|
||||
addSource(repository.recentMiniGamesItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.recentQqMiniGamesItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.customDiscoverItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.recentGamesItemLiveData, ::notifyItemChanged)
|
||||
addSource(repository.customPluginItemLiveData, ::notifyItemChanged)
|
||||
|
||||
@ -63,6 +63,7 @@ class CustomDiscoverCardGameAdapter(
|
||||
holder.bindGameItem(gameEntity)
|
||||
holder.itemView.setBackgroundColor(R.color.transparent.toColor(context))
|
||||
holder.itemView.setOnClickListener {
|
||||
childEventHelper.trackGameExploreClick("游戏", game = gameEntity)
|
||||
childEventHelper.navigateToGameDetailPageByGame(position, gameEntity)
|
||||
}
|
||||
holder.itemView.setOnLongClickListener {
|
||||
@ -81,6 +82,7 @@ class CustomDiscoverCardGameAdapter(
|
||||
location = StringUtils.buildString(entrance, ":", gameEntity.name),
|
||||
traceEvent = gameEntity.exposureEvent
|
||||
) {
|
||||
childEventHelper.trackGameExploreClick("按钮", game = gameEntity)
|
||||
childEventHelper.onDownloadButtonClick(position, gameEntity)
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ import com.gh.common.util.DownloadItemUtils.setOnClickListener
|
||||
import com.gh.common.util.DownloadItemUtils.updateItem
|
||||
import com.gh.common.util.HomePluggableHelper
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
import com.gh.gamecenter.common.constant.ItemViewType
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
@ -27,8 +26,8 @@ import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.gamecenter.home.HomeDividerViewHolder
|
||||
import com.gh.gamecenter.home.HomeFragmentAdapter
|
||||
import com.gh.gamecenter.home.PluginDisplayStatus
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.home.custom.viewholder.CustomGameItemViewHolder
|
||||
import com.gh.gamecenter.home.custom.viewholder.CustomGamePluggableViewHolder
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -131,6 +130,7 @@ class CustomGamePluginAdapter(
|
||||
"游戏-专题",
|
||||
gameEntity.name
|
||||
)
|
||||
childEventHelper.trackPluginAreaClick("游戏", gameEntity)
|
||||
childEventHelper.navigateToGameDetailPageByGame(1, gameEntity)
|
||||
}
|
||||
|
||||
@ -145,6 +145,7 @@ class CustomGamePluginAdapter(
|
||||
location = StringUtils.buildString("游戏-专题-", "插件化", ":", gameEntity.name),
|
||||
traceEvent = gameEntity.exposureEvent,
|
||||
) {
|
||||
childEventHelper.trackPluginAreaClick("按钮", gameEntity)
|
||||
childEventHelper.onDownloadButtonClick(1, gameEntity)
|
||||
}
|
||||
updateItem(
|
||||
|
||||
@ -10,6 +10,7 @@ import com.gh.gamecenter.common.entity.IconFloat
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.databinding.ItemHomeVgameRefactorBinding
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.vspace.VGameItemData
|
||||
import com.gh.vspace.VHelper
|
||||
@ -17,7 +18,8 @@ import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
|
||||
class CustomHomeRecentVGameAdapter(
|
||||
context: Context
|
||||
context: Context,
|
||||
private val childEventHelper: OtherItemEventHelper
|
||||
) : CustomBaseChildAdapter<VGameItemData, CustomHomeRecentVGameAdapter.HomeRecentVGameItemViewHolder>(context) {
|
||||
|
||||
override fun getKey(t: VGameItemData): String {
|
||||
@ -28,7 +30,7 @@ class CustomHomeRecentVGameAdapter(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): HomeRecentVGameItemViewHolder {
|
||||
return HomeRecentVGameItemViewHolder(parent.toBinding())
|
||||
return HomeRecentVGameItemViewHolder(parent.toBinding(), childEventHelper)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: HomeRecentVGameItemViewHolder, position: Int) {
|
||||
@ -46,7 +48,10 @@ class CustomHomeRecentVGameAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
class HomeRecentVGameItemViewHolder(private var binding: ItemHomeVgameRefactorBinding) :
|
||||
class HomeRecentVGameItemViewHolder(
|
||||
private var binding: ItemHomeVgameRefactorBinding,
|
||||
private val childEventHelper: OtherItemEventHelper
|
||||
) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bindView(entity: VGameItemData) {
|
||||
@ -64,10 +69,14 @@ class CustomHomeRecentVGameAdapter(
|
||||
binding.gameIconIv.setTag(R.string.app_name, entity.downloadEntity.packageName)
|
||||
}
|
||||
|
||||
updateViewByStatus(binding, entity)
|
||||
updateViewByStatus(binding, entity, childEventHelper)
|
||||
}
|
||||
|
||||
private fun updateViewByStatus(binding: ItemHomeVgameRefactorBinding, itemData: VGameItemData) {
|
||||
private fun updateViewByStatus(
|
||||
binding: ItemHomeVgameRefactorBinding,
|
||||
itemData: VGameItemData,
|
||||
childEventHelper: OtherItemEventHelper
|
||||
) {
|
||||
val downloadEntity = itemData.downloadEntity
|
||||
|
||||
itemData.refresh()
|
||||
@ -76,6 +85,7 @@ class CustomHomeRecentVGameAdapter(
|
||||
DownloadStatus.done -> {
|
||||
if (itemData.shouldShowUpdate) {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
PackagesManager.getUpdateList()
|
||||
.firstOrNull { it.id == downloadEntity.gameId }
|
||||
?.let {
|
||||
@ -84,6 +94,7 @@ class CustomHomeRecentVGameAdapter(
|
||||
}
|
||||
} else {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
if (!VHelper.isInstalled(downloadEntity.packageName)) {
|
||||
NewFlatLogUtils.logGameInstall(
|
||||
downloadEntity.gameId,
|
||||
@ -110,10 +121,12 @@ class CustomHomeRecentVGameAdapter(
|
||||
|
||||
if (downloadEntity.status == DownloadStatus.waiting) {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
ToastUtils.toast("最多只能同时下载三个任务,请稍等")
|
||||
}
|
||||
} else {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
DownloadManager.getInstance().resume(downloadEntity, false)
|
||||
}
|
||||
}
|
||||
@ -124,6 +137,7 @@ class CustomHomeRecentVGameAdapter(
|
||||
binding.progressBar.progressDrawable =
|
||||
R.drawable.bg_home_vgame_progress_active.toDrawable()
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
DownloadManager.getInstance().pause(downloadEntity.url)
|
||||
}
|
||||
}
|
||||
@ -140,12 +154,14 @@ class CustomHomeRecentVGameAdapter(
|
||||
DownloadStatus.unavailable,
|
||||
DownloadStatus.overflow -> {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
DownloadManager.getInstance().resume(downloadEntity, false)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.root.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("游戏", downloadEntity)
|
||||
ToastUtils.showToast(downloadEntity.status.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +100,14 @@ class CustomPageAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
is CustomRecentMiniGamesItem -> {
|
||||
is CustomRecentWeChatMiniGamesItem -> {
|
||||
if (item.data.isNotEmpty()) {
|
||||
_firstShowPosition.value = index
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
is CustomRecentQqMiniGamesItem -> {
|
||||
if (item.data.isNotEmpty()) {
|
||||
_firstShowPosition.value = index
|
||||
return
|
||||
|
||||
@ -7,6 +7,7 @@ import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.home.custom.model.CustomSubjectCollectionItem
|
||||
import com.gh.gamecenter.home.custom.tracker.OtherItemTracker
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
class OtherItemEventHelper(
|
||||
viewModel: CustomPageViewModel
|
||||
@ -71,10 +72,29 @@ class OtherItemEventHelper(
|
||||
}
|
||||
|
||||
fun navigateToInterestedGamePage() {
|
||||
trackGameExploreClick("偏好设置")
|
||||
viewModel.navigateToInterestedGamePage(_item)
|
||||
}
|
||||
|
||||
fun navigateToDiscoveryPage() {
|
||||
trackGameExploreClick("全部")
|
||||
viewModel.navigateToDiscoveryPage(_item)
|
||||
}
|
||||
|
||||
fun trackPluginAreaClick(text: String, game: GameEntity?) {
|
||||
tracker.trackPluginAreaClick(text, game)
|
||||
}
|
||||
|
||||
fun trackCWRecentlyPlayedClick(text: String, downloadEntity: DownloadEntity?) {
|
||||
tracker.trackCWRecentlyPlayedClick(text, downloadEntity)
|
||||
}
|
||||
|
||||
fun trackGameExploreClick(
|
||||
text: String,
|
||||
buttonType: String = "",
|
||||
game: GameEntity? = null,
|
||||
linkEntity: LinkEntity? = null
|
||||
) {
|
||||
tracker.trackGameExploreClick(text, buttonType, game, linkEntity)
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,27 @@
|
||||
package com.gh.gamecenter.home.custom.eventlistener
|
||||
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.tracker.SubjectTracker
|
||||
|
||||
class RecentMiniGameItemEventHelper (viewModel: CustomPageViewModel
|
||||
class RecentMiniGameItemEventHelper(
|
||||
viewModel: CustomPageViewModel
|
||||
) : CustomPageItemChildEventHelper(viewModel) {
|
||||
|
||||
private val tracker = SubjectTracker(viewModel.pageLocation)
|
||||
|
||||
fun navigateToGameDetailPage(position: Int, gameEntity: GameEntity) {
|
||||
viewModel.navigateToGameDetailPageByGame(_item, position, gameEntity)
|
||||
tracker.trackMiniGameClick(_item, gameEntity)
|
||||
if (gameEntity.isQQMiniGame()) {
|
||||
tracker.trackQqGameRecentlyPlayedClick("游戏", gameEntity)
|
||||
} else {
|
||||
tracker.trackMiniGameClick(_item, gameEntity)
|
||||
}
|
||||
}
|
||||
|
||||
fun navigateToLinkPage(link: LinkEntity) {
|
||||
tracker.trackQqGameRecentlyPlayedClick("更多", null)
|
||||
viewModel.navigateToLinkPage(_item, link, "", null)
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,9 @@ class CustomPageData(
|
||||
@SerializedName("link_wechat_game_column_detail")
|
||||
val wechatMiniGameColumn: SubjectEntity? = null,
|
||||
@SerializedName("link_common_collection")
|
||||
val linkCommonCollection: CommonContentCollection? = null
|
||||
val linkCommonCollection: CommonContentCollection? = null,
|
||||
@SerializedName("link_qq_game_recently_played")
|
||||
val linkQqGameRecentlyPlayed: LinkQqGameRecentlyPlayed? = null
|
||||
) {
|
||||
// 游戏专题
|
||||
val gameSubjectEntity: SubjectEntity?
|
||||
@ -661,6 +663,17 @@ class CustomPageData(
|
||||
)
|
||||
}
|
||||
|
||||
data class LinkQqGameRecentlyPlayed(
|
||||
@SerializedName("home")
|
||||
private val _home: String? = null,
|
||||
@SerializedName("more_link")
|
||||
val moreLink: LinkEntity? = null
|
||||
) {
|
||||
|
||||
val home: String
|
||||
get() = _home ?: ""
|
||||
}
|
||||
|
||||
data class RecommendCard(
|
||||
@SerializedName("_id")
|
||||
private val _id: String? = null,
|
||||
|
||||
@ -595,8 +595,8 @@ data class CustomRecentGamesItem(
|
||||
}
|
||||
|
||||
|
||||
// 最近在玩
|
||||
data class CustomRecentMiniGamesItem(
|
||||
// 微信小游戏-最近在玩
|
||||
data class CustomRecentWeChatMiniGamesItem(
|
||||
private val _link: LinkEntity,
|
||||
val data: List<GameEntity>,
|
||||
private val _position: Int,
|
||||
@ -607,13 +607,37 @@ data class CustomRecentMiniGamesItem(
|
||||
get() = CUSTOM_PAGE_ITEM_TYPE_MINI_GAME_RECENT_PLAY
|
||||
|
||||
override fun doAreContentsTheSames(other: CustomPageItem): Boolean {
|
||||
return other is CustomRecentMiniGamesItem
|
||||
return other is CustomRecentWeChatMiniGamesItem
|
||||
&& data == other.data
|
||||
&& position == other.position
|
||||
&& componentPosition == other.componentPosition
|
||||
}
|
||||
}
|
||||
|
||||
// qq小游戏-最近在玩
|
||||
data class CustomRecentQqMiniGamesItem(
|
||||
private val _link: LinkEntity,
|
||||
val data: List<GameEntity>,
|
||||
val linkQqGameRecentlyPlayed: CustomPageData.LinkQqGameRecentlyPlayed,
|
||||
private val _position: Int,
|
||||
private val _componentPosition: Int
|
||||
) : CustomPageItem(_link, _position, _componentPosition) {
|
||||
|
||||
override val itemType: Int
|
||||
get() = CUSTOM_PAGE_ITEM_TYPE_MINI_GAME_RECENT_PLAY
|
||||
|
||||
override fun doAreContentsTheSames(other: CustomPageItem): Boolean {
|
||||
return other is CustomRecentQqMiniGamesItem
|
||||
&& data == other.data
|
||||
&& linkQqGameRecentlyPlayed.home == other.linkQqGameRecentlyPlayed.home
|
||||
&& linkQqGameRecentlyPlayed.moreLink?.type == other.linkQqGameRecentlyPlayed.moreLink?.type
|
||||
&& linkQqGameRecentlyPlayed.moreLink?.link == other.linkQqGameRecentlyPlayed.moreLink?.link
|
||||
&& linkQqGameRecentlyPlayed.moreLink?.text == other.linkQqGameRecentlyPlayed.moreLink?.text
|
||||
&& position == other.position
|
||||
&& componentPosition == other.componentPosition
|
||||
}
|
||||
}
|
||||
|
||||
// 插件化区域
|
||||
data class CustomPluginItem(
|
||||
private val _link: LinkEntity,
|
||||
|
||||
@ -78,9 +78,9 @@ class CustomPageRepository private constructor(
|
||||
|
||||
private var recentItem: CustomRecentGamesItem? = null
|
||||
|
||||
private var recentQQItem: CustomRecentMiniGamesItem? = null
|
||||
private var recentQQItem: CustomRecentQqMiniGamesItem? = null
|
||||
|
||||
private var recentWechatItem: CustomRecentMiniGamesItem? = null
|
||||
private var recentWechatItem: CustomRecentWeChatMiniGamesItem? = null
|
||||
|
||||
private var pluginItem: CustomPluginItem? = null
|
||||
|
||||
@ -107,16 +107,20 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
val recentGamesItemLiveData: LiveData<CustomRecentGamesItem> = _recentGamesItemLiveData
|
||||
|
||||
private val _recentMiniGamesItemLiveData = MediatorLiveData<CustomRecentMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData) {
|
||||
refreshRecentQQMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
private val _recentMiniGamesItemLiveData = MediatorLiveData<CustomRecentWeChatMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.wechatRecentGamesItemLiveData) {
|
||||
refreshRecentWechatMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
|
||||
val recentMiniGamesItemLiveData: LiveData<CustomRecentMiniGamesItem> = _recentMiniGamesItemLiveData
|
||||
val recentMiniGamesItemLiveData: LiveData<CustomRecentWeChatMiniGamesItem> = _recentMiniGamesItemLiveData
|
||||
|
||||
private val _recentQqMiniGamesItemLiveData = MediatorLiveData<CustomRecentQqMiniGamesItem>().apply {
|
||||
addSource(MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData) {
|
||||
refreshRecentQQMiniGameIfNeed(it)?.let(this::setValue)
|
||||
}
|
||||
}
|
||||
val recentQqMiniGamesItemLiveData: LiveData<CustomRecentQqMiniGamesItem> = _recentQqMiniGamesItemLiveData
|
||||
|
||||
private val _customDiscoverItemLiveData = MediatorLiveData<CustomDiscoverCardItem>().apply {
|
||||
addSource(shareRepository.discoverData) {
|
||||
@ -160,16 +164,23 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshRecentQQMiniGameIfNeed(list: List<GameEntity>): CustomRecentMiniGamesItem? {
|
||||
private fun refreshRecentQQMiniGameIfNeed(list: List<GameEntity>): CustomRecentQqMiniGamesItem? {
|
||||
return recentQQItem?.let {
|
||||
recentQQItem = CustomRecentMiniGamesItem(it.link, list, it.position, it.componentPosition)
|
||||
recentQQItem =
|
||||
CustomRecentQqMiniGamesItem(
|
||||
it.link,
|
||||
list,
|
||||
it.linkQqGameRecentlyPlayed,
|
||||
it.position,
|
||||
it.componentPosition
|
||||
)
|
||||
recentQQItem
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshRecentWechatMiniGameIfNeed(list: List<GameEntity>): CustomRecentMiniGamesItem? {
|
||||
private fun refreshRecentWechatMiniGameIfNeed(list: List<GameEntity>): CustomRecentWeChatMiniGamesItem? {
|
||||
return recentWechatItem?.let {
|
||||
recentWechatItem = CustomRecentMiniGamesItem(it.link, list, it.position, it.componentPosition)
|
||||
recentWechatItem = CustomRecentWeChatMiniGamesItem(it.link, list, it.position, it.componentPosition)
|
||||
recentWechatItem
|
||||
}
|
||||
}
|
||||
@ -353,26 +364,31 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
item.link.type == CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED ||
|
||||
item.link.type == CUSTOM_LINK_TYPE_QQ_GAME_RECENTLY_PLAYED -> {
|
||||
// 微信小游戏-最近在玩/QQ小游戏-最近在玩(需要用户登录才显示)
|
||||
val gameType = if (item.link.type == CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED) {
|
||||
Constants.WECHAT_MINI_GAME
|
||||
} else {
|
||||
Constants.QQ_MINI_GAME
|
||||
item.link.type == CUSTOM_LINK_TYPE_QQ_GAME_RECENTLY_PLAYED -> {
|
||||
//QQ小游戏-最近在玩(需要用户登录才显示)
|
||||
val linkQqGameRecentlyPlayed = item.linkQqGameRecentlyPlayed
|
||||
if (linkQqGameRecentlyPlayed != null) {
|
||||
recentQQItem = CustomRecentQqMiniGamesItem(
|
||||
item.link,
|
||||
MiniGameRecentlyPlayUseCase.getRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME),
|
||||
linkQqGameRecentlyPlayed,
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
).also(list::add)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
val recentItem = CustomRecentMiniGamesItem(
|
||||
|
||||
}
|
||||
|
||||
item.link.type == CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED -> {
|
||||
// 微信小游戏-最近在玩
|
||||
recentWechatItem = CustomRecentWeChatMiniGamesItem(
|
||||
item.link,
|
||||
MiniGameRecentlyPlayUseCase.getRecentlyPlayedMiniGameList(gameType),
|
||||
MiniGameRecentlyPlayUseCase.getRecentlyPlayedMiniGameList(Constants.WECHAT_MINI_GAME),
|
||||
pageInfo.position,
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
if (item.link.type == CUSTOM_LINK_TYPE_WECHAT_GAME_RECENTLY_PLAYED) {
|
||||
recentWechatItem = recentItem
|
||||
} else {
|
||||
recentQQItem = recentItem
|
||||
}
|
||||
list.add(recentItem)
|
||||
).also(list::add)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.gh.gamecenter.home.custom.tracker
|
||||
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PageLocation
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
class OtherItemTracker(private val pageLocation: PageLocation) {
|
||||
|
||||
@ -21,4 +23,59 @@ class OtherItemTracker(private val pageLocation: PageLocation) {
|
||||
link.text ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
fun trackPluginAreaClick(text: String, game: GameEntity?) {
|
||||
SensorsBridge.trackPluginAreaClick(
|
||||
text,
|
||||
pageLocation.bottomTab,
|
||||
pageLocation.severalTabPageId,
|
||||
pageLocation.severalTabPageName,
|
||||
pageLocation.tabPosition,
|
||||
pageLocation.tabContent,
|
||||
pageLocation.pageId,
|
||||
pageLocation.pageName,
|
||||
game?.id ?: "",
|
||||
game?.name ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
fun trackCWRecentlyPlayedClick(text: String, downloadEntity: DownloadEntity?) {
|
||||
SensorsBridge.trackCWRecentlyPlayedClick(
|
||||
text,
|
||||
pageLocation.bottomTab,
|
||||
pageLocation.severalTabPageId,
|
||||
pageLocation.severalTabPageName,
|
||||
pageLocation.tabPosition,
|
||||
pageLocation.tabContent,
|
||||
pageLocation.pageId,
|
||||
pageLocation.pageName,
|
||||
downloadEntity?.gameId ?: "",
|
||||
downloadEntity?.name ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
fun trackGameExploreClick(
|
||||
text: String,
|
||||
buttonType: String = "",
|
||||
game: GameEntity? = null,
|
||||
link: LinkEntity? = null
|
||||
) {
|
||||
SensorsBridge.trackGameExploreClick(
|
||||
text,
|
||||
"首页",
|
||||
pageLocation.bottomTab,
|
||||
pageLocation.severalTabPageId,
|
||||
pageLocation.severalTabPageName,
|
||||
pageLocation.tabPosition,
|
||||
pageLocation.tabContent,
|
||||
pageLocation.pageId,
|
||||
pageLocation.pageName,
|
||||
game?.id ?: "",
|
||||
game?.name ?: "",
|
||||
link?.type ?: "",
|
||||
link?.link ?: "",
|
||||
link?.text ?: "",
|
||||
buttonType
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -65,9 +65,24 @@ class SubjectTracker(private val pageLocation: PageLocation) {
|
||||
pageLocation.pageName,
|
||||
subject?.id ?: "",
|
||||
subject?.name ?: "",
|
||||
"自定义页面",
|
||||
"最近在玩",
|
||||
item.componentStyle,
|
||||
"",
|
||||
)
|
||||
}
|
||||
|
||||
fun trackQqGameRecentlyPlayedClick(text: String, game: GameEntity?) {
|
||||
SensorsBridge.trackQqGameRecentlyPlayedClick(
|
||||
text,
|
||||
pageLocation.bottomTab,
|
||||
pageLocation.severalTabPageId,
|
||||
pageLocation.severalTabPageName,
|
||||
pageLocation.tabPosition,
|
||||
pageLocation.tabContent,
|
||||
pageLocation.pageId,
|
||||
pageLocation.pageName,
|
||||
game?.id ?: "",
|
||||
game?.name ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ import java.util.*
|
||||
|
||||
/**
|
||||
* Created by khy on 15/08/17.
|
||||
* 游戏插件模块
|
||||
* 插件化区域
|
||||
*/
|
||||
class CustomGamePluginViewHolder(
|
||||
private val makeItemBackgroundTransparent: Boolean,
|
||||
@ -140,6 +140,14 @@ class CustomGamePluginViewHolder(
|
||||
binding.recyclerView.recycledViewPool.clear()
|
||||
notifyPluginCallback()
|
||||
}
|
||||
|
||||
val text =
|
||||
if (pluginDisplayStatus == PluginDisplayStatus.CLOSE || pluginDisplayStatus == PluginDisplayStatus.OPEN_TWO_AND_BUTTON) {
|
||||
"收起"
|
||||
} else {
|
||||
"展开"
|
||||
}
|
||||
childEventHelper.trackPluginAreaClick(text, null)
|
||||
}
|
||||
binding.pluginExtendContainer.setOnClickListener(View.OnClickListener(function = expandClick))
|
||||
binding.pluginHead.setOnClickListener(View.OnClickListener(function = expandClick))
|
||||
|
||||
@ -160,6 +160,7 @@ class CustomHomeDiscoverCardViewHolder(
|
||||
entrance,
|
||||
blockName
|
||||
)
|
||||
childEventHelper.trackGameExploreClick("内容标签", label.title ?: "", linkEntity = label)
|
||||
childEventHelper.navigateToLinkPage(label)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,22 +7,23 @@ import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.visibleIf
|
||||
import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.databinding.ItemHomeRecentVgameBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
import com.gh.gamecenter.home.custom.adapter.CustomHomeRecentVGameAdapter
|
||||
import com.gh.gamecenter.home.custom.adapter.CustomPageAdapter
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.CustomPageItemChildEventHelper
|
||||
import com.gh.gamecenter.home.custom.eventlistener.RecentMiniGameItemEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomRecentMiniGamesItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomRecentQqMiniGamesItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomRecentWeChatMiniGamesItem
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayListAdapter
|
||||
|
||||
/**
|
||||
@ -37,105 +38,124 @@ class CustomHomeRecentMiniGameViewHolder(
|
||||
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomRecentMiniGamesItem) {
|
||||
binding.vspaceIv.visibility = View.GONE
|
||||
binding.divider.visibility = View.GONE
|
||||
if (item is CustomRecentWeChatMiniGamesItem) {
|
||||
// 微信小游戏最近在玩,不需要显示右上角
|
||||
binding.moreTv.visibleIf(false)
|
||||
}
|
||||
if (item is CustomRecentQqMiniGamesItem) {
|
||||
binding.moreTv.visibleIf(true)
|
||||
binding.moreTv.text = itemView.context.getString(R.string.custom_home_text_more)
|
||||
binding.moreTv.setOnClickListener {
|
||||
val link = item.linkQqGameRecentlyPlayed.moreLink ?: LinkEntity(type = "qq_mini_game_column")
|
||||
childEventHelper.navigateToLinkPage(link)
|
||||
}
|
||||
}
|
||||
|
||||
fillExposureEventList(item)
|
||||
val entities = when (item) {
|
||||
is CustomRecentWeChatMiniGamesItem -> {
|
||||
item.data
|
||||
}
|
||||
|
||||
binding.vspaceIv.visibility = View.GONE
|
||||
binding.divider.visibility = View.GONE
|
||||
binding.moreTv.visibility = View.GONE
|
||||
is CustomRecentQqMiniGamesItem -> {
|
||||
item.data
|
||||
}
|
||||
|
||||
val entities = item.data
|
||||
if (entities.isEmpty()) {
|
||||
binding.root.goneIf(true)
|
||||
binding.root.updateLayoutParams {
|
||||
// 这里为什么当 viewHolder 为0时,需要将高度设为 1呢?
|
||||
// 因为当 viewHolder为第一个位置时,如果高度为0,用户想下拉刷新时,在计算RecyclerView滚动距离的时候,会从第二个itemView开始算起,从而得出错误的结果
|
||||
// 这会导致下拉无法触发刷新回调
|
||||
height = if (bindingAdapterPosition == 0) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
width = RecyclerView.LayoutParams.MATCH_PARENT
|
||||
if (this is MarginLayoutParams) {
|
||||
topMargin = 0
|
||||
bottomMargin = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.root.goneIf(false)
|
||||
binding.root.updateLayoutParams {
|
||||
height = 106F.dip2px()
|
||||
width = RecyclerView.LayoutParams.MATCH_PARENT
|
||||
if (this is MarginLayoutParams) {
|
||||
topMargin = 8F.dip2px()
|
||||
bottomMargin = 8F.dip2px()
|
||||
}
|
||||
}
|
||||
else -> listOf()
|
||||
}
|
||||
fillExposureEventList(item, entities)
|
||||
|
||||
binding.titleTv.text = item.componentName
|
||||
|
||||
val gameListAdapter = if (binding.recyclerView.adapter == null) {
|
||||
val layoutManager =
|
||||
LinearLayoutManager(binding.root.context, RecyclerView.HORIZONTAL, false)
|
||||
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.itemAnimator = null
|
||||
val adapter = MiniGameRecentlyPlayListAdapter(binding.root.context) { game, position ->
|
||||
childEventHelper.navigateToGameDetailPage(position, game)
|
||||
}
|
||||
binding.recyclerView.adapter = adapter
|
||||
binding.recyclerView.addItemDecoration(
|
||||
GridSpacingItemColorDecoration(binding.root.context, 4, 0, R.color.transparent)
|
||||
)
|
||||
|
||||
binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
if (dx == 0) {
|
||||
val scrollToEnd =
|
||||
layoutManager.findLastCompletelyVisibleItemPosition() == (binding.recyclerView.adapter!!.itemCount - 1)
|
||||
// 当游戏数量超过一屏时,需去除列表右侧的分隔线;去除后,列表最后一个游戏图标与卡片右侧的边距应为16dp
|
||||
if (scrollToEnd) {
|
||||
binding.recyclerViewContainer.post {
|
||||
binding.recyclerViewContainer.layoutParams =
|
||||
(binding.recyclerViewContainer.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
rightMargin = 10F.dip2px()
|
||||
}
|
||||
}
|
||||
binding.divider.visibility = View.VISIBLE
|
||||
|
||||
} else {
|
||||
binding.recyclerViewContainer.post {
|
||||
binding.recyclerViewContainer.layoutParams =
|
||||
(binding.recyclerViewContainer.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
rightMargin = 0
|
||||
}
|
||||
}
|
||||
binding.divider.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
adapter
|
||||
if (entities.isEmpty()) {
|
||||
binding.root.goneIf(true)
|
||||
binding.root.updateLayoutParams {
|
||||
// 这里为什么当 viewHolder 为0时,需要将高度设为 1呢?
|
||||
// 因为当 viewHolder为第一个位置时,如果高度为0,用户想下拉刷新时,在计算RecyclerView滚动距离的时候,会从第二个itemView开始算起,从而得出错误的结果
|
||||
// 这会导致下拉无法触发刷新回调
|
||||
height = if (bindingAdapterPosition == 0) {
|
||||
1
|
||||
} else {
|
||||
binding.recyclerView.adapter as MiniGameRecentlyPlayListAdapter
|
||||
0
|
||||
}
|
||||
width = RecyclerView.LayoutParams.MATCH_PARENT
|
||||
if (this is MarginLayoutParams) {
|
||||
topMargin = 0
|
||||
bottomMargin = 0
|
||||
}
|
||||
|
||||
gameListAdapter.submitList(item.data)
|
||||
}
|
||||
|
||||
val bindingAdapter = bindingAdapter
|
||||
if (bindingAdapter is CustomPageAdapter) {
|
||||
bindingAdapter.updateFirstItemId()
|
||||
} else {
|
||||
binding.root.goneIf(false)
|
||||
binding.root.updateLayoutParams {
|
||||
height = 106F.dip2px()
|
||||
width = RecyclerView.LayoutParams.MATCH_PARENT
|
||||
if (this is MarginLayoutParams) {
|
||||
topMargin = 8F.dip2px()
|
||||
bottomMargin = 8F.dip2px()
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.titleTv.text = item.componentName
|
||||
|
||||
val gameListAdapter = if (binding.recyclerView.adapter == null) {
|
||||
val layoutManager =
|
||||
LinearLayoutManager(binding.root.context, RecyclerView.HORIZONTAL, false)
|
||||
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.itemAnimator = null
|
||||
|
||||
val adapter = MiniGameRecentlyPlayListAdapter(binding.root.context) { game, position ->
|
||||
childEventHelper.navigateToGameDetailPage(position, game)
|
||||
}
|
||||
binding.recyclerView.adapter = adapter
|
||||
binding.recyclerView.addItemDecoration(
|
||||
GridSpacingItemColorDecoration(binding.root.context, 4, 0, R.color.transparent)
|
||||
)
|
||||
|
||||
binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
if (dx == 0) {
|
||||
val scrollToEnd =
|
||||
layoutManager.findLastCompletelyVisibleItemPosition() == (binding.recyclerView.adapter!!.itemCount - 1)
|
||||
// 当游戏数量超过一屏时,需去除列表右侧的分隔线;去除后,列表最后一个游戏图标与卡片右侧的边距应为16dp
|
||||
if (scrollToEnd) {
|
||||
binding.recyclerViewContainer.post {
|
||||
binding.recyclerViewContainer.layoutParams =
|
||||
(binding.recyclerViewContainer.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
rightMargin = 10F.dip2px()
|
||||
}
|
||||
}
|
||||
binding.divider.visibility = View.VISIBLE
|
||||
|
||||
} else {
|
||||
binding.recyclerViewContainer.post {
|
||||
binding.recyclerViewContainer.layoutParams =
|
||||
(binding.recyclerViewContainer.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
rightMargin = 0
|
||||
}
|
||||
}
|
||||
binding.divider.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
adapter
|
||||
} else {
|
||||
binding.recyclerView.adapter as MiniGameRecentlyPlayListAdapter
|
||||
}
|
||||
|
||||
gameListAdapter.submitList(entities)
|
||||
|
||||
|
||||
val bindingAdapter = bindingAdapter
|
||||
if (bindingAdapter is CustomPageAdapter) {
|
||||
bindingAdapter.updateFirstItemId()
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillExposureEventList(item: CustomRecentMiniGamesItem) {
|
||||
private fun fillExposureEventList(item: CustomPageItem, entities: List<GameEntity>) {
|
||||
val exposureEventList = arrayListOf<ExposureEvent>()
|
||||
runOnIoThread(true) {
|
||||
item.data.forEachIndexed { index, game ->
|
||||
entities.forEachIndexed { index, game ->
|
||||
|
||||
val event = createExposureEvent(
|
||||
game,
|
||||
@ -151,4 +171,4 @@ class CustomHomeRecentMiniGameViewHolder(
|
||||
}
|
||||
item.exposureEventList = exposureEventList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
import com.gh.gamecenter.home.custom.adapter.CustomHomeRecentVGameAdapter
|
||||
import com.gh.gamecenter.home.custom.adapter.CustomPageAdapter
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.CustomPageItemChildEventHelper
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomRecentGamesItem
|
||||
@ -39,11 +38,12 @@ class CustomHomeRecentVGameViewHolder(
|
||||
var binding: ItemHomeRecentVgameCustomBinding
|
||||
) : BaseCustomViewHolder(viewModel, binding.root) {
|
||||
|
||||
override val childEventHelper: CustomPageItemChildEventHelper
|
||||
get() = OtherItemEventHelper(viewModel)
|
||||
override val childEventHelper: OtherItemEventHelper by lazy {
|
||||
OtherItemEventHelper(viewModel)
|
||||
}
|
||||
|
||||
private val adapter by lazy(LazyThreadSafetyMode.NONE) {
|
||||
CustomHomeRecentVGameAdapter(itemView.context)
|
||||
CustomHomeRecentVGameAdapter(itemView.context, childEventHelper)
|
||||
}
|
||||
|
||||
override val gameChangedNotifier: IGameChangedNotifier
|
||||
@ -66,6 +66,7 @@ class CustomHomeRecentVGameViewHolder(
|
||||
})
|
||||
|
||||
binding.moreTv.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("更多", null)
|
||||
binding.root.context.startActivity(
|
||||
VDownloadManagerActivity.getIntent(
|
||||
binding.root.context,
|
||||
@ -76,6 +77,7 @@ class CustomHomeRecentVGameViewHolder(
|
||||
}
|
||||
|
||||
binding.vspaceIv.setOnClickListener {
|
||||
childEventHelper.trackCWRecentlyPlayedClick("畅玩广场", null)
|
||||
NewFlatLogUtils.logHaloFunEvent("halo_fun_manage_square_entrance_click")
|
||||
VHelper.startVSpaceSquare(
|
||||
it.context, ExposureEvent.createEvent(
|
||||
@ -118,6 +120,7 @@ class CustomHomeRecentVGameViewHolder(
|
||||
topMargin = 16F.dip2px()
|
||||
}
|
||||
}
|
||||
|
||||
binding.divider.goneIf(!showVGameSquare)
|
||||
binding.vspaceIv.goneIf(!showVGameSquare)
|
||||
|
||||
|
||||
@ -44,6 +44,15 @@ object MiniGameRecentlyPlayUseCase {
|
||||
_wechatRecentGamesItemLiveData.value = data
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
if (gameType == Constants.QQ_MINI_GAME) {
|
||||
_qqRecentGamesItemLiveData.value = emptyList()
|
||||
} else {
|
||||
_wechatRecentGamesItemLiveData.value = emptyList()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -60,7 +69,7 @@ object MiniGameRecentlyPlayUseCase {
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun submitRecentPlayedQGame(qqAppId: String,userId: String) {
|
||||
fun submitRecentPlayedQGame(qqAppId: String, userId: String) {
|
||||
repository.postRecentPlayedQGame(qqAppId, userId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -85,4 +94,20 @@ object MiniGameRecentlyPlayUseCase {
|
||||
loadRecentlyPlayedMiniGameList(gameType)// 最近在玩数据为空时,则调用接口获取数据
|
||||
emptyList()
|
||||
}
|
||||
|
||||
fun clearRecentlyPlayedMiniGameList(gameType: String = "") {
|
||||
when (gameType) {
|
||||
Constants.QQ_MINI_GAME -> {
|
||||
_qqRecentGamesItemLiveData.value = emptyList()
|
||||
}
|
||||
|
||||
Constants.WECHAT_MINI_GAME ->
|
||||
_wechatRecentGamesItemLiveData.value = emptyList()
|
||||
|
||||
else -> {
|
||||
_qqRecentGamesItemLiveData.value = emptyList()
|
||||
_wechatRecentGamesItemLiveData.value = emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@ package com.gh.gamecenter.minigame.qq
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
@ -10,9 +12,18 @@ import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration
|
||||
import com.gh.gamecenter.databinding.ItemHomeRecentVgameBinding
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayListAdapter
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
|
||||
class QGameRecentlyPlayViewHolder(var binding: ItemHomeRecentVgameBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
class QGameRecentlyPlayViewHolder(
|
||||
private val lifecycleOwner: LifecycleOwner,
|
||||
val binding: ItemHomeRecentVgameBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
private val adapter by lazy {
|
||||
MiniGameRecentlyPlayListAdapter(binding.root.context)
|
||||
}
|
||||
|
||||
fun bindView(subject: SubjectEntity) {
|
||||
binding.vspaceIv.visibility = View.GONE
|
||||
@ -58,13 +69,12 @@ class QGameRecentlyPlayViewHolder(var binding: ItemHomeRecentVgameBinding) : Rec
|
||||
binding.moreTv.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
val subjectAdapter = if (binding.recyclerView.adapter == null) {
|
||||
if (binding.recyclerView.adapter == null) {
|
||||
val layoutManager =
|
||||
LinearLayoutManager(binding.root.context, RecyclerView.HORIZONTAL, false)
|
||||
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.itemAnimator = null
|
||||
val adapter = MiniGameRecentlyPlayListAdapter(binding.root.context)
|
||||
binding.recyclerView.adapter = adapter
|
||||
binding.recyclerView.addItemDecoration(
|
||||
GridSpacingItemColorDecoration(binding.root.context, 4, 0, R.color.transparent)
|
||||
@ -97,12 +107,18 @@ class QGameRecentlyPlayViewHolder(var binding: ItemHomeRecentVgameBinding) : Rec
|
||||
}
|
||||
}
|
||||
})
|
||||
adapter
|
||||
} else {
|
||||
binding.recyclerView.adapter as MiniGameRecentlyPlayListAdapter
|
||||
}
|
||||
|
||||
subjectAdapter.submitList(subject.data)
|
||||
}
|
||||
|
||||
private val observer = Observer<List<GameEntity>>(adapter::submitList)
|
||||
|
||||
fun onAttached() {
|
||||
MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData.observe(lifecycleOwner, observer)
|
||||
}
|
||||
|
||||
fun onDetached() {
|
||||
MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData.removeObserver(observer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.util.GameSubstituteRepositoryHelper
|
||||
import com.gh.common.util.GameUtils
|
||||
import com.gh.gamecenter.common.baselist.LoadStatus
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.core.utils.RandomUtils
|
||||
@ -23,6 +24,7 @@ import com.gh.gamecenter.game.data.GameItemData
|
||||
import com.gh.gamecenter.game.rank.RankCollectionAdapter
|
||||
import com.gh.gamecenter.home.BlankDividerViewHolder
|
||||
import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -86,6 +88,14 @@ class QGameViewModel(application: Application, blockData: SubjectRecommendEntity
|
||||
.subjectQGameList
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext {
|
||||
val hasRecentPlayed = it.any { subject ->
|
||||
subject.type == "qq_game_horizontal_slide"
|
||||
}
|
||||
if (hasRecentPlayed && MiniGameRecentlyPlayUseCase.qqRecentGamesItemLiveData.value == null) {
|
||||
MiniGameRecentlyPlayUseCase.loadRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME)
|
||||
}
|
||||
}
|
||||
.subscribe(object : Response<List<SubjectEntity>>() {
|
||||
override fun onResponse(response: List<SubjectEntity>?) {
|
||||
if (response != null) {
|
||||
|
||||
@ -120,6 +120,9 @@ object RouteConsts {
|
||||
|
||||
const val push = "/push/push"
|
||||
|
||||
const val realName = "/realName/realName"
|
||||
|
||||
const val miniGameRecentPlayed = "/services/miniGameRecentPlayed"
|
||||
const val sentry = "/sentry/sentry"
|
||||
|
||||
const val vaAd = "/vaAd/vaAd"
|
||||
|
||||
@ -222,6 +222,10 @@ object SensorsBridge {
|
||||
private const val EVENT_WECHAT_GAME_CLICK = "WechatGameClick"
|
||||
private const val EVENT_GAME_LIST_COLLECTION_CLICK = "GameListCollectionClick"
|
||||
private const val EVENT_CONTENT_CARD_CLICK = "ContentCardClick"
|
||||
private const val EVENT_PLUGIN_AREA_CLICK = "PluginAreaClick"
|
||||
private const val EVENT_CW_RECENTLY_PLAYED_CLICK = "CWRecentlyPlayedClick"
|
||||
private const val EVENT_QQ_GAME_RECENTLY_PLAYED_CLICK = "QqGameRecentlyPlayedClick"
|
||||
private const val EVENT_GAME_EXPLORE_CLICK = "GameExploreClick"
|
||||
private const val EVENT_VIEW_CUSTOM_PAGE = "ViewCustomPage"
|
||||
private const val EVENT_SUSPENDED_WINDOW_SHOW = "SuspendedWindowShow"
|
||||
private const val EVENT_SUSPENDED_WINDOW_CLICK = "SuspendedWindowClick"
|
||||
@ -3513,6 +3517,136 @@ object SensorsBridge {
|
||||
trackEvent(EVENT_CONTENT_CARD_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件化区域点击事件
|
||||
*/
|
||||
fun trackPluginAreaClick(
|
||||
text: String,
|
||||
bottomTab: String,
|
||||
multiTabId: String,
|
||||
multiTabName: String,
|
||||
position: Int,
|
||||
tabContent: String,
|
||||
customPageId: String,
|
||||
customPageName: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_TEXT to text
|
||||
KEY_BOTTOM_TAB to bottomTab
|
||||
KEY_MULTI_TAB_ID to multiTabId
|
||||
KEY_MULTI_TAB_NAME to multiTabName
|
||||
KEY_POSITION to position
|
||||
KEY_TAB_CONTENT to tabContent
|
||||
KEY_CUSTOM_PAGE_ID to customPageId
|
||||
KEY_CUSTOM_PAGE_NAME to customPageName
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
}
|
||||
trackEvent(EVENT_PLUGIN_AREA_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 畅玩最近在玩点击事件
|
||||
*/
|
||||
fun trackCWRecentlyPlayedClick(
|
||||
text: String,
|
||||
bottomTab: String,
|
||||
multiTabId: String,
|
||||
multiTabName: String,
|
||||
position: Int,
|
||||
tabContent: String,
|
||||
customPageId: String,
|
||||
customPageName: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_TEXT to text
|
||||
KEY_BOTTOM_TAB to bottomTab
|
||||
KEY_MULTI_TAB_ID to multiTabId
|
||||
KEY_MULTI_TAB_NAME to multiTabName
|
||||
KEY_POSITION to position
|
||||
KEY_TAB_CONTENT to tabContent
|
||||
KEY_CUSTOM_PAGE_ID to customPageId
|
||||
KEY_CUSTOM_PAGE_NAME to customPageName
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
}
|
||||
trackEvent(EVENT_CW_RECENTLY_PLAYED_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* qq小游戏最近在玩点击事件
|
||||
*/
|
||||
fun trackQqGameRecentlyPlayedClick(
|
||||
text: String,
|
||||
bottomTab: String,
|
||||
multiTabId: String,
|
||||
multiTabName: String,
|
||||
position: Int,
|
||||
tabContent: String,
|
||||
customPageId: String,
|
||||
customPageName: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_TEXT to text
|
||||
KEY_BOTTOM_TAB to bottomTab
|
||||
KEY_MULTI_TAB_ID to multiTabId
|
||||
KEY_MULTI_TAB_NAME to multiTabName
|
||||
KEY_POSITION to position
|
||||
KEY_TAB_CONTENT to tabContent
|
||||
KEY_CUSTOM_PAGE_ID to customPageId
|
||||
KEY_CUSTOM_PAGE_NAME to customPageName
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
}
|
||||
trackEvent(EVENT_QQ_GAME_RECENTLY_PLAYED_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发现页点击事件
|
||||
*/
|
||||
fun trackGameExploreClick(
|
||||
text: String,
|
||||
location: String,
|
||||
bottomTab: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = "",
|
||||
position: Int = 0,
|
||||
tabContent: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
gameId: String = "",
|
||||
gameName: String = "",
|
||||
linkType: String = "",
|
||||
linkId: String = "",
|
||||
linkText: String = "",
|
||||
buttonType: String = "",
|
||||
) {
|
||||
val json = json {
|
||||
KEY_TEXT to text
|
||||
KEY_LOCATION to location
|
||||
KEY_BOTTOM_TAB to bottomTab
|
||||
KEY_MULTI_TAB_ID to multiTabId
|
||||
KEY_MULTI_TAB_NAME to multiTabName
|
||||
KEY_POSITION to position
|
||||
KEY_TAB_CONTENT to tabContent
|
||||
KEY_CUSTOM_PAGE_ID to customPageId
|
||||
KEY_CUSTOM_PAGE_NAME to customPageName
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_LINK_TYPE to linkType
|
||||
KEY_LINK_ID to linkId
|
||||
KEY_LINK_TEXT to linkText
|
||||
KEY_BUTTON_TYPE to buttonType
|
||||
}
|
||||
trackEvent(EVENT_GAME_EXPLORE_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* ViewCustomPage 自定义页面浏览事件
|
||||
*/
|
||||
@ -3702,14 +3836,16 @@ object SensorsBridge {
|
||||
* 事件ID: PureModeDialogClick
|
||||
* 事件名称: 纯净模式弹窗点击事件
|
||||
*/
|
||||
fun trackPureModeDialogClick(gameId: String,
|
||||
gameName: String,
|
||||
gameType: String,
|
||||
buttonName: String,
|
||||
isIgnored: Boolean,
|
||||
linkId: String,
|
||||
linkType: String,
|
||||
linkText: String) {
|
||||
fun trackPureModeDialogClick(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameType: String,
|
||||
buttonName: String,
|
||||
isIgnored: Boolean,
|
||||
linkId: String,
|
||||
linkType: String,
|
||||
linkText: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -3740,14 +3876,16 @@ object SensorsBridge {
|
||||
* 事件ID: AddedProtectionDialogClick
|
||||
* 事件名称: 增强保护弹窗点击事件
|
||||
*/
|
||||
fun trackAddedProtectionDialogClick(gameId: String,
|
||||
gameName: String,
|
||||
gameType: String,
|
||||
buttonName: String,
|
||||
isIgnored: Boolean,
|
||||
linkId: String,
|
||||
linkType: String,
|
||||
linkText: String) {
|
||||
fun trackAddedProtectionDialogClick(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameType: String,
|
||||
buttonName: String,
|
||||
isIgnored: Boolean,
|
||||
linkId: String,
|
||||
linkType: String,
|
||||
linkText: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -3760,6 +3898,7 @@ object SensorsBridge {
|
||||
}
|
||||
trackEvent(EVENT_ADDED_PROTECTION_DIALOG_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:follow_tab_filter_option_click
|
||||
* 事件名称:关注tab筛选项点击事件
|
||||
@ -3867,6 +4006,7 @@ object SensorsBridge {
|
||||
}
|
||||
trackEvent(EVENT_FOLLOW_PAGE_USER_AND_FORUM_DATA_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:JumpLandPageAddressDialogShow
|
||||
* 事件名称:下载跳转第三方提示弹窗展示事件
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.gh.gamecenter.core.provider
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface IMiniGameRecentlyPlayedProvider : IProvider {
|
||||
|
||||
fun clearMiniGameRecentlyPlayed(gameType: String)
|
||||
|
||||
fun refreshQQMiniRecentPlayed()
|
||||
}
|
||||
@ -30,6 +30,7 @@ import com.gh.gamecenter.core.provider.IAppProvider;
|
||||
import com.gh.gamecenter.core.provider.IDataUtilsProvider;
|
||||
import com.gh.gamecenter.core.provider.IDownloadManagerProvider;
|
||||
import com.gh.gamecenter.core.provider.IErrorHelperProvider;
|
||||
import com.gh.gamecenter.core.provider.IMiniGameRecentlyPlayedProvider;
|
||||
import com.gh.gamecenter.core.provider.IPushProvider;
|
||||
import com.gh.gamecenter.core.provider.IReservationRepositoryProvider;
|
||||
import com.gh.gamecenter.core.provider.IWechatBindHelperProvider;
|
||||
@ -553,6 +554,14 @@ public class UserRepository {
|
||||
}, (e) -> {
|
||||
});
|
||||
}
|
||||
|
||||
// 登录成功后,刷新qq小游戏最近在玩
|
||||
IMiniGameRecentlyPlayedProvider miniGameRecentlyPlayedProvider= (IMiniGameRecentlyPlayedProvider) ARouter.getInstance()
|
||||
.build(RouteConsts.provider.miniGameRecentPlayed)
|
||||
.navigation();
|
||||
if(miniGameRecentlyPlayedProvider != null){
|
||||
miniGameRecentlyPlayedProvider.refreshQQMiniRecentPlayed();
|
||||
}
|
||||
}
|
||||
|
||||
if (UserManager.getInstance().getLoginTokenEntity() != null) {
|
||||
|
||||
@ -372,8 +372,10 @@ class SettingsFragment : ToolbarFragment() {
|
||||
override fun onCallback() {
|
||||
val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils)
|
||||
.navigation() as? IDialogUtilsProvider
|
||||
loadingDialog = dialogUtils?.showWaitDialog(requireContext(),
|
||||
getString(R.string.clearing_cache))
|
||||
loadingDialog = dialogUtils?.showWaitDialog(
|
||||
requireContext(),
|
||||
getString(R.string.clearing_cache)
|
||||
)
|
||||
val historyHelper = ARouter.getInstance().build(RouteConsts.provider.historyHelper)
|
||||
.navigation() as? IHistoryHelperProvider
|
||||
historyHelper?.emptyDatabase()
|
||||
@ -419,6 +421,12 @@ class SettingsFragment : ToolbarFragment() {
|
||||
.build(RouteConsts.provider.qGame)
|
||||
.navigation() as? IQGameProvider
|
||||
qProvider?.stopAllMiniApp(true) // 关闭所有QQ小游戏进程
|
||||
|
||||
(ARouter
|
||||
.getInstance()
|
||||
.build(RouteConsts.provider.miniGameRecentPlayed)
|
||||
.navigation() as? IMiniGameRecentlyPlayedProvider)
|
||||
?.clearMiniGameRecentlyPlayed(Constants.QQ_MINI_GAME)
|
||||
}
|
||||
},
|
||||
extraConfig = DialogHelper.Config(
|
||||
|
||||
Reference in New Issue
Block a user