This commit is contained in:
叶子维
2024-09-20 15:13:20 +08:00
parent 168f20a162
commit d5dc79f753
48 changed files with 1276 additions and 873 deletions

View File

@ -7,19 +7,20 @@ import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.HistoryGameDetailEntity
import com.gh.gamecenter.entity.HistoryGameEntity
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.feature.entity.AnswerEntity
import com.gh.gamecenter.feature.entity.ArticleEntity
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.feature.room.converter.*
import com.gh.gamecenter.room.converter.*
import com.gh.gamecenter.room.dao.*
import com.halo.assistant.HaloApp
@Database(
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class],
version = 14,
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class, HistoryGameDetailEntity::class],
version = 15,
exportSchema = false
)
@TypeConverters(
@ -53,6 +54,7 @@ abstract class HistoryDatabase : RoomDatabase() {
abstract fun gameDao(): GameDao
abstract fun videoHistoryDao(): VideoHistoryDao
abstract fun gamesCollectionDao(): GamesCollectionDao
abstract fun gameDetailDao(): GameDetailHistoryDao
companion object {
@ -152,6 +154,12 @@ abstract class HistoryDatabase : RoomDatabase() {
}
}
val MIGRATION_14_15: Migration = object : Migration(14, 15) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("CREATE TABLE HistoryGameDetail(id TEXT NOT NULL PRIMARY KEY, name TEXT DEFAULT '')")
}
}
val instance by lazy {
Room.databaseBuilder(
HaloApp.getInstance().application,
@ -170,6 +178,7 @@ abstract class HistoryDatabase : RoomDatabase() {
.addMigrations(MIGRATION_11_12)
.addMigrations(MIGRATION_12_13)
.addMigrations(MIGRATION_13_14)
.addMigrations(MIGRATION_14_15)
.build()
}
}

View File

@ -44,6 +44,20 @@ object HistoryHelper {
runOnIoThread { tryCatchInRelease { HistoryDatabase.instance.gameDao().addGame(historyGameEntity) } }
}
@JvmStatic
fun insertGameDetail(gameEntity: GameEntity) {
val historyGameDetailEntity = HistoryGameDetailEntity(gameEntity.id, gameEntity.name)
runOnIoThread { tryCatchInRelease { HistoryDatabase.instance.gameDetailDao().addGame(historyGameDetailEntity) } }
}
@JvmStatic
fun getHistoryGameDetailById(id: String): HistoryGameDetailEntity? =
try {
HistoryDatabase.instance.gameDetailDao().getHistoryGameDetailById(id)
} catch (e: Throwable) {
null
}
private fun convertGameUpdateEntityToHistoryGameEntity(updateEntity: GameUpdateEntity): HistoryGameEntity {
val historyGame = HistoryGameEntity()

View File

@ -149,11 +149,11 @@ object ViewPagerFragmentHelper {
NewQuestionDetailFragment().with(bundle)
}
// 其他原来带Toolbar的Fragment
else -> createToolbarWrapperFragment(parentFragment, bundle, linkEntity, isTabWrapper)
else -> createToolbarWrapperFragment(bundle, linkEntity, isTabWrapper)
}
}
private fun createToolbarWrapperFragment(parentFragment: Fragment?, bundle: Bundle, entity: LinkEntity, isTabWrapper: Boolean): Fragment {
private fun createToolbarWrapperFragment(bundle: Bundle, entity: LinkEntity, isTabWrapper: Boolean): Fragment {
var className = ReloadFragment::class.java.name
when (entity.type) {

View File

@ -0,0 +1,11 @@
package com.gh.gamecenter.entity
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity
data class HistoryGameDetailEntity(
@PrimaryKey
var id: String = "",
var name: String? = "",
)

View File

@ -3,18 +3,19 @@ package com.gh.gamecenter.game.horizontal
import android.content.Context
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.*
import com.gh.common.util.DataCollectionUtils
import com.gh.common.util.DownloadItemUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.subjectTypeToComponentStyle
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
import com.gh.gamecenter.gamedetail.viewholder.BaseGameDetailItemViewHolder
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.subjectTypeToComponentStyle
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity
@ -22,7 +23,9 @@ class GameHorizontalAdapter(
context: Context,
private var mSubjectEntity: SubjectEntity,
private var type: GameHorizontalListType = GameHorizontalListType.SubjectHorizontalType,
private val trackColumnClick: Boolean = true
private val trackColumnClick: Boolean = true,
private val gameDetailTrackData: BaseGameDetailItemViewHolder.GameDetailModuleTrackData? = null,
private val getGameStatus: (() -> String)? = null
) : BaseRecyclerAdapter<GameHorizontalItemViewHolder>(context) {
var gameName = ""
@ -111,20 +114,15 @@ class GameHorizontalAdapter(
if (type == GameHorizontalListType.GameDetailHorizontalType) {
DataCollectionUtils.uploadClick(mContext, path, "游戏详情", gameEntity.name)
NewLogUtils.logGameDetailPopularClick(gameName, gameId, "game", gameEntity.name ?: "")
SensorsBridge.trackGameDetailPagePopularClick(
gameId = gameId,
gameName = gameName,
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId,
downloadStatus = game?.downloadStatusChinese ?: "",
gameType = game?.categoryChinese ?: "",
clickGameType = gameEntity.categoryChinese,
clickGameName = gameEntity.name ?: "",
clickGameId = gameEntity.id
SensorsBridge.trackGameDetailModuleClick(
gameDetailTrackData?.gameId,
gameDetailTrackData?.gameName,
gameDetailTrackData?.gameType,
"右上角",
gameDetailTrackData?.moduleType,
gameDetailTrackData?.moduleName,
gameDetailTrackData?.sequence,
gameStatus = getGameStatus?.invoke()
)
if (!gameEntity.isMiniGame() && trackColumnClick) {
SensorsBridge.trackColumnClick(

View File

@ -72,7 +72,10 @@ import com.gh.gamecenter.feature.utils.SentryHelper
import com.gh.gamecenter.forum.detail.ForumDetailActivity
import com.gh.gamecenter.gamedetail.cloudarchive.CloudArchiveFragment
import com.gh.gamecenter.gamedetail.desc.DescFragment
import com.gh.gamecenter.gamedetail.dialog.*
import com.gh.gamecenter.gamedetail.dialog.GameDetailMoreDialog
import com.gh.gamecenter.gamedetail.dialog.GameTagsDialog
import com.gh.gamecenter.gamedetail.dialog.SpecialDownloadDialogFragment
import com.gh.gamecenter.gamedetail.dialog.SpecialDownloadVisibilityViewModel
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity
import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity
import com.gh.gamecenter.gamedetail.entity.Video
@ -919,55 +922,55 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
updateDownloadCountHint(it)
}
mViewModel.bigEventLiveData.observeNonNull(this) {
GameBigEventDialog.showGameBigEventDialog(
requireContext(), mGameEntity?.name ?: "", mGameEntity?.id ?: "", it
) { link, position ->
DirectUtils.directToLinkPage(requireContext(), link, mEntrance, "游戏大事件弹窗", "游戏详情页-大事件")
NewFlatLogUtils.logGameDetailMajorEventDetailClick(
mGameEntity?.name ?: "",
mGameEntity?.id ?: "",
link.link ?: "",
link.type ?: "",
link.text ?: ""
)
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "跳转链接",
linkText = link.text ?: "",
linkType = link.type ?: "",
linkId = link.link ?: ""
)
}.apply {
setOnDismissListener {
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "关闭弹窗",
linkText = "",
linkType = "",
linkId = ""
)
}
}
}
// mViewModel.bigEventLiveData.observeNonNull(this) {
// GameBigEventDialog.showGameBigEventDialog(
// requireContext(), mGameEntity?.name ?: "", mGameEntity?.id ?: "", it
// ) { link, position ->
// DirectUtils.directToLinkPage(requireContext(), link, mEntrance, "游戏大事件弹窗", "游戏详情页-大事件")
// NewFlatLogUtils.logGameDetailMajorEventDetailClick(
// mGameEntity?.name ?: "",
// mGameEntity?.id ?: "",
// link.link ?: "",
// link.type ?: "",
// link.text ?: ""
// )
// SensorsBridge.trackGameDetailPageMajorEventClick(
// gameId = mGameEntity?.id ?: "",
// gameName = mGameEntity?.name ?: "",
// pageName = getCurrentPageEntity().pageName,
// pageId = getCurrentPageEntity().pageId,
// pageBusinessId = getCurrentPageEntity().pageBusinessId,
// lastPageName = getLastPageEntity().pageName,
// lastPageId = getLastPageEntity().pageId,
// lastPageBusinessId = getLastPageEntity().pageBusinessId,
// downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
// gameType = mGameEntity?.categoryChinese ?: "",
// action = "跳转链接",
// linkText = link.text ?: "",
// linkType = link.type ?: "",
// linkId = link.link ?: ""
// )
// }.apply {
// setOnDismissListener {
// SensorsBridge.trackGameDetailPageMajorEventClick(
// gameId = mGameEntity?.id ?: "",
// gameName = mGameEntity?.name ?: "",
// pageName = getCurrentPageEntity().pageName,
// pageId = getCurrentPageEntity().pageId,
// pageBusinessId = getCurrentPageEntity().pageBusinessId,
// lastPageName = getLastPageEntity().pageName,
// lastPageId = getLastPageEntity().pageId,
// lastPageBusinessId = getLastPageEntity().pageBusinessId,
// downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
// gameType = mGameEntity?.categoryChinese ?: "",
// action = "关闭弹窗",
// linkText = "",
// linkType = "",
// linkId = ""
// )
// }
// }
// }
mViewModel.recommendPopupLiveData.observe(this) {
initRecommendUI()
}
@ -1285,21 +1288,21 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
tag.name,
tag.isTop
)
SensorsBridge.trackGameDetailPageGameTagClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
position = position,
gameTag = listOf(tag.name),
gameTagId = tag.id,
)
// SensorsBridge.trackGameDetailPageGameTagClick(
// gameId = mGameEntity?.id ?: "",
// gameName = mGameEntity?.name ?: "",
// pageName = getCurrentPageEntity().pageName,
// pageId = getCurrentPageEntity().pageId,
// pageBusinessId = getCurrentPageEntity().pageBusinessId,
// lastPageName = getLastPageEntity().pageName,
// lastPageId = getLastPageEntity().pageId,
// lastPageBusinessId = getLastPageEntity().pageBusinessId,
// downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
// gameType = mGameEntity?.categoryChinese ?: "",
// position = position,
// gameTag = listOf(tag.name),
// gameTagId = tag.id,
// )
requireContext().startActivity(
TagsActivity.getIntent(requireContext(), tag.name, tag.name, mEntrance, "游戏介绍")
)

View File

@ -6,11 +6,13 @@ import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.DiffUtil.ItemCallback
import androidx.recyclerview.widget.ListAdapter
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.viewholder.*
class GameDetailListAdapter(
val context: Context,
private val downloadBtn: DownloadButton,
private val viewModel: GameDetailViewModel,
private val lifecycleOwner: LifecycleOwner
) :
@ -51,30 +53,30 @@ class GameDetailListAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseGameDetailItemViewHolder {
return when (viewType) {
ITEM_CONTENT_CARD_SINGLE -> GameDetailContentCardSingleItemViewHolder(parent.toBinding(), viewModel)
ITEM_CONTENT_CARD_DOUBLE -> GameDetailContentCardDoubleItemViewHolder(parent.toBinding(), viewModel)
ITEM_CONTENT_CARD_TRIPLE -> GameDetailContentCardTripleItemViewHolder(parent.toBinding(), viewModel)
ITEM_ADVERTISING -> GameDetailAdvertisingItemViewHolder(parent.toBinding(), viewModel)
ITEM_ADVERTISING_IMAGE -> GameDetailAdvertisingImageItemViewHolder(parent.toBinding(), viewModel)
ITEM_COMPREHENSIVE_PANEL -> GameDetailComprehensivePanelItemViewHolder(parent.toBinding(), viewModel)
ITEM_CUSTOM_COLUMN -> GameDetailCustomColumnItemViewHolder(parent.toBinding(), viewModel)
ITEM_DRAWER -> GameDetailDrawerItemViewHolder(parent.toBinding(), viewModel)
ITEM_ANNOUNCEMENT -> GameDetailAnnouncementItemViewHolder(parent.toBinding(), viewModel)
ITEM_GAME_BRIEF -> GameDetailBriefItemViewHolder(parent.toBinding(), viewModel)
ITEM_DEVELOPER_WORD -> GameDetailDeveloperWordItemViewHolder(parent.toBinding(), viewModel)
ITEM_UPDATE -> GameDetailUpdateItemViewHolder(parent.toBinding(), viewModel)
ITEM_COMMENT -> GameDetailCommentItemViewHolder(parent.toBinding(), viewModel)
ITEM_DETAIL_INFO -> GameDetailInfoItemViewHolder(parent.toBinding(), viewModel)
ITEM_CONTENT_RECOMMEND -> GameDetailContentRecommendItemViewHolder(parent.toBinding(), viewModel, lifecycleOwner)
ITEM_GAME_VIDEO -> GameDetailVideoItemViewHolder(parent.toBinding(), viewModel)
ITEM_GAME_STRATEGY -> GameDetailStrategyItemViewHolder(parent.toBinding(), viewModel)
ITEM_SERVER -> GameDetailServerItemViewHolder(parent.toBinding(), viewModel)
ITEM_GIFT -> GameDetailGiftItemViewHolder(parent.toBinding(), viewModel)
ITEM_RELATED_GAME -> GameDetailRelatedGameItemViewHolder(parent.toBinding(), viewModel)
ITEM_RECOMMEND_IMAGE -> GameDetailRecommendImageItemViewHolder(parent.toBinding(), viewModel)
ITEM_RECOMMEND_GAME -> GameDetailRecommendGameItemViewHolder(parent.toBinding(), viewModel)
ITEM_RECOMMEND_GAME_COLLECTION -> GameDetailRecommendGameCollectionItemViewHolder(parent.toBinding(), viewModel)
else -> GameDetailRecommendColumnItemViewHolder(parent.toBinding(), viewModel)
ITEM_CONTENT_CARD_SINGLE -> GameDetailContentCardSingleItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_CONTENT_CARD_DOUBLE -> GameDetailContentCardDoubleItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_CONTENT_CARD_TRIPLE -> GameDetailContentCardTripleItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_ADVERTISING -> GameDetailAdvertisingItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_ADVERTISING_IMAGE -> GameDetailAdvertisingImageItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_COMPREHENSIVE_PANEL -> GameDetailComprehensivePanelItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_CUSTOM_COLUMN -> GameDetailCustomColumnItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_DRAWER -> GameDetailDrawerItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_ANNOUNCEMENT -> GameDetailAnnouncementItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_GAME_BRIEF -> GameDetailBriefItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_DEVELOPER_WORD -> GameDetailDeveloperWordItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_UPDATE -> GameDetailUpdateItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_COMMENT -> GameDetailCommentItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_DETAIL_INFO -> GameDetailInfoItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_CONTENT_RECOMMEND -> GameDetailContentRecommendItemViewHolder(parent.toBinding(), downloadBtn, viewModel, lifecycleOwner)
ITEM_GAME_VIDEO -> GameDetailVideoItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_GAME_STRATEGY -> GameDetailStrategyItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_SERVER -> GameDetailServerItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_GIFT -> GameDetailGiftItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_RELATED_GAME -> GameDetailRelatedGameItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_RECOMMEND_IMAGE -> GameDetailRecommendImageItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_RECOMMEND_GAME -> GameDetailRecommendGameItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
ITEM_RECOMMEND_GAME_COLLECTION -> GameDetailRecommendGameCollectionItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
else -> GameDetailRecommendColumnItemViewHolder(parent.toBinding(), downloadBtn, viewModel)
}
}

View File

@ -67,7 +67,7 @@ class GameDetailViewModel(
val concernLiveData = MutableLiveData<ConcernResponse>()
val gameLiveData = MutableLiveData<Resource<GameEntity>?>()
val gameDetailLiveData = MutableLiveData<Resource<NewGameDetailEntity>>()
val bigEventLiveData = MutableLiveData<List<BigEvent>>()
val bigEventLiveData = MutableLiveData<List<GameDetailBasicInfo.BigEvent>>()
val recommendPopupLiveData = MutableLiveData<ArrayList<RecommendPopupEntity>>()
val archiveStatusLiveData = MutableLiveData<Boolean>()
@ -111,6 +111,8 @@ class GameDetailViewModel(
var me: MeEntity? = null
var libaoList: ArrayList<LibaoEntity>? = null
var pageDepth = 0 // 浏览深度
var isDownloadClick = false // 是否触发下载
private var isGameInstalled = false
private var isGameUpdatable = false
@ -657,6 +659,7 @@ class GameDetailViewModel(
fun logHistory(data: GameEntity) {
HistoryHelper.insertGameEntity(data)
HistoryHelper.insertGameDetail(data)
}
fun removeFromHistory() {
@ -679,8 +682,8 @@ class GameDetailViewModel(
api.getBigEvent(game?.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<List<BigEvent>>() {
override fun onResponse(response: List<BigEvent>?) {
.subscribe(object : Response<List<GameDetailBasicInfo.BigEvent>>() {
override fun onResponse(response: List<GameDetailBasicInfo.BigEvent>?) {
super.onResponse(response)
response?.let {
for (event in it) {

View File

@ -21,6 +21,7 @@ import com.ethanhua.skeleton.Skeleton
import com.ethanhua.skeleton.ViewSkeletonScreen
import com.gh.common.constant.Config
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.history.HistoryHelper
import com.gh.common.repository.ReservationRepository
import com.gh.common.simulator.SimulatorGameManager
import com.gh.common.util.*
@ -62,7 +63,6 @@ import com.gh.gamecenter.feature.entity.SimpleGame
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.forum.detail.ForumDetailActivity
import com.gh.gamecenter.gamedetail.cloudarchive.CloudArchiveFragment
import com.gh.gamecenter.gamedetail.dialog.GameBigEventDialog
import com.gh.gamecenter.gamedetail.dialog.GameDetailMoreDialog
import com.gh.gamecenter.gamedetail.dialog.SpecialDownloadDialogFragment
import com.gh.gamecenter.gamedetail.dialog.SpecialDownloadVisibilityViewModel
@ -239,6 +239,7 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
traceEvent = traceEvent,
isSupportDualButton = true
) {
viewModel.isDownloadClick = true
viewModel.scrollToSpecificPositionOnDownloadClick(it)
}
@ -333,6 +334,16 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
recommendDisposable = null
}
DownloadManager.getInstance().removeObserver(dataWatcher)
val isFirstTime = HistoryHelper.getHistoryGameDetailById(viewModel.game?.id ?: "") == null
SensorsBridge.trackEvent("GameDetailPageLeave", json {
"game_id" to mGameEntity?.id
"game_name" to mGameEntity?.name
"game_type" to mGameEntity?.categoryChinese
"page_depth" to viewModel.pageDepth
"\$is_first_time" to isFirstTime
"is_download" to viewModel.isDownloadClick
})
}
private fun initMenu() {
@ -507,55 +518,6 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
updateDownloadCountHint(it)
}
viewModel.bigEventLiveData.observeNonNull(viewLifecycleOwner) {
GameBigEventDialog.showGameBigEventDialog(
requireContext(), mGameEntity?.name ?: "", mGameEntity?.id ?: "", it
) { link, position ->
DirectUtils.directToLinkPage(requireContext(), link, mEntrance, "游戏大事件弹窗", "游戏详情页-大事件")
NewFlatLogUtils.logGameDetailMajorEventDetailClick(
mGameEntity?.name ?: "",
mGameEntity?.id ?: "",
link.link ?: "",
link.type ?: "",
link.text ?: ""
)
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "跳转链接",
linkText = link.text ?: "",
linkType = link.type ?: "",
linkId = link.link ?: ""
)
}.apply {
setOnDismissListener {
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "关闭弹窗",
linkText = "",
linkType = "",
linkId = ""
)
}
}
}
viewModel.recommendPopupLiveData.observe(viewLifecycleOwner) {
initRecommendUI()
}
@ -670,7 +632,9 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
)
when (tabEntity.type) {
GameDetailTabEntity.TYPE_DETAIL -> {
fragment = fragment ?: NewGameDetailFragment()
val showDualDownloadButton = mGameEntity?.getGameDownloadButtonMode() == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DUAL
val downloadBtn = if (showDualDownloadButton) downloadBinding.localDownloadButton else downloadBinding.detailProgressbar
fragment = fragment ?: NewGameDetailFragment(downloadBtn)
// bundle.putAll(arguments)
}
GameDetailTabEntity.TYPE_ARCHIVE -> {
@ -729,7 +693,7 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
viewPager.adapter =
FragmentAdapter(childFragmentManager, fragmentsList, tabEntityList.map { it.name })
viewPager.doOnPageSelected { position ->
// logTabClick(it)
logTabClick(position)
onPageSelected(position)
hideRecommendView()
}
@ -742,6 +706,75 @@ class GameDetailWrapperFragment: BaseLazyFragment(), IScrollable {
}
}
private fun logTabClick(position: Int) {
// 特殊处理延时选中 tab 时可能 fragment 已被移除的情况
if (!isAdded) return
val tabEntity = tabEntityList.getOrNull(position) ?: return
SensorsBridge.trackGameDetailPageTabSelect(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
position = position,
tabContent = tabEntity.name
)
val entrance = if (mEntrance.contains("论坛详情")) "论坛" else "游戏"
mGameEntity?.run {
when (tabEntity.type) {
GameDetailTabEntity.TYPE_DETAIL -> {
NewLogUtils.logGameDetailTabClick(name ?: "", id, "详情")
}
GameDetailTabEntity.TYPE_ZONE -> {
NewLogUtils.logGameDetailTabClick(
"view_game_detail_special_area_tab",
entrance,
id,
gameType,
bbsId
)
NewLogUtils.logGameDetailTabClick(name ?: "", id, "专区")
}
GameDetailTabEntity.TYPE_ARCHIVE -> {
NewFlatLogUtils.logCloudArchiveGameDetailTabRelated(
"cloud_save_tab_click",
mGameEntity?.id ?: "",
mGameEntity?.name ?: ""
)
SensorsBridge.trackEvent(
"CloudSaveTabSelected",
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: "",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId
)
}
GameDetailTabEntity.TYPE_COMMENT -> {
NewLogUtils.logGameDetailTabClick("view_game_detail_comment_tab", entrance, id, gameType, bbsId)
NewLogUtils.logGameDetailTabClick(name ?: "", id, "评论")
}
GameDetailTabEntity.TYPE_BBS -> {
NewLogUtils.logGameDetailTabClick(name ?: "", id, "论坛")
}
}
}
}
private fun onPageSelected(position: Int) {
val tabEntity = tabEntityList.getOrNull(position) ?: return

View File

@ -8,7 +8,10 @@ import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.fragment.BaseFragment
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.feature.entity.LibaoEntity
import com.gh.gamecenter.gamedetail.desc.GameLibaoAdapter
@ -42,6 +45,13 @@ class LibaoListFragment : BaseFragment<Any>() {
layoutManager = LinearLayoutManager(requireContext())
adapter = adapter ?: GameLibaoAdapter(requireContext(), libaoList, gameName, gameId, false, true)
}
SensorsBridge.trackEvent("GameGiftPageView", json {
"game_id" to gameId
"game_name" to gameName
"last_page_name" to GlobalActivityManager.getLastPageEntity().pageName
"last_page_id" to GlobalActivityManager.getLastPageEntity().pageId
})
}
companion object {

View File

@ -17,6 +17,7 @@ import androidx.core.view.updateLayoutParams
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
import androidx.viewpager2.widget.ViewPager2
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewFlatLogUtils
@ -30,6 +31,7 @@ import com.gh.gamecenter.common.base.fragment.LazyFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.ScrollEventListener
import com.gh.gamecenter.common.view.TextBannerView
@ -40,10 +42,12 @@ import com.gh.gamecenter.databinding.ItemGameDetailDataInfoBinding
import com.gh.gamecenter.databinding.ItemGameDetailFunctionTagBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.TagStyleEntity
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.dialog.GameBigEventDialogFragment
import com.gh.gamecenter.gamedetail.dialog.GameFunctionDialogFragment
import com.gh.gamecenter.gamedetail.entity.*
import com.gh.gamecenter.gamedetail.video.GameDetailScrollCalculatorHelper
import com.gh.gamecenter.gamedetail.viewholder.BaseGameDetailItemViewHolder.Companion.getGameStatus
import com.gh.gamecenter.home.video.ScrollCalculatorHelper
import com.gh.gamecenter.livedata.EventObserver
import com.gh.gamecenter.tag.TagsActivity
@ -52,7 +56,7 @@ import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import kotlin.math.abs
class NewGameDetailFragment : LazyFragment(), IScrollable {
class NewGameDetailFragment(private val downloadButton: DownloadButton) : LazyFragment(), IScrollable {
private lateinit var binding: FragmentNewGameDetailBinding
private lateinit var viewModel: GameDetailViewModel
private lateinit var scrollCalculatorHelper: GameDetailScrollCalculatorHelper
@ -70,7 +74,7 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
private val snapHelper by lazy { LeftPagerSnapHelper() }
private val coverScrollEventListener by lazy { ScrollEventListener(binding.coverRv) }
private val detailListAdapter by lazy {
GameDetailListAdapter(requireContext(), viewModel, viewLifecycleOwner)
GameDetailListAdapter(requireContext(), downloadButton, viewModel, viewLifecycleOwner)
}
private val detailLayoutManager by lazy {
LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
@ -81,6 +85,8 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
private var coverPosition = 0
private var bigEventTransitionDrawable: TransitionDrawable? = null
private var mGameEntity: GameEntity? = null
private val gameStatus
get() = getGameStatus(downloadButton.buttonStyle)
override fun getRealLayoutId(): Int = R.layout.fragment_new_game_detail
@ -119,6 +125,12 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
val checkPosition = it.indexOfFirst { coverEntity -> coverEntity.tabName == checkedText }
if (checkPosition != -1) {
coverRv.setCurrentItem(checkPosition)
SensorsBridge.trackEvent("GameDetailMediaTabClick", json {
"game_id" to mGameEntity?.id
"game_name" to mGameEntity?.name
"sequence" to position + 1
"tab_name" to checkedText
})
}
}
}
@ -206,6 +218,40 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
)
viewModel.basicInfoLiveData.postValue(testBasicInfo)
viewModel.bigEventLiveData.observeNonNull(viewLifecycleOwner) {
GameBigEventDialogFragment.show(
requireContext(),
mGameEntity?.id ?: "",
mGameEntity?.name ?: "",
it
) { link, _ ->
DirectUtils.directToLinkPage(requireContext(), link, mEntrance, "游戏大事件弹窗", "游戏详情页-大事件")
NewFlatLogUtils.logGameDetailMajorEventDetailClick(
mGameEntity?.name ?: "",
mGameEntity?.id ?: "",
link.link ?: "",
link.type ?: "",
link.text ?: ""
)
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "跳转链接",
linkText = link.text ?: "",
linkType = link.type ?: "",
linkId = link.link ?: ""
)
}
}
viewModel.dataInfoLiveData.observeNonNull(viewLifecycleOwner) {
initDataInfo(it)
}
@ -231,8 +277,18 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
private fun initDetailRv() {
binding.detailRv.run {
(itemAnimator as DefaultItemAnimator).supportsChangeAnimations = false
layoutManager = detailLayoutManager
adapter = detailListAdapter
addOnScrollListener(object : OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
viewModel.pageDepth = detailLayoutManager.findLastCompletelyVisibleItemPosition()
.coerceAtLeast(viewModel.pageDepth)
}
}
})
}
}
@ -345,20 +401,17 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
tag.name,
tag.isTop
)
SensorsBridge.trackGameDetailPageGameTagClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
position = position,
gameTag = listOf(tag.name),
gameTagId = tag.id,
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"卖点标签",
null,
null,
null,
null,
gameStatus = gameStatus
)
requireContext().startActivity(
TagsActivity.getIntent(requireContext(), tag.name, tag.name, mEntrance, "游戏介绍")
@ -393,37 +446,19 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
if (it.first().highLight) bigEventTransitionDrawable?.reverseTransition(0)
bigEventBannerView.setOnClickListener { _ ->
GameBigEventDialogFragment.show(
requireContext(),
mGameEntity?.id ?: "",
mGameEntity?.name ?: "",
it
) { link, position ->
DirectUtils.directToLinkPage(requireContext(), link, mEntrance, "游戏大事件弹窗", "游戏详情页-大事件")
NewFlatLogUtils.logGameDetailMajorEventDetailClick(
mGameEntity?.name ?: "",
mGameEntity?.id ?: "",
link.link ?: "",
link.type ?: "",
link.text ?: ""
)
SensorsBridge.trackGameDetailPageMajorEventClick(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = mGameEntity?.downloadStatusChinese ?: "",
gameType = mGameEntity?.categoryChinese ?: "",
action = "跳转链接",
linkText = link.text ?: "",
linkType = link.type ?: "",
linkId = link.link ?: ""
)
}
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"大事件",
null,
null,
null,
null,
gameStatus = gameStatus
)
viewModel.getBigEvent()
}
bigEventBannerView.setDataList(it.map { event ->
var eventStr = if (event.highLight) {
@ -475,6 +510,18 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
binding.accelerateTv.setOnClickListener {
it.context.ifLogin("游戏详情-求加速") {
NewFlatLogUtils.logGameDetailClickForAccelerate(mGameEntity?.id ?: "", mGameEntity?.name ?: "")
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"功能标签",
null,
null,
null,
null,
gameStatus = gameStatus
)
DialogHelper.showDialog(
requireContext(), "版本求加速", "如果游戏需要加速版本,您可以提交申请,让小助手尽快研究给您喔!",
"提交申请", "取消", {
@ -511,6 +558,18 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
binding.moreTv.text = "+${gameDetailInfoTag.infoTags.size - 3}"
}
binding.functionTagContainer.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"功能标签",
null,
null,
null,
null,
gameStatus = gameStatus
)
GameFunctionDialogFragment.show(
requireContext(),
mGameEntity?.id ?: "",
@ -545,6 +604,18 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
infoTv.setTypeface(Typeface.createFromAsset(requireContext().assets, Constants.DIN_FONT_PATH))
infoTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(requireContext()))
root.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"数据信息栏",
null,
null,
null,
null,
gameStatus = gameStatus
)
DirectUtils.directToColumnCollection(
requireContext(),
dataInfo.ranking.collectionId,
@ -560,6 +631,18 @@ class NewGameDetailFragment : LazyFragment(), IScrollable {
if (dataInfo.realName.certificationScreenshot.isNotEmpty()) {
infoTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(requireContext()))
root.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
mGameEntity?.id,
mGameEntity?.name,
mGameEntity?.categoryChinese,
"组件内容",
"数据信息栏",
null,
null,
null,
null,
gameStatus = gameStatus
)
startActivity(
ImageViewerActivity.getSingleIntent(
requireContext(),

View File

@ -8,12 +8,11 @@ import androidx.core.os.bundleOf
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.cloudarchive.CloudArchiveManagerActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.fragment.LazyFragment
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.FragmentCloudArchiveAlBinding
import com.gh.gamecenter.databinding.FragmentCloudArchiveBinding
import com.gh.gamecenter.feature.entity.GameEntity
@ -59,6 +58,13 @@ class CloudArchiveFragment : LazyFragment() {
mGameEntity = arguments?.getParcelable(EntranceConsts.KEY_GAME)
super.onFragmentFirstVisible()
changeContentFragment()
SensorsBridge.trackEvent("CloudSavePageView", json {
"game_id" to mGameEntity?.id
"game_name" to mGameEntity?.name
"last_page_name" to GlobalActivityManager.getLastPageEntity().pageName
"last_page_id" to GlobalActivityManager.getLastPageEntity().pageId
})
}
override fun inflateRealView() {

View File

@ -1,7 +1,6 @@
package com.gh.gamecenter.gamedetail.desc
import android.annotation.SuppressLint
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
@ -30,8 +29,6 @@ import com.gh.common.util.NewFlatLogUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.GameNewsActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.callback.SimpleCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
@ -43,7 +40,6 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.divider.HorizontalDividerItemDecoration
import com.gh.gamecenter.common.view.divider.VerticalDividerItemDecoration
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.HaloApp.Companion.getInstance
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.SubjectEntity
@ -60,7 +56,6 @@ import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.utils.Utils
import org.greenrobot.eventbus.EventBus
class DescAdapter(
@ -765,22 +760,22 @@ class DescAdapter(
visibility = View.VISIBLE
setDrawableEnd(R.drawable.ic_right_arrow_darker)
setOnClickListener {
NewFlatLogUtils.logGameDetailGameListRecommendSquareJump(mGameName, mViewModel.gameId ?: "")
SensorsBridge.trackGameDetailPageGameCollectRecommendClick(
gameId = mViewModel.gameId ?: "",
gameName = mGameName,
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageId = GlobalActivityManager.getCurrentPageEntity().pageId,
lastPageName = GlobalActivityManager.getCurrentPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
downloadStatus = mGame?.downloadStatusChinese ?: "",
gameType = mGame?.categoryChinese ?: "",
text = "游戏单广场",
gameCollectId = "",
gameCollectTitle = ""
)
// NewFlatLogUtils.logGameDetailGameListRecommendSquareJump(mGameName, mViewModel.gameId ?: "")
// SensorsBridge.trackGameDetailPageGameCollectRecommendClick(
// gameId = mViewModel.gameId ?: "",
// gameName = mGameName,
// pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
// pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
// pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
// lastPageId = GlobalActivityManager.getCurrentPageEntity().pageId,
// lastPageName = GlobalActivityManager.getCurrentPageEntity().pageName,
// lastPageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
// downloadStatus = mGame?.downloadStatusChinese ?: "",
// gameType = mGame?.categoryChinese ?: "",
// text = "游戏单广场",
// gameCollectId = "",
// gameCollectTitle = ""
// )
DirectUtils.directToGameCollectionSquare(it.context, mEntrance)
}
}
@ -794,15 +789,15 @@ class DescAdapter(
layoutManager = LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false)
if (adapter == null) {
adapter = GameCollectionAdapter(
recommendGameList,
mViewModel.gameId ?: "",
mGameName,
mViewModel.game,
mEntrance,
"游戏详情[${mGameName}]:游戏单推荐",
listOf(ExposureSource("游戏详情", "$mGameName+$mGameId"))
)
// adapter = GameCollectionAdapter(
// recommendGameList,
// mViewModel.gameId ?: "",
// mGameName,
// mViewModel.game,
// mEntrance,
// "游戏详情[${mGameName}]:游戏单推荐",
// listOf(ExposureSource("游戏详情", "$mGameName+$mGameId"))
// )
} else {
adapter?.notifyItemRangeChanged(0, itemCount)
}

View File

@ -6,7 +6,6 @@ import com.gh.common.exposure.ExposureManager
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
@ -14,6 +13,7 @@ import com.gh.gamecenter.databinding.GamedetailItemGameCollectionBinding
import com.gh.gamecenter.entity.GameDetailRecommendGameEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.gamedetail.viewholder.BaseGameDetailItemViewHolder
class GameCollectionAdapter(
private val mRecommendGameList: ArrayList<GameDetailRecommendGameEntity>,
@ -22,7 +22,9 @@ class GameCollectionAdapter(
private val mGame: GameEntity?,
private val mEntrance: String,
private val mPath: String,
private val mBasicExposureSource: List<ExposureSource>
private val mBasicExposureSource: List<ExposureSource>,
private val trackData: BaseGameDetailItemViewHolder.GameDetailModuleTrackData,
private val getGameStatus: () -> String
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val mDefaultHorizontalPadding by lazy { com.gh.gamecenter.common.R.dimen.game_detail_item_horizontal_padding.toPx() }
@ -72,20 +74,16 @@ class GameCollectionAdapter(
}
gameCountTv.text = "+${entity.count.game - games.size}"
root.setOnClickListener {
SensorsBridge.trackGameDetailPageGameCollectRecommendClick(
gameId = mGameId,
gameName = mGameName,
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageId = GlobalActivityManager.getCurrentPageEntity().pageId,
lastPageName = GlobalActivityManager.getCurrentPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
downloadStatus = mGame?.downloadStatusChinese ?: "",
gameType = mGame?.categoryChinese ?: "",
text = "游戏单",
gameCollectId = entity.id,
gameCollectTitle = entity.title
SensorsBridge.trackGameDetailModuleClick(
trackData.gameId,
trackData.gameName,
trackData.gameType,
"组件内容",
trackData.moduleType,
"游戏单推荐",
trackData.sequence,
supSequence = position + 1,
gameStatus = getGameStatus()
)
DirectUtils.directToGameCollectionDetail(
it.context,

View File

@ -5,19 +5,21 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.ItemGameDetailRelatedVersionBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.gh.gamecenter.gamedetail.viewholder.BaseGameDetailItemViewHolder
class GameDetailRelatedGameAdapter(
private val context: Context,
private val game: GameEntity?,
private val relatedGameList: ArrayList<GameEntity>,
private val entrance: String
private val entrance: String,
private val trackData: BaseGameDetailItemViewHolder.GameDetailModuleTrackData,
private val getGameStatus: () -> String
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var exposureEventList: ArrayList<ExposureEvent> = arrayListOf()
private val maxWidth = context.resources.displayMetrics.widthPixels - 32F.dip2px()
@ -68,20 +70,16 @@ class GameDetailRelatedGameAdapter(
),
exposureEventList.safelyGetInRelease(position)
)
SensorsBridge.trackGameDetailPageRelatedGameClick(
gameId = game?.id ?: "",
gameName = game?.name ?: "",
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId,
downloadStatus = game?.downloadStatusChinese ?: "",
gameType = game?.categoryChinese ?: "",
clickGameId = gameEntity.id,
clickGameName = gameEntity.name ?: "",
clickGameType = gameEntity.categoryChinese
SensorsBridge.trackGameDetailModuleClick(
trackData.gameId,
trackData.gameName,
trackData.gameType,
"组件内容",
trackData.moduleType,
"相关游戏",
trackData.sequence,
supSequence = position + 1,
gameStatus = getGameStatus()
)
}
GameItemViewHolder.initGameSubtitleAndAdLabel(gameEntity, holder.binding.gameSubtitleTv)

View File

@ -12,10 +12,8 @@ import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.util.NewLogUtils
import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.view.divider.HorizontalDividerItemDecoration
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.MtaHelper
@ -82,21 +80,6 @@ class GameTagsDialog : BaseDialogFragment() {
tag.name, tag.name, "", "游戏介绍"
)
)
SensorsBridge.trackGameDetailPageGameTagClick(
gameId = mGameId,
gameName = mGameName,
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId,
downloadStatus = mDownloadStatus,
gameType = mGameType,
position = position,
gameTag = listOf(tag.name),
gameTagId = tag.id,
)
NewLogUtils.logGameDetailTagClick(mGameId, mGameName, tag.id, tag.name, tag.isTop)
MtaHelper.onEvent("游戏标签弹窗", "进入标签", "${mGameName}+${tag.name}")
}

View File

@ -10,6 +10,8 @@ import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.*
import com.google.gson.annotations.SerializedName
private const val s = "video_img_area"
data class GameDetailData(
var position: Int = -1, // 本地字段
var type: String = "",
@ -67,6 +69,35 @@ data class GameDetailData(
val linkColumnRecommend: List<GameDetailRecommendColumn>? = null,
val recommendColumn: GameDetailRecommendColumn? = null,
) {
val typeChinese
get() = when (type) {
"video_img_area" -> "视频/图片区域"
"basic_info" -> "头部信息"
"data_info" -> "数据信息栏"
"info_tag" -> "功能标签"
"content_card" -> "内容卡片"
"advertising" -> "广告推荐"
"comprehensive" -> "综合面板"
"custom_column" -> "自定义栏目"
"drawer" -> "抽屉列表"
"announcement" -> "资讯公告"
"game_brief" -> "游戏简介"
"developer_word" -> "开发者的话"
"update" -> "更新内容"
"comment" -> "玩家评论"
"info" -> "详情信息"
"content_recommend" -> "内容推荐PK组件"
"game_video" -> "游戏视频"
"game_guide" -> "游戏攻略"
"server" -> "游戏开服"
"libao" -> "游戏礼包"
"related_game" -> "相关游戏"
"image_recommend" -> "图片推荐"
"everyone_playing" -> "大家都在玩"
"recommend_game_list" -> "游戏单推荐"
"column_recommend" -> "专题推荐"
else -> ""
}
fun areItemsTheSame(other: GameDetailData) = type == other.type
fun areContentsTheSame(other: GameDetailData) = type == other.type && this == other

View File

@ -4,18 +4,72 @@ import android.content.Context
import android.view.View
import androidx.annotation.CallSuper
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
abstract class BaseGameDetailItemViewHolder(val itemView: View, val viewModel: GameDetailViewModel) : RecyclerView.ViewHolder(itemView) {
abstract class BaseGameDetailItemViewHolder(val itemView: View, val downloadBtn: DownloadButton, val viewModel: GameDetailViewModel) : RecyclerView.ViewHolder(itemView) {
protected val context: Context = itemView.context
protected var itemData: GameDetailData? = null
protected val gameId
get() = viewModel.game?.id ?: ""
protected val gameName
get() = viewModel.game?.name ?: ""
protected val gameType
get() = viewModel.game?.categoryChinese ?: ""
protected val moduleType
get() = itemData?.typeChinese ?: ""
protected val sequence
get() = itemData?.position?.plus(1) ?: 0
protected val gameStatus
get() = getGameStatus(downloadBtn.buttonStyle)
protected val baseTrackData
get() = GameDetailModuleTrackData(
gameId = gameId,
gameName = gameName,
gameType = gameId,
gameStatus = gameStatus,
moduleType = moduleType,
sequence = sequence,
)
@CallSuper
open fun bindView(data: GameDetailData) {
itemData = data
}
data class GameDetailModuleTrackData(
var gameId: String = "",
var gameName: String = "",
var gameType: String = "",
var gameStatus: String = "",
var moduleType: String = "",
var moduleName: String = "",
var sequence: Int = 0,
var subModuleName: String = "",
var subSequence: Int = 0
)
companion object {
fun getGameStatus(buttonStyle: DownloadButton.ButtonStyle) = when (buttonStyle) {
DownloadButton.ButtonStyle.WAITING,
DownloadButton.ButtonStyle.UPDATING,
DownloadButton.ButtonStyle.PAUSE,
DownloadButton.ButtonStyle.FAILURE,
DownloadButton.ButtonStyle.DOWNLOADING_NORMAL,
DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN -> "下载中"
DownloadButton.ButtonStyle.XAPK_UNZIPPING,
DownloadButton.ButtonStyle.XAPK_SUCCESS,
DownloadButton.ButtonStyle.XAPK_FAILURE,
DownloadButton.ButtonStyle.INSTALL_NORMAL,
DownloadButton.ButtonStyle.INSTALL_PLUGIN -> "待安装"
DownloadButton.ButtonStyle.LAUNCH_OR_OPEN -> "已安装"
DownloadButton.ButtonStyle.RESERVABLE -> "预约"
DownloadButton.ButtonStyle.RESERVED -> "已预约"
else -> "未下载"
}
}
}

View File

@ -4,27 +4,33 @@ import android.content.Context
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.updateLayoutParams
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailImageLinkBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailLink
class GameDetailAdvertisingImageItemViewHolder(
val binding: ItemGameDetailImageLinkBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkAdvertising ?: return
bindImageItem(context, binding, entity, "游戏详情-广告推荐")
bindImageItem(context, binding, entity, "游戏详情-广告推荐", baseTrackData) { gameStatus }
}
companion object {
fun bindImageItem(context: Context, binding: ItemGameDetailImageLinkBinding, data: GameDetailLink, entrance: String) {
fun bindImageItem(
context: Context,
binding: ItemGameDetailImageLinkBinding,
data: GameDetailLink,
entrance: String,
trackData: GameDetailModuleTrackData,
getGameStatus: () -> String
) {
binding.run {
if (data.img.isNotEmpty() && data.imgScale.isNotEmpty()) {
imageIv.updateLayoutParams<ConstraintLayout.LayoutParams> {
@ -45,7 +51,24 @@ class GameDetailAdvertisingImageItemViewHolder(
linkTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
}
container.setOnClickListener { _ ->
data.link?.let { DirectUtils.directToLinkPage(context, it, entrance, "") }
data.link?.let {
DirectUtils.directToLinkPage(context, it, entrance, "")
SensorsBridge.trackGameDetailModuleClick(
trackData.gameId,
trackData.gameName,
trackData.gameType,
"组件内容",
trackData.moduleType,
trackData.moduleName,
trackData.sequence,
null,
null,
it.type,
it.link,
it.link,
getGameStatus()
)
}
}
}
}

View File

@ -3,28 +3,34 @@ package com.gh.gamecenter.gamedetail.viewholder
import android.content.Context
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailLinkBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailLink
class GameDetailAdvertisingItemViewHolder(
val binding: ItemGameDetailLinkBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkAdvertising ?: return
bindItem(context, binding, entity, "游戏详情-广告推荐")
bindItem(context, binding, entity, "游戏详情-广告推荐", baseTrackData) { gameStatus }
}
companion object {
fun bindItem(context: Context, binding: ItemGameDetailLinkBinding, data: GameDetailLink, entrance: String) {
fun bindItem(
context: Context,
binding: ItemGameDetailLinkBinding,
data: GameDetailLink,
entrance: String,
trackData: GameDetailModuleTrackData,
getGameStatus: () -> String
) {
binding.run {
container.background = R.drawable.bg_shape_ui_container_1_radius_8_item_style.toDrawable(context)
iconIv.goneIf(data.componentIcon?.icon.isNullOrEmpty()) {
@ -33,7 +39,24 @@ class GameDetailAdvertisingItemViewHolder(
titleTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
titleTv.text = data.title
container.setOnClickListener { _ ->
data.link?.let { DirectUtils.directToLinkPage(context, it, entrance, "") }
data.link?.let {
DirectUtils.directToLinkPage(context, it, entrance, "")
SensorsBridge.trackGameDetailModuleClick(
trackData.gameId,
trackData.gameName,
trackData.gameType,
"组件内容",
trackData.moduleType,
trackData.moduleName,
trackData.sequence,
null,
null,
it.type,
it.link,
it.link,
getGameStatus()
)
}
}
}
}

View File

@ -9,14 +9,16 @@ import com.gh.gamecenter.common.view.VerticalItemDecoration
import com.gh.gamecenter.databinding.ItemGameDetailAnnouncementBinding
import com.gh.gamecenter.databinding.ItemGameDetailImageLinkBinding
import com.gh.gamecenter.databinding.ItemGameDetailLinkBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailLink
class GameDetailAnnouncementItemViewHolder(
val binding: ItemGameDetailAnnouncementBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
@ -55,7 +57,14 @@ class GameDetailAnnouncementItemViewHolder(
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val data = dataList.getOrNull(position) ?: return
if (holder is GameDetailAnnouncementItemViewHolder) {
GameDetailAdvertisingItemViewHolder.bindItem(context, holder.binding, data, "游戏详情-资讯公告")
GameDetailAdvertisingItemViewHolder.bindItem(
context,
holder.binding,
data,
"游戏详情-资讯公告",
baseTrackData.apply {
moduleName = itemData?.linkAnnouncement?.name ?: ""
}) { gameStatus }
holder.binding.container.background = null
}
if (holder is GameDetailAnnouncementImageItemViewHolder) {
@ -63,8 +72,11 @@ class GameDetailAnnouncementItemViewHolder(
context,
holder.binding,
data,
"游戏详情-资讯公告"
)
"游戏详情-资讯公告",
baseTrackData.apply {
moduleName = itemData?.linkAnnouncement?.name ?: ""
}
) { gameStatus }
}
}

View File

@ -7,13 +7,11 @@ import androidx.core.view.forEach
import androidx.core.view.isEmpty
import androidx.core.view.isVisible
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailBriefAwardBinding
import com.gh.gamecenter.databinding.ItemGameDetailBriefBinding
import com.gh.gamecenter.databinding.ItemGameDetailBriefTagBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.dialog.GameDetailScrollableTextDialogFragment
import com.gh.gamecenter.gamedetail.entity.GameBrief
@ -23,8 +21,9 @@ import splitties.systemservices.layoutInflater
class GameDetailBriefItemViewHolder(
val binding: ItemGameDetailBriefBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkGameBrief ?: return
@ -43,6 +42,16 @@ class GameDetailBriefItemViewHolder(
expandTv.isVisible = briefTv.lineCount == 3 && briefTv.layout.getEllipsisCount(2) > 0
}
expandTv.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
GameDetailScrollableTextDialogFragment.show(
context,
viewModel.game?.id ?: "",
@ -63,6 +72,16 @@ class GameDetailBriefItemViewHolder(
val tagBinding = ItemGameDetailBriefTagBinding.inflate(context.layoutInflater)
tagBinding.root.text = gameTag.name
tagBinding.root.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkGameBrief?.name,
sequence,
gameStatus = gameStatus
)
context.startActivity(
TagsActivity.getIntent(
context,

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.core.utils.SpanBuilder
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.databinding.SubItemGameDetailCommentBinding
import com.gh.gamecenter.entity.RatingComment
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.desc.DescCommentsAdapter.Companion.RATING_PATCH_REQUEST
import com.gh.gamecenter.gamedetail.desc.DescCommentsAdapter.Companion.RATING_REPLY_REQUEST
@ -38,8 +39,9 @@ import java.util.regex.Pattern
class GameDetailCommentItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkComment ?: return
@ -54,6 +56,16 @@ class GameDetailCommentItemViewHolder(
moreTv.text = "更多"
moreTv.setOnClickListener {
viewModel.setTabSelected(GameDetailTabEntity.TYPE_COMMENT)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
if (recyclerView.adapter !is CommentItemAdapter) {
@ -165,6 +177,18 @@ class GameDetailCommentItemViewHolder(
commentData.user.icon
)
}
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkComment?.name,
sequence,
subModuleName = "玩家评论列表",
supSequence = position + 1,
gameStatus = gameStatus
)
}
userIcon.setOnClickListener {
DirectUtils.directToHomeActivity(
@ -178,6 +202,18 @@ class GameDetailCommentItemViewHolder(
viewModel.game?.id ?: "",
"个人主页"
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkComment?.name,
sequence,
subModuleName = "玩家评论列表",
supSequence = position + 1,
gameStatus = gameStatus
)
}
userNameTv.setOnClickListener {
userIcon.performClick()
@ -247,6 +283,18 @@ class GameDetailCommentItemViewHolder(
}
}
timeTv.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkComment?.name,
sequence,
subModuleName = "玩家评论列表",
supSequence = position + 1,
gameStatus = gameStatus
)
if (commentData.isEditContent == null && commentData.ignore) {
DialogUtils.showStopServerExplanationDialog(
context,
@ -290,6 +338,18 @@ class GameDetailCommentItemViewHolder(
viewModel.game?.id ?: "",
"评论内容"
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkComment?.name,
sequence,
subModuleName = "玩家评论列表",
supSequence = position + 1,
gameStatus = gameStatus
)
}
}
}

View File

@ -14,6 +14,7 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.VerticalItemDecoration
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailComprehensivePanelItem
import com.gh.gamecenter.gamedetail.entity.GameDetailComprehensivePanelItem.ContentData
@ -21,8 +22,9 @@ import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailComprehensivePanelItemViewHolder(
val binding: ItemGameDetailComprehensivePanelBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val dataList = data.linkComprehensive ?: return
@ -74,7 +76,7 @@ class GameDetailComprehensivePanelItemViewHolder(
return false
}
}
recyclerView.adapter = ComprehensivePanelFunctionAdapter(contentData)
recyclerView.adapter = ComprehensivePanelFunctionAdapter(data.title, contentData)
recyclerView.post {
expandTv.goneIf(!showPart || recyclerView.height <= SHRANK_HEIGHT_DP.dip2px()) {
var isExpand = false
@ -110,7 +112,7 @@ class GameDetailComprehensivePanelItemViewHolder(
if (recyclerView.adapter !is ComprehensivePanelFAQAdapter) {
recyclerView.isNestedScrollingEnabled = false
recyclerView.layoutManager = LinearLayoutManager(context)
recyclerView.adapter = ComprehensivePanelFAQAdapter(contentData)
recyclerView.adapter = ComprehensivePanelFAQAdapter(data.title, contentData)
recyclerView.addItemDecoration(VerticalItemDecoration(context, 8F, false, com.gh.gamecenter.common.R.color.transparent))
} else {
recyclerView.adapter?.run { notifyItemRangeChanged(0, itemCount) }
@ -132,7 +134,7 @@ class GameDetailComprehensivePanelItemViewHolder(
override fun getItemCount(): Int = dataList.size
}
inner class ComprehensivePanelFunctionAdapter(val dataList: List<ContentData>) :
inner class ComprehensivePanelFunctionAdapter(val subModuleName: String, val dataList: List<ContentData>) :
RecyclerView.Adapter<ComprehensivePanelFunctionItemViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ComprehensivePanelFunctionItemViewHolder =
ComprehensivePanelFunctionItemViewHolder(parent.toBinding())
@ -152,12 +154,29 @@ class GameDetailComprehensivePanelItemViewHolder(
text = data.text
}
holder.binding.root.setOnClickListener { _ ->
data.link?.let { DirectUtils.directToLinkPage(context, it, "游戏详情-功能说明", "") }
data.link?.let {
DirectUtils.directToLinkPage(context, it, "游戏详情-功能说明", "")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
"功能说明",
sequence,
subModuleName,
position + 1,
it.type,
it.link,
it.text,
gameStatus
)
}
}
}
}
inner class ComprehensivePanelFAQAdapter(val dataList: List<ContentData>) :
inner class ComprehensivePanelFAQAdapter(val subModuleName: String, val dataList: List<ContentData>) :
RecyclerView.Adapter<ComprehensivePanelFAQItemViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ComprehensivePanelFAQItemViewHolder =
ComprehensivePanelFAQItemViewHolder(parent.toBinding())
@ -175,7 +194,24 @@ class GameDetailComprehensivePanelItemViewHolder(
holder.binding.arrowIv.setImageResource(R.drawable.ic_auxiliary_arrow_right_8)
}
holder.binding.root.setOnClickListener { _ ->
data.link?.let { DirectUtils.directToLinkPage(context, it, "游戏详情-功能说明", "") }
data.link?.let {
DirectUtils.directToLinkPage(context, it, "游戏详情-功能说明", "")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
"功能说明",
sequence,
subModuleName,
position + 1,
it.type,
it.link,
it.text,
gameStatus
)
}
}
}
}

View File

@ -2,25 +2,34 @@ package com.gh.gamecenter.gamedetail.viewholder
import com.gh.gamecenter.databinding.ItemGameDetailContentCardDoubleBinding
import com.gh.gamecenter.databinding.LayoutGameDetailContentCardBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity
import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailContentCardDoubleItemViewHolder(
val binding: ItemGameDetailContentCardDoubleBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) :
BaseGameDetailItemViewHolder(binding.root, viewModel) {
BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
data.linkContentCard?.let {
bindContentCard(viewModel, it.first(), binding.firstCardContainer, 0)
bindContentCard(viewModel, it[1], binding.secondCardContainer, 1)
val getGameStatus = { gameStatus }
bindContentCard(viewModel, it.first(), binding.firstCardContainer, baseTrackData.apply { subSequence = 0 }, getGameStatus)
bindContentCard(viewModel, it[1], binding.secondCardContainer, baseTrackData.apply { subSequence = 1 }, getGameStatus)
}
}
companion object {
fun bindContentCard(viewModel: GameDetailViewModel,contentCardEntity: ContentCardEntity, itemBinding: LayoutGameDetailContentCardBinding, position: Int) {
fun bindContentCard(
viewModel: GameDetailViewModel,
contentCardEntity: ContentCardEntity,
itemBinding: LayoutGameDetailContentCardBinding,
trackData: GameDetailModuleTrackData,
getGameStatus: () -> String
) {
itemBinding.run {
GameDetailContentCardSingleItemViewHolder.bindContentCard(
root.context,
@ -33,7 +42,8 @@ class GameDetailContentCardDoubleItemViewHolder(
contentBannerView,
redDotTv,
newIv,
position
trackData,
getGameStatus
)
}
}

View File

@ -10,8 +10,6 @@ import com.gh.common.constant.Config
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.TextBannerView
@ -19,6 +17,7 @@ import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.databinding.ItemGameDetailContentCardSingleBinding
import com.gh.gamecenter.feature.entity.MeEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity
import com.gh.gamecenter.gamedetail.entity.GameDetailData
@ -29,8 +28,9 @@ import kotlin.math.abs
class GameDetailContentCardSingleItemViewHolder(
val binding: ItemGameDetailContentCardSingleBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
@ -47,8 +47,8 @@ class GameDetailContentCardSingleItemViewHolder(
contentBannerView,
redDotTv,
newIv,
0
)
baseTrackData.apply { subSequence = 0 }
) { gameStatus }
}
}
@ -72,7 +72,8 @@ class GameDetailContentCardSingleItemViewHolder(
contentBannerView: TextBannerView,
redDotTv: TextView,
newIv: ImageView,
position: Int
trackData: GameDetailModuleTrackData,
getGameStatus: () -> String
) {
if (containerView.tag == contentCardEntity.id) {
if (contentBannerView.isVisible) contentBannerView.updateView()
@ -139,22 +140,18 @@ class GameDetailContentCardSingleItemViewHolder(
contentCardEntity.link.link ?: "",
contentCardEntity.link.text ?: ""
)
SensorsBridge.trackGameDetailPageContentCardClick(
gameId = viewModel.game?.id ?: "",
gameName = viewModel.game?.name ?: "",
pageName = getCurrentPageEntity().pageName,
pageId = getCurrentPageEntity().pageId,
pageBusinessId = getCurrentPageEntity().pageBusinessId,
lastPageName = getLastPageEntity().pageName,
lastPageId = getLastPageEntity().pageId,
lastPageBusinessId = getLastPageEntity().pageBusinessId,
downloadStatus = viewModel.game?.downloadStatusChinese ?: "",
gameType = viewModel.game?.categoryChinese ?: "",
position = position,
title = contentCardEntity.title ?: "",
SensorsBridge.trackGameDetailModuleClick(
gameId = trackData.gameId,
gameName = trackData.gameName,
gameType = trackData.gameType,
contentType = "组件内容",
moduleType = trackData.moduleType,
moduleName = trackData.moduleName,
sequence = trackData.sequence,
linkText = contentCardEntity.link.text ?: "",
linkType = contentCardEntity.link.type ?: "",
linkId = contentCardEntity.id
linkId = contentCardEntity.id,
gameStatus = getGameStatus()
)
val dialog = contentCardEntity.dialog

View File

@ -1,20 +1,23 @@
package com.gh.gamecenter.gamedetail.viewholder
import com.gh.gamecenter.databinding.ItemGameDetailContentCardTripleBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.viewholder.GameDetailContentCardDoubleItemViewHolder.Companion.bindContentCard
class GameDetailContentCardTripleItemViewHolder(
val binding: ItemGameDetailContentCardTripleBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
data.linkContentCard?.let {
bindContentCard(viewModel, it.first(), binding.firstCardContainer, 0)
bindContentCard(viewModel, it[1].apply { showDes = false }, binding.secondCardContainer, 1)
bindContentCard(viewModel, it[2].apply { showDes = false }, binding.thirdCardContainer, 2)
val getGameStatus = { gameStatus }
bindContentCard(viewModel, it.first(), binding.firstCardContainer, baseTrackData.apply { subSequence = 0 }, getGameStatus)
bindContentCard(viewModel, it[1].apply { showDes = false }, binding.secondCardContainer, baseTrackData.apply { subSequence = 1 }, getGameStatus)
bindContentCard(viewModel, it[2].apply { showDes = false }, binding.thirdCardContainer, baseTrackData.apply { subSequence = 2 }, getGameStatus)
}
}
}

View File

@ -4,22 +4,26 @@ import android.content.Context
import androidx.lifecycle.LifecycleOwner
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.PKEntity
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.databinding.ItemPkBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.livedata.EventObserver
class GameDetailContentRecommendItemViewHolder(
val binding: ItemPkBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel,
private val lifecycleOwner: LifecycleOwner,
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
private var pkEntity: PKEntity? = null
override fun bindView(data: GameDetailData) {
@ -40,11 +44,49 @@ class GameDetailContentRecommendItemViewHolder(
} else {
pkView.updateView()
}
bindPKItem(context, this, link, pkEntity!!, onPositiveClickAction = {
bindPKItem(context, this, link, pkEntity!!, onPositiveClickAction = positive@{
if (pkEntity == null) return@positive
SensorsBridge.trackPKClick(
GlobalActivityManager.getCurrentPageEntity().pageName,
GlobalActivityManager.getCurrentPageEntity().pageId,
pkEntity!!.id,
pkEntity!!.title,
pkEntity!!.option1.text,
pkEntity!!.link?.type ?: "",
pkEntity!!.link?.link ?: "",
pkEntity!!.link?.text ?: ""
)
viewModel.postPKVote(pkEntity!!.id, true)
}, onNegativeClickAction = {
}, onNegativeClickAction = negative@{
if (pkEntity == null) return@negative
SensorsBridge.trackPKClick(
GlobalActivityManager.getCurrentPageEntity().pageName,
GlobalActivityManager.getCurrentPageEntity().pageId,
pkEntity!!.id,
pkEntity!!.title,
pkEntity!!.option2.text,
pkEntity!!.link?.type ?: "",
pkEntity!!.link?.link ?: "",
pkEntity!!.link?.text ?: ""
)
viewModel.postPKVote(pkEntity!!.id, false)
})
}) {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
pkEntity?.title,
sequence,
null,
null,
pkEntity?.link?.type,
pkEntity?.link?.link,
pkEntity?.link?.text,
gameStatus
)
}
}
}
}
@ -59,7 +101,8 @@ class GameDetailContentRecommendItemViewHolder(
link: LinkEntity,
pkEntity: PKEntity,
onPositiveClickAction: () -> Unit,
onNegativeClickAction: () -> Unit
onNegativeClickAction: () -> Unit,
onLinkClickAction: () -> Unit
) {
binding.run {
container.background = R.drawable.bg_shape_f8_radius_8.toDrawable(context)
@ -89,6 +132,7 @@ class GameDetailContentRecommendItemViewHolder(
""
)
}
onLinkClickAction.invoke()
}
}
}

View File

@ -3,13 +3,15 @@ package com.gh.gamecenter.gamedetail.viewholder
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailCustomColumnBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailCustomColumnItemViewHolder(
val binding: ItemGameDetailCustomColumnBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
@ -29,6 +31,21 @@ class GameDetailCustomColumnItemViewHolder(
columnDesTv.setOnClickListener { _ ->
entity.titleInfo?.link?.let {
DirectUtils.directToLinkPage(context, it, "游戏详情-自定义栏目", "")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.name,
sequence,
null,
null,
it.type,
it.link,
it.text,
gameStatus
)
}
}
}
@ -54,6 +71,21 @@ class GameDetailCustomColumnItemViewHolder(
rightTopContainer.setOnClickListener {
entity.rightTopInfo?.link?.let {
DirectUtils.directToLinkPage(context, it, "游戏详情-自定义栏目", "")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
null,
null,
it.type,
it.link,
it.text,
gameStatus
)
}
}
}

View File

@ -3,17 +3,20 @@ package com.gh.gamecenter.gamedetail.viewholder
import android.text.Html
import androidx.core.view.isVisible
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.databinding.ItemGameDetailDeveloperWordBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.dialog.GameDetailScrollableTextDialogFragment
import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailDeveloperWordItemViewHolder(
val binding: ItemGameDetailDeveloperWordBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkDeveloperWord ?: return
@ -35,6 +38,16 @@ class GameDetailDeveloperWordItemViewHolder(
entity.name,
entity.text
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
}
}

View File

@ -4,20 +4,19 @@ import android.text.Html
import androidx.core.view.isVisible
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailDrawerBinding
import com.gh.gamecenter.databinding.SubItemGameDetailDrawerBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailLink
class GameDetailDrawerItemViewHolder(
val binding: ItemGameDetailDrawerBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
@ -50,7 +49,24 @@ class GameDetailDrawerItemViewHolder(
arrowIv.setImageResource(com.gh.gamecenter.common.R.drawable.ic_auxiliary_arrow_right_12)
}
root.setOnClickListener { _ ->
data.link?.let { DirectUtils.directToLinkPage(context, it, "游戏详情-抽屉列表", "") }
data.link?.let {
DirectUtils.directToLinkPage(context, it, "游戏详情-抽屉列表", "")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkDrawer?.name,
sequence,
null,
null,
it.type,
it.link,
it.text,
gameStatus
)
}
}
}
}

View File

@ -5,11 +5,9 @@ import android.graphics.PorterDuffColorFilter
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.ShellActivity.Type
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.setDrawableEnd
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.LibaoListFragment
import com.gh.gamecenter.gamedetail.desc.GameLibaoAdapter
@ -17,8 +15,9 @@ import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailGiftItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val giftList = data.linkLibao ?: return
@ -32,6 +31,16 @@ class GameDetailGiftItemViewHolder(
moreTv.goneIf(giftList.size <= 3) {
moreTv.text = "更多"
moreTv.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
"游戏礼包",
sequence,
gameStatus = gameStatus
)
val bundle = LibaoListFragment.getBundle(
viewModel.game?.id ?: "",
viewModel.game?.name ?: "",

View File

@ -18,14 +18,19 @@ import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.databinding.ItemGameDetailInfoBinding
import com.gh.gamecenter.databinding.SubItemGameDetailInfoBinding
import com.gh.gamecenter.feature.entity.GameInfo
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.dialog.GameInfoDialogFragment
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailInfo
class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewModel: GameDetailViewModel) :
BaseGameDetailItemViewHolder(binding.root, viewModel) {
class GameDetailInfoItemViewHolder(
val binding: ItemGameDetailInfoBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) :
BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkInfo ?: return
@ -39,7 +44,18 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
titleTv.text = entity.name
divider1.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_divider.toColor(context))
bindStaticInfo(context, entity, viewModel, privacyPolicyTv, permissionsTv, requestUpdateTv)
bindStaticInfo(context, entity, viewModel, privacyPolicyTv, permissionsTv, requestUpdateTv) {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
divider2.goneIf(entity.des.isEmpty()) {
divider2.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_divider.toColor(context))
@ -49,6 +65,16 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
}
moreTv.setOnClickListener {
GameInfoDialogFragment.show(context, viewModel.game, entity)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
if (gameInfoRv.adapter !is InfoItemAdapter) {
@ -66,7 +92,18 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
inner class InfoItemAdapter(val dataList: List<GameDetailInfo.InfoItem>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
InfoItemViewHolder(parent.toBinding())
InfoItemViewHolder(parent.toBinding()) {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkInfo?.name,
sequence,
gameStatus = gameStatus
)
}
override fun getItemCount(): Int = dataList.size
@ -78,7 +115,7 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
}
}
class InfoItemViewHolder(val binding: SubItemGameDetailInfoBinding) : RecyclerView.ViewHolder(binding.root) {
class InfoItemViewHolder(val binding: SubItemGameDetailInfoBinding, val onClickAction: (() -> Unit)? = null) : RecyclerView.ViewHolder(binding.root) {
fun bindInfoItem(context: Context, data: GameDetailInfo.InfoItem) {
binding.run {
nameTv.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
@ -95,6 +132,7 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
DirectUtils.directToExternalBrowser(context, context.getString(com.gh.gamecenter.common.R.string.icp_url))
}
}
onClickAction?.invoke()
}
}
}
@ -142,7 +180,8 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
viewModel: GameDetailViewModel,
privacyPolicyTv: TextView,
permissionsTv: TextView,
requestUpdateTv: TextView
requestUpdateTv: TextView,
onClickAction: (() -> Unit)? = null
) {
val privacyPolicyInfo = entity.fields.find { it.name == TYPE_PRIVACY_POLICY }
privacyPolicyTv.goneIf(privacyPolicyInfo == null) {
@ -157,6 +196,7 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
context.startActivity(intent)
}
}
onClickAction?.invoke()
}
}
@ -189,6 +229,7 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
permissions = permissionsInfo?.permissions
)
GamePermissionDialogFragment.show(context as AppCompatActivity, viewModel.game, gameInfo)
onClickAction?.invoke()
}
}
@ -205,6 +246,7 @@ class GameDetailInfoItemViewHolder(val binding: ItemGameDetailInfoBinding, viewM
viewModel.sendSuggestion()
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
onClickAction?.invoke()
}
}
}

View File

@ -15,6 +15,7 @@ import com.gh.gamecenter.common.view.divider.VerticalDividerItemDecoration
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.game.horizontal.GameHorizontalAdapter
import com.gh.gamecenter.game.horizontal.GameHorizontalListType
import com.gh.gamecenter.gamedetail.GameDetailViewModel
@ -22,55 +23,66 @@ import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailRecommendColumnItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val itemData = data.recommendColumn ?: return
val columnData = data.recommendColumn ?: return
binding.run {
titleTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
moreTv.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
moreTv.setDrawableEnd(com.gh.gamecenter.common.R.drawable.ic_auxiliary_arrow_right_12.toDrawable(context)?.apply {
colorFilter = PorterDuffColorFilter(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context), PorterDuff.Mode.SRC_ATOP)
})
titleTv.text = itemData.columnTitle
titleTv.text = columnData.columnTitle
moreTv.isEnabled = true
headPb.isVisible = false
moreTv.goneIf(itemData.displayHome.isEmpty()) {
moreTv.goneIf(columnData.displayHome.isEmpty()) {
moreTv.run {
text = itemData.displayHome
text = columnData.displayHome
setDebouncedClickListener {
NewFlatLogUtils.logGameDetailColumnRecommendUpperRightClick(
viewModel.game?.name ?: "",
viewModel.game?.id ?: "",
itemData.displayHome,
itemData.columnTitle,
itemData.columnId,
itemData.moreLink?.text ?: "",
itemData.moreLink?.type ?: "",
itemData.moreLink?.link ?: ""
columnData.displayHome,
columnData.columnTitle,
columnData.columnId,
columnData.moreLink?.text ?: "",
columnData.moreLink?.type ?: "",
columnData.moreLink?.link ?: ""
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
columnData.columnTitle,
sequence,
gameStatus = gameStatus
)
SensorsBridge.trackColumnClick(
location = "游戏详情",
gameName = viewModel.game?.name ?: "",
gameId = viewModel.game?.id ?: "",
gameColumnName = itemData.columnTitle,
gameColumnId = itemData.columnId,
linkText = itemData.moreLink?.text ?: "",
linkType = itemData.moreLink?.type ?: "",
linkId = itemData.moreLink?.link ?: "",
gameName = gameName,
gameId = gameId,
gameColumnName = columnData.columnTitle,
gameColumnId = columnData.columnId,
linkText = columnData.moreLink?.text ?: "",
linkType = columnData.moreLink?.type ?: "",
linkId = columnData.moreLink?.link ?: "",
text = "右上角",
buttonType = itemData.displayHome
buttonType = columnData.displayHome
)
if (itemData.displayHome == "换一批") {
if (columnData.displayHome == "换一批") {
headPb.isVisible = true
moreTv.isEnabled = false
viewModel.changeSubjectGame(itemData.columnId, itemData.gameCount) {
viewModel.changeSubjectGame(columnData.columnId, columnData.gameCount) {
headPb.isVisible = false
moreTv.isEnabled = true
}
} else {
itemData.moreLink?.let {
columnData.moreLink?.let {
DirectUtils.directToLinkPage(
context,
it,
@ -88,9 +100,9 @@ class GameDetailRecommendColumnItemViewHolder(
isNestedScrollingEnabled = false
layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
val subjectEntity = SubjectEntity().apply {
id = itemData.columnId
name = itemData.columnTitle
this.data = itemData.columnGames
id = columnData.columnId
name = columnData.columnTitle
this.data = columnData.columnGames
}
val exposureEventList = arrayListOf<ExposureEvent>()
for ((index, game) in subjectEntity.data!!.withIndex()) {
@ -99,14 +111,21 @@ class GameDetailRecommendColumnItemViewHolder(
gameEntity = game,
source = listOf(
ExposureSource("游戏详情", viewModel.game?.name ?: ""),
ExposureSource("专题推荐", itemData.columnTitle)
ExposureSource("专题推荐", columnData.columnTitle)
)
)
exposureEventList.add(event)
ExposureManager.log(event)
}
val subjectAdapter =
GameHorizontalAdapter(context, subjectEntity, GameHorizontalListType.GameDetailHorizontalType)
GameHorizontalAdapter(
context,
subjectEntity,
GameHorizontalListType.GameDetailHorizontalType,
gameDetailTrackData = baseTrackData.apply {
moduleName = columnData.columnTitle
},
getGameStatus = { gameStatus })
subjectAdapter.gameName = viewModel.game?.name ?: ""
subjectAdapter.game = viewModel.game
subjectAdapter.gameId = viewModel.game?.id ?: ""

View File

@ -7,21 +7,22 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.setDrawableEnd
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.desc.GameCollectionAdapter
import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailRecommendGameCollectionItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val gameCollectionList = data.linkRecommendGameList ?: return
@ -36,20 +37,15 @@ class GameDetailRecommendGameCollectionItemViewHolder(
moreTv.text = "游戏单广场"
moreTv.setOnClickListener {
NewFlatLogUtils.logGameDetailGameListRecommendSquareJump(viewModel.game?.name ?: "", viewModel.game?.id ?: "")
SensorsBridge.trackGameDetailPageGameCollectRecommendClick(
gameId = viewModel.game?.id ?: "",
gameName = viewModel.game?.name ?: "",
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageId = GlobalActivityManager.getCurrentPageEntity().pageId,
lastPageName = GlobalActivityManager.getCurrentPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
downloadStatus = viewModel.game?.downloadStatusChinese ?: "",
gameType = viewModel.game?.categoryChinese ?: "",
text = "游戏单广场",
gameCollectId = "",
gameCollectTitle = ""
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
"游戏单推荐",
sequence,
gameStatus = gameStatus
)
DirectUtils.directToGameCollectionSquare(it.context, viewModel.entrance ?: "")
}
@ -65,8 +61,7 @@ class GameDetailRecommendGameCollectionItemViewHolder(
viewModel.game,
viewModel.entrance ?: "",
"游戏详情[${viewModel.game?.name ?: ""}]:游戏单推荐",
listOf(ExposureSource("游戏详情", "${viewModel.game?.name ?: ""}+${viewModel.game?.id ?: ""}"))
)
listOf(ExposureSource("游戏详情", "${viewModel.game?.name ?: ""}+${viewModel.game?.id ?: ""}")), baseTrackData) { gameStatus }
}
} else {
recyclerView.adapter?.run {

View File

@ -15,6 +15,7 @@ import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.divider.VerticalDividerItemDecoration
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.game.horizontal.GameHorizontalAdapter
import com.gh.gamecenter.game.horizontal.GameHorizontalListType
import com.gh.gamecenter.gamedetail.GameDetailViewModel
@ -22,8 +23,9 @@ import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailRecommendGameItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkEveryonePlaying ?: return
@ -66,8 +68,9 @@ class GameDetailRecommendGameItemViewHolder(
context,
subjectEntity,
GameHorizontalListType.GameDetailHorizontalType,
false
)
false,
baseTrackData.apply { moduleName = "大家都在玩" }
) { gameStatus }
subjectAdapter.gameName = viewModel.game?.name ?: ""
subjectAdapter.game = viewModel.game
subjectAdapter.gameId = viewModel.game?.id ?: ""

View File

@ -1,21 +1,25 @@
package com.gh.gamecenter.gamedetail.viewholder
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.display
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.databinding.ItemGameDetailRecommendImageBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailRecommendImageItemViewHolder(
val binding: ItemGameDetailRecommendImageBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkImageRecommend ?: return
binding.run {
titleTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
titleTv.text = entity.title
imageIv.display(entity.img)
root.setOnClickListener { _ ->
entity.link?.let {
@ -25,6 +29,21 @@ class GameDetailRecommendImageItemViewHolder(
entrance = viewModel.entrance ?: "",
path = "游戏详情"
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.title,
sequence,
null,
null,
it.type,
it.link,
it.link,
gameStatus
)
}
}
}

View File

@ -11,6 +11,7 @@ import com.gh.gamecenter.common.utils.setDrawableEnd
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.game.vertical.SpanCountPagerSnapHelper
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.desc.GameDetailRelatedGameAdapter
@ -18,8 +19,9 @@ import com.gh.gamecenter.gamedetail.entity.GameDetailData
class GameDetailRelatedGameItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val gameList = data.linkRelatedGame ?: return
@ -45,7 +47,7 @@ class GameDetailRelatedGameItemViewHolder(
} else {
layoutManager = LinearLayoutManager(context)
}
adapter = GameDetailRelatedGameAdapter(context, viewModel.game, gameList, viewModel.entrance ?: "")
adapter = GameDetailRelatedGameAdapter(context, viewModel.game, gameList, viewModel.entrance ?: "", baseTrackData) { gameStatus }
}
} else {
recyclerView.adapter?.run {

View File

@ -16,6 +16,7 @@ import com.gh.gamecenter.databinding.ItemGameDetailMoreBinding
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.databinding.ItemGameDetailServerBinding
import com.gh.gamecenter.feature.entity.ServerCalendarEntity
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.desc.GameLatestServiceAdapter
import com.gh.gamecenter.gamedetail.entity.GameDetailData
@ -23,8 +24,9 @@ import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
class GameDetailServerItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkServer ?: return
@ -38,6 +40,16 @@ class GameDetailServerItemViewHolder(
moreTv.goneIf(entity.calendar.isEmpty()) {
moreTv.text = "更多"
moreTv.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
"游戏开服",
sequence,
gameStatus = gameStatus
)
val intent = ServersCalendarActivity.getIntent(
context,
viewModel.game!!,

View File

@ -19,6 +19,7 @@ import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.databinding.ItemGameDetailStrategyBinding
import com.gh.gamecenter.databinding.ItemGameDetailStrategyFixedTopBinding
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailStrategy
@ -27,8 +28,9 @@ import com.gh.gamecenter.newsdetail.NewsDetailActivity
class GameDetailStrategyItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkGameGuide ?: return
@ -44,6 +46,16 @@ class GameDetailStrategyItemViewHolder(
moreTv.isVisible = true
moreTv.setOnClickListener {
viewModel.setTabSelected(GameDetailTabEntity.TYPE_ZONE)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
} else if (entity.rightTop == "more") {
moreTv.text = "更多"
@ -56,6 +68,16 @@ class GameDetailStrategyItemViewHolder(
viewModel.entrance + "+(游戏详情[" + viewModel.game?.name + "]:新手攻略-全部)"
)
context.startActivity(intent)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
}
@ -101,6 +123,16 @@ class GameDetailStrategyItemViewHolder(
if (TimeUtils.isToday(it.publishOn)) "今天" else TimeUtils.getFormatTime(it.publishOn)
root.setOnClickListener { _ ->
skipNewsDetail(it, position)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkGameGuide?.name,
sequence,
gameStatus = gameStatus
)
}
}
communityArticleEntity?.let {
@ -110,6 +142,16 @@ class GameDetailStrategyItemViewHolder(
if (TimeUtils.isToday(it.time?.create ?: 0L)) "今天" else TimeUtils.getFormatTime(it.time?.create ?: 0L)
root.setOnClickListener { _ ->
DirectUtils.directToCommunityArticle(context, it.community, it.id, viewModel.entrance, "游戏详情-游戏攻略")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkGameGuide?.name,
sequence,
gameStatus = gameStatus
)
}
}
@ -130,6 +172,16 @@ class GameDetailStrategyItemViewHolder(
descTv.text = it.type ?: ""
root.setOnClickListener { _ ->
skipNewsDetail(it, position)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
itemData?.linkGameGuide?.name,
sequence,
gameStatus = gameStatus
)
}
}
}

View File

@ -5,11 +5,13 @@ import android.graphics.PorterDuffColorFilter
import android.text.Html
import androidx.core.view.isVisible
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.setDrawableEnd
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.databinding.ItemGameDetailUpdateBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.dialog.GameDetailScrollableTextDialogFragment
import com.gh.gamecenter.gamedetail.entity.GameDetailData
@ -17,8 +19,9 @@ import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
class GameDetailUpdateItemViewHolder(
val binding: ItemGameDetailUpdateBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkUpdate ?: return
@ -45,6 +48,16 @@ class GameDetailUpdateItemViewHolder(
entity.name,
entity.updateDes
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
historyTv.setOnClickListener {
context.startActivity(
@ -54,6 +67,16 @@ class GameDetailUpdateItemViewHolder(
viewModel.entrance ?: "",
"游戏详情-更新内容"
))
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
entity.name,
sequence,
gameStatus = gameStatus
)
}
}
}

View File

@ -12,6 +12,7 @@ import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.ItemGameDetailRecyclerViewBinding
import com.gh.gamecenter.databinding.ItemGameDetailVideoBinding
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.gh.gamecenter.gamedetail.entity.GameDetailData
import com.gh.gamecenter.gamedetail.entity.GameDetailVideo
@ -19,8 +20,9 @@ import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel
class GameDetailVideoItemViewHolder(
val binding: ItemGameDetailRecyclerViewBinding,
downloadBtn: DownloadButton,
viewModel: GameDetailViewModel
) : BaseGameDetailItemViewHolder(binding.root, viewModel) {
) : BaseGameDetailItemViewHolder(binding.root, downloadBtn, viewModel) {
override fun bindView(data: GameDetailData) {
super.bindView(data)
val entity = data.linkGameVideo ?: return
@ -35,6 +37,16 @@ class GameDetailVideoItemViewHolder(
moreTv.text = "更多"
moreTv.setOnClickListener {
DirectUtils.directToGameVideo(context, viewModel.gameId ?: "", viewModel.entrance, "游戏详情")
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"右上角",
moduleType,
"游戏视频",
sequence,
gameStatus = gameStatus
)
}
}
@ -74,6 +86,16 @@ class GameDetailVideoItemViewHolder(
context, video.id, VideoDetailContainerViewModel.Location.GAME_DETAIL.value,
false, viewModel.game?.id ?: "", viewModel.entrance, "游戏详情"
)
SensorsBridge.trackGameDetailModuleClick(
gameId,
gameName,
gameType,
"组件内容",
moduleType,
"游戏视频",
sequence,
gameStatus = gameStatus
)
}
}
}

View File

@ -1,203 +0,0 @@
package com.gh.gamecenter.home.custom.adapter
import android.content.Context
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.*
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder
import com.gh.gamecenter.home.PageConfigure
import com.gh.gamecenter.home.custom.model.CustomSubjectItem
import com.gh.gamecenter.home.custom.viewholder.CustomGameHorizontalItemViewHolder
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
import com.lightgame.download.DownloadEntity
class CustomGameHorizontalAdapter(
context: Context,
private val pageConfigure: PageConfigure
) : CustomBaseChildAdapter<GameEntity, CustomGameHorizontalItemViewHolder>(context) {
var gameName = ""
var gameId = ""
var game: GameEntity? = null
var path = ""
var exposureEventList: ArrayList<ExposureEvent>? = null
private val mDefaultHorizontalPadding by lazy { com.gh.gamecenter.common.R.dimen.game_detail_item_horizontal_padding.toPx() }
private lateinit var _data: CustomSubjectItem
private val subjectEntity: SubjectEntity
get() = _data.data
private val type: GameHorizontalListType
get() = if (subjectEntity.isMiniGame) {
GameHorizontalListType.MiniGameSubjectHorizontalType
} else {
GameHorizontalListType.SubjectHorizontalType
}
fun setData(data: CustomSubjectItem) {
_data = data
submitList(data.data.data)
}
override fun getKey(t: GameEntity): String {
return t.id
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
CustomGameHorizontalItemViewHolder(parent.toBinding())
override fun getItemCount(): Int {
val size = dataList.size
return when (type) {
GameHorizontalListType.GameDetailHorizontalType -> {
size
}
GameHorizontalListType.MiniGameSubjectHorizontalType -> {
dataList.size
}
else -> when {
size < 4 -> size
size < 8 -> 4
else -> 8
}
}
}
override fun onBindViewHolder(holder: CustomGameHorizontalItemViewHolder, position: Int) {
val params = holder.binding.root.layoutParams as RecyclerView.LayoutParams
params.width =
if (gameName.isNotBlank()) RecyclerView.LayoutParams.WRAP_CONTENT else RecyclerView.LayoutParams.MATCH_PARENT
if (type == GameHorizontalListType.GameDetailHorizontalType) {
params.leftMargin = if (position == 0) mDefaultHorizontalPadding else 8F.dip2px()
params.rightMargin = if (position == itemCount - 1) mDefaultHorizontalPadding else 0F.dip2px()
}
holder.binding.root.layoutParams = params
val gameEntity = getItem(position)
holder.binding.simpleGameContainer.run {
gameIcon.displayGameIcon(gameEntity)
GameHorizontalSimpleItemViewHolder.setHorizontalNameAndGravity(gameName, gameEntity.name)
downloadBtn.goneIf(!subjectEntity.showDownload)
gameName.maxLines = if (subjectEntity.showDownload) 1 else 2
}
holder.bindGameHorizontalItem(gameEntity, subjectEntity, false, false)
val entranceResult: String
val locationResult: String
if (type == GameHorizontalListType.GameDetailHorizontalType) {
entranceResult = StringUtils.buildString(
pageConfigure.entrance,
"+(",
"游戏详情",
"[",
gameName,
"]:${path}[",
(position + 1).toString(),
"])"
)
locationResult = StringUtils.buildString("游戏详情-", gameName, "-${path}", ":", gameEntity.name)
} else {
entranceResult =
StringUtils.buildString("(游戏-专题:", subjectEntity.name, "-列表[", (position + 1).toString(), "])")
locationResult = StringUtils.buildString("游戏-专题-", subjectEntity.name, ":", gameEntity.name)
}
holder.itemView.setOnClickListener {
if (type == GameHorizontalListType.GameDetailHorizontalType) {
DataCollectionUtils.uploadClick(context, path, "游戏详情", gameEntity.name)
NewLogUtils.logGameDetailPopularClick(gameName, gameId, "game", gameEntity.name ?: "")
SensorsBridge.trackGameDetailPagePopularClick(
gameId = gameId,
gameName = gameName,
pageName = GlobalActivityManager.getCurrentPageEntity().pageName,
pageId = GlobalActivityManager.getCurrentPageEntity().pageId,
pageBusinessId = GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId,
downloadStatus = game?.downloadStatusChinese ?: "",
gameType = game?.categoryChinese ?: "",
clickGameType = gameEntity.categoryChinese,
clickGameName = gameEntity.name ?: "",
clickGameId = gameEntity.id
)
}
if (gameEntity.isMiniGame()) {
MiniGameItemHelper.launchMiniGame(gameEntity)
} else {
GameDetailActivity.startGameDetailActivity(
context,
gameEntity.id,
entranceResult,
exposureEventList?.get(position)
)
}
}
if (subjectEntity.showDownload && type != GameHorizontalListType.GameDetailHorizontalType) {
DownloadItemUtils.setOnClickListener(
context,
holder.binding.simpleGameContainer.downloadBtn,
gameEntity,
position,
this,
entranceResult,
location = locationResult,
traceEvent = if (position < (exposureEventList?.size ?: 0)) exposureEventList!![position] else null
)
DownloadItemUtils.updateItem(
context,
gameEntity,
GameViewHolder(holder.binding.simpleGameContainer.root).apply {
gameDownloadBtn = holder.binding.simpleGameContainer.downloadBtn
gameDownloadTips = holder.binding.simpleGameContainer.downloadTipsLottie
multiVersionDownloadTv = holder.binding.simpleGameContainer.multiVersionDownloadTv
},
)
}
}
fun notifyItemByDownload(downloadEntity: DownloadEntity?) {
if (downloadEntity == null) {
notifyDataSetChanged()
} else {
subjectEntity.data?.forEachIndexed { position, gameEntity ->
if (downloadEntity.gameId == gameEntity.id) {
notifyItemChanged(position)
return
}
}
}
}
fun notifyChildItem(packageName: String) {
subjectEntity.data?.forEachIndexed { position, gameEntity ->
gameEntity.getApk().forEach { apkEntity ->
if (apkEntity.packageName == packageName) {
notifyItemChanged(position)
return
}
}
}
}
}
sealed class GameHorizontalListType {
object GameDetailHorizontalType : GameHorizontalListType()
object SubjectHorizontalType : GameHorizontalListType()
object MiniGameSubjectHorizontalType : GameHorizontalListType()
}

View File

@ -1,7 +1,9 @@
package com.gh.gamecenter.home.custom.viewholder
import androidx.lifecycle.LifecycleOwner
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.entity.PKEntity
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.databinding.ItemPkBinding
import com.gh.gamecenter.gamedetail.viewholder.GameDetailContentRecommendItemViewHolder.Companion.TYPE_PK
import com.gh.gamecenter.gamedetail.viewholder.GameDetailContentRecommendItemViewHolder.Companion.bindPKItem
@ -40,11 +42,35 @@ class CustomPKItemViewHolder(
} else {
pkView.updateView()
}
bindPKItem(itemView.context, this, link, pkEntity!!, onPositiveClickAction = {
bindPKItem(itemView.context, this, link, pkEntity!!, onPositiveClickAction = positive@{
if (pkEntity == null) return@positive
SensorsBridge.trackPKClick(
GlobalActivityManager.getCurrentPageEntity().pageName,
GlobalActivityManager.getCurrentPageEntity().pageId,
pkEntity!!.id,
pkEntity!!.title,
pkEntity!!.option1.text,
pkEntity!!.link?.type ?: "",
pkEntity!!.link?.link ?: "",
pkEntity!!.link?.text ?: ""
)
viewModel.postPKVote(pkEntity!!.id, true)
}, onNegativeClickAction = {
}, onNegativeClickAction = negative@{
if (pkEntity == null) return@negative
SensorsBridge.trackPKClick(
GlobalActivityManager.getCurrentPageEntity().pageName,
GlobalActivityManager.getCurrentPageEntity().pageId,
pkEntity!!.id,
pkEntity!!.title,
pkEntity!!.option2.text,
pkEntity!!.link?.type ?: "",
pkEntity!!.link?.link ?: "",
pkEntity!!.link?.text ?: ""
)
viewModel.postPKVote(pkEntity!!.id, false)
})
}) {
// TODO
}
}
}
}

View File

@ -131,7 +131,7 @@ import com.gh.gamecenter.feature.entity.SimulatorEntity;
import com.gh.gamecenter.feature.entity.UserEntity;
import com.gh.gamecenter.feature.entity.ViewsEntity;
import com.gh.gamecenter.feature.entity.WXSubscribeMsgConfig;
import com.gh.gamecenter.gamedetail.entity.BigEvent;
import com.gh.gamecenter.gamedetail.entity.GameDetailBasicInfo;
import com.gh.gamecenter.gamedetail.entity.GameDetailSetting;
import com.gh.gamecenter.gamedetail.entity.GameDetailTabEntity;
import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity;
@ -1956,7 +1956,7 @@ public interface ApiService {
* 获取游戏大事件
*/
@GET("games/{gameId}/events")
Observable<List<BigEvent>> getBigEvent(@Path("gameId") String gameId);
Observable<List<GameDetailBasicInfo.BigEvent>> getBigEvent(@Path("gameId") String gameId);
/**
* 获取游戏开服详情数据(注:和游戏详情获取到的开服数据是有区别的)

View File

@ -0,0 +1,19 @@
package com.gh.gamecenter.room.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.gh.gamecenter.entity.HistoryGameDetailEntity
@Dao
interface GameDetailHistoryDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun addGame(game: HistoryGameDetailEntity)
@Query("select * from HistoryGameDetailEntity where id = :id")
fun getHistoryGameDetailById(id: String): HistoryGameDetailEntity
@Query("select * from HistoryGameDetailEntity")
fun getAllHistoryGameDetail(): List<HistoryGameDetailEntity>
}

View File

@ -13,7 +13,6 @@
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:gravity="center_vertical"
android:textColor="@color/text_primary"
android:textSize="@dimen/primary_title_text_size"

View File

@ -98,6 +98,7 @@ object SensorsBridge {
private const val KEY_BUTTON_TYPE = "button_type"
const val KEY_MODULE_TYPE = "module_type"
const val KEY_MODULE_PATTERN = "module_pattern"
const val KEY_MODULE_NAME = "module_name"
const val KEY_LINK_CONTENT_NAME = "link_content_name"
const val KEY_LINK_CONTENT_ID = "link_content_id"
private const val KEY_GAME_LIST_COLLECTION_ID = "game_list_collection_id"
@ -125,11 +126,8 @@ object SensorsBridge {
private const val EVENT_GAME_DETAIL_PAGE_TAB_SELECT = "GameDetailPageTabSelect"
private const val EVENT_GAME_DETAIL_PAGE_TAG_CLICK = "GameDetailPageGameTagClick"
private const val EVENT_GAME_DETAIL_PAGE_CONTENT_CARD_CLICK = "GameDetailPageContentCardClick"
private const val EVENT_GAME_DETAIL_PAGE_MAJOR_EVENT_CLICK = "GameDetailPageMajorEventClick"
private const val EVENT_GAME_DETAIL_PAGE_RELATED_GAME_CLICK = "GameDetailPageRelatedGameClick"
private const val EVENT_GAME_DETAIL_PAGE_POPULAR_CLICK = "GameDetailPagePopularClick"
private const val EVENT_GAME_DETAIL_PAGE_COLLECT_RECOMMEND_CLICK = "GameDetailPageGameCollectRecommendClick"
private const val EVENT_ADOLESCENT_MODE_DIALOG_SHOW = "AdolescentModeDialogShow"
private const val EVENT_ADOLESCENT_MODE_DIALOG_CLICK = "AdolescentModeDialogClick"
private const val EVENT_SWITCH_INSTALL_DIALOG_SHOW = "SwitchInstallDialogShow"
@ -303,6 +301,9 @@ object SensorsBridge {
private const val EVENT_APPOINTMENT_GAME_ONLINE_DIALOG_SHOW = "AppointmentGameOnlineDialogShow"
private const val EVENT_APPOINTMENT_GAME_ONLINE_DIALOG_CLICK = "AppointmentGameOnlineDialogClick"
private const val EVENT_PK_CLICK = "PkClick"
private const val EVENT_GAME_DETAIL_MODULE_CLICK = "GameDetailModuleClick"
private var mIsSensorsEnabled = false
private val mSensor by lazy {
@ -479,120 +480,6 @@ object SensorsBridge {
trackEvent(EVENT_GAME_DETAIL_PAGE_TAB_SELECT, json)
}
/**
* 序号45
* 事件IDGameDetailPageGameTagClick
* 事件名称:游戏详情页游戏标签点击事件
* @param gameId 游戏ID
* @param gameName 游戏名称
* @param pageName 页面名称
* @param pageId 页面Id
* @param pageBusinessId 页面业务ID
* @param lastPageName 上一个页面名称
* @param lastPageId 上一页页面ID
* @param lastPageBusinessId 上一页页面业务ID
* @param downloadStatus 下载状态
* @param gameType 游戏类型
* @param position 序号
* @param gameTag 游戏标签
* @param gameTagId 游戏标签ID
* @see EVENT_GAME_DETAIL_PAGE_TAG_CLICK
*/
@JvmStatic
fun trackGameDetailPageGameTagClick(
gameId: String,
gameName: String,
pageName: String,
pageId: String,
pageBusinessId: String,
lastPageName: String,
lastPageId: String,
lastPageBusinessId: String,
downloadStatus: String,
gameType: String,
position: Int,
gameTag: List<String>,
gameTagId: String
) {
val json = json {
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_PAGE_NAME to pageName
KEY_PAGE_ID to pageId
KEY_PAGE_BUSINESS_ID to pageBusinessId
KEY_LAST_PAGE_ID to lastPageId
KEY_LAST_PAGE_NAME to lastPageName
KEY_LAST_PAGE_BUSINESS_ID to lastPageBusinessId
KEY_DOWNLOAD_STATUS to downloadStatus
KEY_GAME_TYPE to gameType
KEY_POSITION to position
KEY_GAME_TAG to gameTag
KEY_GAME_TAG_ID to gameTagId
}
trackEvent(EVENT_GAME_DETAIL_PAGE_TAG_CLICK, json)
}
/**
* 序号46
* 事件IDGameDetailPageContentCardClick
* 事件名称:游戏详情页内容卡片点击事件
* @param gameId 游戏ID
* @param gameName 游戏名称
* @param pageName 页面名称
* @param pageId 页面Id
* @param pageBusinessId 页面业务ID
* @param lastPageName 上一个页面名称
* @param lastPageId 上一页页面ID
* @param lastPageBusinessId 上一页页面业务ID
* @param downloadStatus 下载状态
* @param gameType 游戏类型
* @param position 序号
* @param title 标题
* @param linkType 链接类型
* @param linkId 跳转链接
* @param linkText 链接文案
* @see EVENT_GAME_DETAIL_PAGE_CONTENT_CARD_CLICK
*/
@JvmStatic
fun trackGameDetailPageContentCardClick(
gameId: String,
gameName: String,
pageName: String,
pageId: String,
pageBusinessId: String,
lastPageName: String,
lastPageId: String,
lastPageBusinessId: String,
downloadStatus: String,
gameType: String,
position: Int,
title: String,
linkType: String,
linkId: String,
linkText: String
) {
val json = json {
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_PAGE_NAME to pageName
KEY_PAGE_ID to pageId
KEY_PAGE_BUSINESS_ID to pageBusinessId
KEY_LAST_PAGE_ID to lastPageId
KEY_LAST_PAGE_NAME to lastPageName
KEY_LAST_PAGE_BUSINESS_ID to lastPageBusinessId
KEY_DOWNLOAD_STATUS to downloadStatus
KEY_GAME_TYPE to gameType
KEY_POSITION to position
KEY_TITLE to title
KEY_LINK_TYPE to linkType
KEY_LINK_ID to linkId
KEY_LINK_TEXT to linkText
}
trackEvent(EVENT_GAME_DETAIL_PAGE_CONTENT_CARD_CLICK, json)
}
/**
* 序号47
* 事件IDGameDetailPageMajorEventClick
@ -704,114 +591,6 @@ object SensorsBridge {
trackEvent(EVENT_GAME_DETAIL_PAGE_RELATED_GAME_CLICK, json)
}
/**
* 序号49
* 事件名称GameDetailPagePopularClick
* 事件名称:游戏详情页大家都在玩点击事件
* @param gameId 游戏ID
* @param gameName 游戏名称
* @param pageName 页面名称
* @param pageId 页面Id
* @param pageBusinessId 页面业务ID
* @param lastPageName 上一个页面名称
* @param lastPageId 上一页页面ID
* @param lastPageBusinessId 上一页页面业务ID
* @param downloadStatus 下载状态
* @param gameType 游戏类型
* @param clickGameId 点击游戏ID
* @param clickGameName 点击游戏名称
* @param clickGameType 点击游戏类型
* @see EVENT_GAME_DETAIL_PAGE_POPULAR_CLICK
*/
@JvmStatic
fun trackGameDetailPagePopularClick(
gameId: String,
gameName: String,
pageName: String,
pageId: String,
pageBusinessId: String,
lastPageName: String,
lastPageId: String,
lastPageBusinessId: String,
downloadStatus: String,
gameType: String,
clickGameId: String,
clickGameName: String,
clickGameType: String
) {
val json = json {
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_PAGE_NAME to pageName
KEY_PAGE_ID to pageId
KEY_PAGE_BUSINESS_ID to pageBusinessId
KEY_LAST_PAGE_ID to lastPageId
KEY_LAST_PAGE_NAME to lastPageName
KEY_LAST_PAGE_BUSINESS_ID to lastPageBusinessId
KEY_DOWNLOAD_STATUS to downloadStatus
KEY_GAME_TYPE to gameType
KEY_CLICK_GAME_ID to clickGameId
KEY_CLICK_GAME_NAME to clickGameName
KEY_CLICK_GAME_TYPE to clickGameType
}
trackEvent(EVENT_GAME_DETAIL_PAGE_POPULAR_CLICK, json)
}
/**
* 序号50
* 事件IDGameDetailPageGameCollectRecommendClick
* 事件名称:游戏详情页游戏单推荐点击事件
* @param gameId 游戏ID
* @param gameName 游戏名称
* @param pageName 页面名称
* @param pageId 页面Id
* @param pageBusinessId 页面业务ID
* @param lastPageName 上一个页面名称
* @param lastPageId 上一页页面ID
* @param lastPageBusinessId 上一页页面业务ID
* @param downloadStatus 下载状态
* @param gameType 游戏类型
* @param text 点击内容
* @param gameCollectTitle 游戏单标题
* @param gameCollectId 游戏单ID
* @see EVENT_GAME_DETAIL_PAGE_COLLECT_RECOMMEND_CLICK
*/
@JvmStatic
fun trackGameDetailPageGameCollectRecommendClick(
gameId: String,
gameName: String,
pageName: String,
pageId: String,
pageBusinessId: String,
lastPageName: String,
lastPageId: String,
lastPageBusinessId: String,
downloadStatus: String,
gameType: String,
text: String,
gameCollectTitle: String,
gameCollectId: String
) {
val json = json {
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_PAGE_NAME to pageName
KEY_PAGE_ID to pageId
KEY_PAGE_BUSINESS_ID to pageBusinessId
KEY_LAST_PAGE_ID to lastPageId
KEY_LAST_PAGE_NAME to lastPageName
KEY_LAST_PAGE_BUSINESS_ID to lastPageBusinessId
KEY_DOWNLOAD_STATUS to downloadStatus
KEY_GAME_TYPE to gameType
KEY_TEXT to text
KEY_GAME_COLLECT_TITLE to gameCollectTitle
KEY_GAME_COLLECT_ID to gameCollectId
}
trackEvent(EVENT_GAME_DETAIL_PAGE_COLLECT_RECOMMEND_CLICK, json)
}
/**
* 序号51
* 事件IDAdolescentModeDialogShow
@ -4982,4 +4761,70 @@ object SensorsBridge {
}
trackEvent(EVENT_APPOINTMENT_GAME_ONLINE_DIALOG_CLICK, json)
}
/**
* 事件ID:PkClick
* 事件名称:PK组件点击事件
* 触发时机:点击PK组件时上报
*/
fun trackPKClick(
pageId: String,
pageName: String,
pkId: String,
pkName: String,
option: String,
linkType: String,
linkId: String,
linkText: String
) {
val json = json {
KEY_PAGE_ID to pageId
KEY_PAGE_NAME to pageName
"pk_id" to pkId
"pk_name" to pkName
"option" to option
KEY_LINK_TYPE to linkType
KEY_LINK_ID to linkId
KEY_LINK_TEXT to linkText
}
trackEvent(EVENT_PK_CLICK, json)
}
/**
* 事件ID:GameDetailModuleClick
* 事件名称:游戏详情详情tab内组件点击
* 触发时机:在游戏详情的详情tab点击触发跳转/打开弹窗时上报
*/
fun trackGameDetailModuleClick(
gameId: String?,
gameName: String?,
gameType: String?,
contentType: String?,
moduleType: String?,
moduleName: String?,
sequence: Int?,
subModuleName: String? = null,
supSequence: Int? = null,
linkType: String? = null,
linkId: String? = null,
linkText: String? = null,
gameStatus: String?
) {
val json = json {
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_GAME_TYPE to gameType
KEY_CONTENT_TYPE to contentType
KEY_MODULE_TYPE to moduleType
KEY_MODULE_NAME to moduleName
KEY_SEQUENCE to sequence
"sub_module_name" to subModuleName
"sup_sequence" to supSequence
KEY_LINK_TYPE to linkType
KEY_LINK_ID to linkId
KEY_LINK_TEXT to linkText
"game_status" to gameStatus
}
trackEvent(EVENT_GAME_DETAIL_MODULE_CLICK, json)
}
}