From c79128d6f47e098407a391895c3979c8f52c6dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E7=BB=B4?= Date: Tue, 29 Aug 2023 15:40:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A5=9E=E7=AD=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E7=AC=AC=E4=BA=8C=E6=9C=9F(1)=E2=80=94?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=20https://jira.shanqu.cc/browse/GHZ?= =?UTF-8?q?S-3172?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gh/common/DefaultUrlHandler.kt | 5 +- .../java/com/gh/common/util/CommentUtils.java | 1 + .../com/gh/common/util/DownloadItemUtils.kt | 4 +- .../common/util/GameActivityDownloadHelper.kt | 2 +- .../java/com/gh/common/util/NewLogUtils.kt | 2 +- .../collection/GamesCollectionAdapter.kt | 150 ++++++++++++++-- .../collection/GamesCollectionFragment.kt | 25 ++- .../fragment/HomeSearchToolWrapperFragment.kt | 98 ++++++++++- .../gh/gamecenter/game/GameFragmentAdapter.kt | 9 + .../gamecenter/game/GameNavigationAdapter.kt | 23 ++- .../detail/GameCollectionDetailFragment.kt | 10 ++ .../hotlist/GameCollectionHotListAdapter.kt | 30 +++- .../hotlist/GameCollectionHotListFragment.kt | 14 +- .../GameCollectionHotListWrapperFragment.kt | 13 +- .../GameCollectionPlayerCreationAdapter.kt | 22 ++- .../GameCollectionPlayerCreationFragment.kt | 7 + .../mine/MyGameCollectionFragment.kt | 18 +- .../mine/MyGameCollectionViewHolder.kt | 98 +++++++++-- .../publish/GameCollectionEditActivity.kt | 162 ++++++++++++++++-- .../square/GameCollectionBannerAdapter.kt | 12 +- .../square/GameCollectionSquareAdapter.kt | 16 +- .../square/GameCollectionSquareFragment.kt | 52 +++++- .../square/GameCollectionSquareViewModel.kt | 1 + .../tag/GameCollectionTagSelectFragment.kt | 22 ++- .../gh/gamecenter/home/HomeFragmentAdapter.kt | 2 +- .../LegacyHomeFragmentAdapterAssistant.kt | 10 +- .../HomeGameCollectionCarouselAdapter.kt | 141 +++++++-------- .../HomeGameCollectionRefreshAdapter.kt | 26 ++- .../HomeGameCollectionRefreshViewHolder.kt | 28 +++ .../slide/HomeGameCollectionSlideAdapter.kt | 59 +++++++ .../recommend/HomeRecommendItemGridAdapter.kt | 2 +- .../slide/HomeSlideWithCardsViewHolder.kt | 23 ++- .../gh/gamecenter/mygame/MyGameActivity.kt | 12 +- .../qa/article/edit/ArticleEditActivity.kt | 21 ++- .../gamecenter/qa/comment/CommentActivity.kt | 5 + .../qa/comment/NewCommentFragment.kt | 18 +- .../common/constant/EntranceConsts.java | 1 + .../gamecenter/common/utils/DialogHelper.kt | 12 +- .../setting/view/SettingsFragment.kt | 2 +- 39 files changed, 959 insertions(+), 199 deletions(-) diff --git a/app/src/main/java/com/gh/common/DefaultUrlHandler.kt b/app/src/main/java/com/gh/common/DefaultUrlHandler.kt index 000c4ec595..939a69e626 100644 --- a/app/src/main/java/com/gh/common/DefaultUrlHandler.kt +++ b/app/src/main/java/com/gh/common/DefaultUrlHandler.kt @@ -490,12 +490,13 @@ object DefaultUrlHandler { val activityName = uri.getQueryParameter("activity_name") ?: "" val gameId = uri.getQueryParameter("game_id") ?: "" context.startActivity( - GameCollectionEditActivity.getIntent( + GameCollectionEditActivity.getCreateIntent( context, activityId, activityName, gameId, - entrance + entrance, + "其他" ) ) } diff --git a/app/src/main/java/com/gh/common/util/CommentUtils.java b/app/src/main/java/com/gh/common/util/CommentUtils.java index 49c75b7734..56cec028c4 100644 --- a/app/src/main/java/com/gh/common/util/CommentUtils.java +++ b/app/src/main/java/com/gh/common/util/CommentUtils.java @@ -177,6 +177,7 @@ public class CommentUtils { return null; }, null, + null, new DialogHelper.Config("", false, true, true, false, -1) ); break; diff --git a/app/src/main/java/com/gh/common/util/DownloadItemUtils.kt b/app/src/main/java/com/gh/common/util/DownloadItemUtils.kt index 92692186a1..4468aa8b3e 100644 --- a/app/src/main/java/com/gh/common/util/DownloadItemUtils.kt +++ b/app/src/main/java/com/gh/common/util/DownloadItemUtils.kt @@ -664,7 +664,7 @@ object DownloadItemUtils { gameType = gameEntity.categoryChinese ) }, - DialogHelper.Config( + extraConfig = DialogHelper.Config( centerTitle = true, centerContent = true ) @@ -691,7 +691,7 @@ object DownloadItemUtils { } }, {}, - DialogHelper.Config( + extraConfig = DialogHelper.Config( centerTitle = true, centerContent = true ) diff --git a/app/src/main/java/com/gh/common/util/GameActivityDownloadHelper.kt b/app/src/main/java/com/gh/common/util/GameActivityDownloadHelper.kt index d7a175aaf5..5c2bf111cc 100644 --- a/app/src/main/java/com/gh/common/util/GameActivityDownloadHelper.kt +++ b/app/src/main/java/com/gh/common/util/GameActivityDownloadHelper.kt @@ -137,7 +137,7 @@ object GameActivityDownloadHelper { gameType = mGameEntity?.categoryChinese ?: "" ) }, - DialogHelper.Config( + extraConfig = DialogHelper.Config( centerTitle = true, centerContent = true ) diff --git a/app/src/main/java/com/gh/common/util/NewLogUtils.kt b/app/src/main/java/com/gh/common/util/NewLogUtils.kt index 229d549afc..f25e40fd33 100644 --- a/app/src/main/java/com/gh/common/util/NewLogUtils.kt +++ b/app/src/main/java/com/gh/common/util/NewLogUtils.kt @@ -1646,7 +1646,7 @@ object NewLogUtils { } //进入创建游戏单 - fun logEnterGameCollectionEdit(entrance: String) { + fun logEnterGameCollectionCreate(entrance: String) { val json = json { KEY_EVENT to "enter_game_collect_create_location" KEY_ENTRANCE to entrance diff --git a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt index 5466f242a4..ca4fe0106b 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt @@ -15,20 +15,24 @@ import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.RecyclerView import com.gh.common.exposure.IExposable -import com.gh.gamecenter.common.constant.ItemViewType -import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler -import com.gh.common.util.* +import com.gh.common.util.CheckLoginUtils +import com.gh.common.util.DirectUtils import com.gh.common.util.NewLogUtils import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R -import com.gh.gamecenter.common.viewholder.FooterViewHolder import com.gh.gamecenter.adapter.viewholder.GameCollectionItemViewHolder -import com.gh.gamecenter.common.baselist.ListAdapter import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER +import com.gh.gamecenter.common.baselist.ListAdapter +import com.gh.gamecenter.common.constant.ItemViewType import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json +import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.DrawableView -import com.gh.gamecenter.core.utils.* +import com.gh.gamecenter.common.viewholder.FooterViewHolder +import com.gh.gamecenter.core.utils.NumberUtils +import com.gh.gamecenter.core.utils.TimeUtils +import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding import com.gh.gamecenter.databinding.PopupHistoryOptionBinding import com.gh.gamecenter.entity.GamesCollectionEntity @@ -398,26 +402,146 @@ class GamesCollectionAdapter( } private fun dealOption(content: String, entity: GamesCollectionEntity) { + val path = when (mViewModel.type) { + GamesCollectionFragment.TYPE_COLLECT -> "我的收藏" + GamesCollectionFragment.TYPE_HISTORY -> "浏览记录" + GamesCollectionFragment.TYPE_USER -> "个人主页" + else -> "" + } when (content) { "编辑" -> { - mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity)) + mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity, path = path)) } "投稿" -> { + SensorsBridge.trackEvent("GameCollectContributeClick", json { + "source_entrance" to path + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) if ((entity.count?.game ?: 0) >= 8) { - DialogHelper.showDialog(mContext, "温馨提示", "投稿通过后,将自动关闭“仅自己可见”,所有用户都能浏览到游戏单,确定投稿?", "确定", "取消", { - mViewModel.publishGameCollection(entity) - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogShow", json { + "source_entrance" to path + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + DialogHelper.showDialog( + mContext, + "温馨提示", + "投稿通过后,将自动关闭“仅自己可见”,所有用户都能浏览到游戏单,确定投稿?", + "确定", + "取消", + { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "确定" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + mViewModel.publishGameCollection(entity) + }, + { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "取消" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "关闭弹窗" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } else { - DialogHelper.showDialog(mContext, "温馨提示", "游戏单需要收录至少8个游戏,才可以投稿至游戏单广场哦~", "添加游戏", "我知道了", { - mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity)) - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogShow", json { + "source_entrance" to path + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + DialogHelper.showDialog( + mContext, + "温馨提示", + "游戏单需要收录至少8个游戏,才可以投稿至游戏单广场哦~", + "添加游戏", + "我知道了", + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "添加游戏" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity, path = path)) + }, + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "我知道了" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "关闭弹窗" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } } "删除" -> { + SensorsBridge.trackEvent("GameCollectDeleteClick", json { + "source_entrance" to path + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + SensorsBridge.trackEvent("GameCollectDeleteDialogShow", json { + "source_entrance" to path + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) DialogHelper.showDialog(mContext, "温馨提示", "游戏单删除后将无法恢复,是否确认删除", "确定", "取消", { + SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json { + "source_entrance" to path + "button_name" to "确定" + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) mViewModel.deleteGameCollection(entity) + }, { + SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json { + "source_entrance" to path + "button_name" to "取消" + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, { + SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json { + "source_entrance" to path + "button_name" to "关闭弹窗" + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) } } diff --git a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionFragment.kt b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionFragment.kt index 5798c67548..b0c428422a 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionFragment.kt @@ -4,20 +4,22 @@ import android.os.Bundle import android.view.View import androidx.core.content.ContextCompat import com.gh.common.exposure.ExposureListener -import com.gh.gamecenter.common.constant.EntranceConsts.* -import com.gh.gamecenter.common.view.SpacingItemDecoration import com.gh.gamecenter.R import com.gh.gamecenter.common.baselist.ListFragment import com.gh.gamecenter.common.baselist.LoadType +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.SensorsBridge import com.gh.gamecenter.common.utils.dip2px import com.gh.gamecenter.common.utils.toColor import com.gh.gamecenter.common.utils.viewModelProvider +import com.gh.gamecenter.common.view.SpacingItemDecoration import com.gh.gamecenter.entity.GamesCollectionEntity -import com.gh.gamecenter.common.eventbus.EBReuse -import org.greenrobot.eventbus.Subscribe -import org.greenrobot.eventbus.ThreadMode import com.gh.gamecenter.history.IBatchDelete import com.gh.gamecenter.history.ManageOption +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode class GamesCollectionFragment : ListFragment(), IBatchDelete { @@ -76,6 +78,19 @@ class GamesCollectionFragment : ListFragment "我的收藏" + TYPE_HISTORY -> "浏览记录" + TYPE_USER -> "个人主页" + else -> "" + } + SensorsBridge.trackEvent("GameCollectContributeSuccess", json { + "source_entrance" to path + "game_num" to it.count?.game + "game_collect_title" to it.title + "game_collect_id" to it.id + }) } mListRv.addOnScrollListener(ExposureListener(this, provideListAdapter())) diff --git a/app/src/main/java/com/gh/gamecenter/fragment/HomeSearchToolWrapperFragment.kt b/app/src/main/java/com/gh/gamecenter/fragment/HomeSearchToolWrapperFragment.kt index b209ae2727..a35585c74f 100644 --- a/app/src/main/java/com/gh/gamecenter/fragment/HomeSearchToolWrapperFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/fragment/HomeSearchToolWrapperFragment.kt @@ -18,17 +18,20 @@ import com.gh.gamecenter.amway.AmwayFragment 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.exposure.ExposureSource import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.TabIndicatorView -import com.gh.gamecenter.core.utils.* +import com.gh.gamecenter.core.utils.DisplayUtils +import com.gh.gamecenter.core.utils.MD5Utils +import com.gh.gamecenter.core.utils.SPUtils +import com.gh.gamecenter.core.utils.TimeElapsedHelper import com.gh.gamecenter.databinding.FragmentMainHomeWrapperBinding import com.gh.gamecenter.entity.HomePush import com.gh.gamecenter.entity.SubjectRecommendEntity import com.gh.gamecenter.eventbus.EBDownloadStatus import com.gh.gamecenter.eventbus.EBPackage import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.feature.exposure.time.TimeUtil import com.gh.gamecenter.feature.game.GameItemViewHolder import com.gh.gamecenter.gamecollection.square.GameCollectionSquareFragment @@ -61,6 +64,7 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { private var mOffsetCritical = 0.7F + private var mHomePushAction = "" // 触发行为(主动展开/自动展开) private var mShowTwoLevel = false private var mIsDragging = false private var mHomePushClick = false @@ -175,6 +179,7 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { } refreshLayout.setOnMultiPurposeListener(object : SimpleMultiPurposeListener() { override fun onRefresh(refreshLayout: RefreshLayout) { + SensorsBridge.trackEvent("HomePageRefresh") if (mBinding?.viewPager?.currentItem == mHomeTabPosition) { getValidHomeFragment()?.onRefresh() } @@ -209,7 +214,19 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { mHomePush?.run { if (isAutoScrollToTwoLevel) { + mHomePushAction = "自动展开" mTwoLevelOpenCount++ + SensorsBridge.trackEvent( + "HomePushShow", + "home_push_id", + id, + "game_name", + game?.name ?: "", + "game_id", + game?.id ?: "", + "action", + "自动展开" + ) com.gh.common.util.NewFlatLogUtils.logHomePushShow( id, "自动展开", @@ -219,6 +236,18 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { ) } if (isShowTwoLevelByDrag) { + mHomePushAction = "主动展开" + SensorsBridge.trackEvent( + "HomePushShow", + "home_push_id", + id, + "game_name", + game?.name ?: "", + "game_id", + game?.id ?: "", + "action", + "主动展开" + ) com.gh.common.util.NewFlatLogUtils.logHomePushShow( id, "主动展开", @@ -229,6 +258,15 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { } if (isDragToTwoLevel) { mTwoLevelOpenCount++ + SensorsBridge.trackEvent( + "HomePushTrigger", + "home_push_id", + id, + "game_name", + game?.name ?: "", + "game_id", + game?.id ?: "" + ) com.gh.common.util.NewFlatLogUtils.logHomePushTrigger( id, mTwoLevelOpenCount, @@ -249,6 +287,19 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { if (mIsDragging) { mElapsedHelper.pauseCounting() mHomePush?.run { + SensorsBridge.trackEvent( + "HomePushClick", + "home_push_id", + id, + "game_name", + game?.name ?: "", + "game_id", + game?.id ?: "", + "action", + mHomePushAction, + "button_name", + "关闭推送" + ) com.gh.common.util.NewFlatLogUtils.logHomePushClose( id, "主动收起", @@ -341,7 +392,22 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { "新首页-下拉推送", "", mExposureEvent, - { updateHomePushDownloadBtn() }, + { + updateHomePushDownloadBtn() + SensorsBridge.trackEvent( + "HomePushClick", + "home_push_id", + id, + "game_name", + this.name ?: "", + "game_id", + this.id, + "action", + mHomePushAction, + "button_name", + "下载按钮" + ) + }, { updateHomePushDownloadBtn() }, null ) @@ -456,6 +522,19 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { headerContainer.setOnClickListener { if (mShowTwoLevel) { mHomePushClick = true + SensorsBridge.trackEvent( + "HomePushClick", + "home_push_id", + id, + "game_name", + game.name ?: "", + "game_id", + game.id, + "action", + mHomePushAction, + "button_name", + "游戏详情" + ) GameDetailActivity.startGameDetailActivity( requireContext(), game.id, @@ -597,6 +676,19 @@ class HomeSearchToolWrapperFragment : HomeTabWrapperFragment() { mBinding?.twoLevelHeader?.finishTwoLevel() mElapsedHelper.pauseCounting() mHomePush?.run { + SensorsBridge.trackEvent( + "HomePushClick", + "home_push_id", + id, + "game_name", + game?.name ?: "", + "game_id", + game?.id ?: "", + "action", + mHomePushAction, + "button_name", + "关闭推送" + ) com.gh.common.util.NewFlatLogUtils.logHomePushClose( id, action, diff --git a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt index 0123e7e33b..19299853ad 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt @@ -34,6 +34,7 @@ import com.gh.gamecenter.common.entity.CommunityEntity import com.gh.gamecenter.common.entity.ExposureEntity import com.gh.gamecenter.common.entity.LinkEntity import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.FixGridLayoutManager import com.gh.gamecenter.common.view.GridSpacingItemDecoration @@ -1307,6 +1308,14 @@ class GameFragmentAdapter( column.id ?: "", "游戏单广场" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "版块" + "block_name" to mViewModel.blockData?.name + "block_id" to mViewModel.blockData?.link + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "游戏单广场" + }) DirectUtils.directToGameCollectionSquare( mContext, "版块内容列表", diff --git a/app/src/main/java/com/gh/gamecenter/game/GameNavigationAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/GameNavigationAdapter.kt index 2d53ebe034..b975a1278c 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameNavigationAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameNavigationAdapter.kt @@ -4,22 +4,20 @@ import android.content.Context import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView - -import com.gh.common.exposure.* -import com.gh.common.util.* -import com.gh.gamecenter.common.baselist.ListAdapter +import com.gh.common.exposure.ExposureManager +import com.gh.common.exposure.ExposureTraceUtils +import com.gh.common.util.DirectUtils import com.gh.gamecenter.common.base.BaseRecyclerViewHolder +import com.gh.gamecenter.common.baselist.ListAdapter import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.entity.ExposureEntity -import com.gh.gamecenter.common.utils.ImageUtils -import com.gh.gamecenter.common.utils.goneIf -import com.gh.gamecenter.common.utils.safelyGetInRelease -import com.gh.gamecenter.common.utils.toBinding +import com.gh.gamecenter.common.json.json +import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.utils.PageSwitchDataHelper import com.gh.gamecenter.core.utils.SPUtils import com.gh.gamecenter.databinding.ItemGameNavigationBinding -import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.entity.GameNavigationEntity +import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.feature.exposure.ExposureEvent import com.gh.gamecenter.feature.exposure.ExposureType @@ -97,6 +95,13 @@ class GameNavigationAdapter(val mContext: Context, val blockId: String, val bloc Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, blockName) ) ) + SensorsBridge.trackEvent("NavigationClick", json { + "position" to position + "Navigation_name" to entity.entryName + "Navigation_id" to entity.id + "block_name" to blockName + "block_id" to blockId + }) DirectUtils.directToLinkPage( mContext, it, diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt index c078f9a4df..ab0a711cd3 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt @@ -853,6 +853,15 @@ class GameCollectionDetailFragment : } if (!commentId.isNullOrEmpty()) { mListViewModel.getSingleCommentDetail(commentId) + SensorsBridge.trackEvent( + "GameCollectDetailCommentClick", + "result", + "发表成功", + "game_collect_title", + mEntity?.title ?: "", + "game_collect_id", + mEntity?.id ?: "" + ) } else { mListViewModel.load(LoadType.REFRESH) } @@ -1107,6 +1116,7 @@ class GameCollectionDetailFragment : val intent = CommentActivity.getGameCollectionCommentIntent( requireContext(), id, + title, count?.comment ?: 0 ) startActivityForResult(intent, CommentActivity.REQUEST_CODE) diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt index a68cf0f68c..32b854bbea 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt @@ -17,6 +17,8 @@ import com.gh.gamecenter.common.base.BaseRecyclerViewHolder import com.gh.gamecenter.common.base.activity.BaseActivity import com.gh.gamecenter.common.baselist.ListAdapter import com.gh.gamecenter.common.constant.ItemViewType +import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.viewholder.FooterViewHolder import com.gh.gamecenter.core.utils.DisplayUtils @@ -24,11 +26,11 @@ import com.gh.gamecenter.databinding.ItemGameCollectionHotListBinding import com.gh.gamecenter.entity.GameCollectionHotListTab import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData class GameCollectionHotListAdapter( context: Context, + private val mPosition: Int, private val mTabEntity: GameCollectionHotListTab? = null, private val mViewModel: GameCollectionHotListViewModel, private val mEntrance: String, @@ -113,6 +115,15 @@ class GameCollectionHotListAdapter( mTabEntity?.name ?: "", "游戏" ) + SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { + "position" to mPosition + "tab_content" to mTabEntity?.name + "game_list_collection_name" to mTabEntity?.name + "game_list_collection_id" to mTabEntity?.id + "text" to "游戏" + "game_name" to gameEntity.name + "game_id" to gameEntity.id + }) GameDetailActivity.startGameDetailActivity( mContext, gameEntity.id, @@ -136,6 +147,14 @@ class GameCollectionHotListAdapter( mTabEntity?.name ?: "", "个人主页" ) + SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { + "position" to mPosition + "tab_content" to mTabEntity?.name + "game_list_collection_name" to mTabEntity?.name + "game_list_collection_id" to mTabEntity?.id + "text" to "个人主页" + "mongold_id" to entity?.user?.id + }) DirectUtils.directToHomeActivity(mContext, entity?.user?.id, 0, mEntrance, mPath) } } @@ -146,6 +165,15 @@ class GameCollectionHotListAdapter( mTabEntity?.name ?: "", "游戏单" ) + SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { + "position" to mPosition + "tab_content" to mTabEntity?.name + "game_list_collection_name" to mTabEntity?.name + "game_list_collection_id" to mTabEntity?.id + "text" to "游戏单" + "game_collect_title" to entity?.title + "game_collect_id" to entity?.id + }) DirectUtils.directToGameCollectionDetail( it.context, entity?.id ?: "", diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt index eb65cbf5c1..0b425cbb8d 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt @@ -9,13 +9,15 @@ import com.gh.common.util.NewFlatLogUtils import com.gh.gamecenter.R import com.gh.gamecenter.common.baselist.ListFragment import com.gh.gamecenter.common.constant.EntranceConsts +import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json +import com.gh.gamecenter.common.utils.SensorsBridge import com.gh.gamecenter.common.utils.dip2px import com.gh.gamecenter.common.utils.viewModelProvider import com.gh.gamecenter.common.view.FixGridLayoutManager import com.gh.gamecenter.common.view.GridSpacingItemDecoration import com.gh.gamecenter.core.utils.TimeElapsedHelper import com.gh.gamecenter.entity.GameCollectionHotListTab -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData class GameCollectionHotListFragment : ListFragment() { @@ -26,11 +28,13 @@ class GameCollectionHotListFragment : ListFragment= 8) { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogShow", json { + "source_entrance" to path + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) DialogHelper.showDialog( binding.root.context, "温馨提示", @@ -91,21 +105,85 @@ class MyGameCollectionViewHolder( "确定", "取消", { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "确定" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) mViewModel.publishGameCollection(entity) }, + { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "取消" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json { + "source_entrance" to path + "button_name" to "关闭弹窗" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) ) } else { - DialogHelper.showDialog(binding.root.context, "温馨提示", "游戏单需要收录至少8个游戏,才可以投稿至游戏单广场哦~", "添加游戏", "我知道了", { - binding.root.context.startActivity( - GameCollectionEditActivity.getIntent( - binding.root.context, - entity, - entrance, - path + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogShow", json { + "source_entrance" to path + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + DialogHelper.showDialog( + binding.root.context, + "温馨提示", + "游戏单需要收录至少8个游戏,才可以投稿至游戏单广场哦~", + "添加游戏", + "我知道了", + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "添加游戏" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + binding.root.context.startActivity( + GameCollectionEditActivity.getIntent( + binding.root.context, + entity, + entrance, + path + ) ) - ) - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + }, + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "我知道了" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json { + "source_entrance" to path + "button_name" to "关闭弹窗" + "game_num" to entity.count?.game + "game_collect_title" to entity.title + "game_collect_id" to entity.id + }) + }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } } binding.editBtn.setOnClickListener { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/publish/GameCollectionEditActivity.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/publish/GameCollectionEditActivity.kt index ec25407c64..7e418787d7 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/publish/GameCollectionEditActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/publish/GameCollectionEditActivity.kt @@ -20,17 +20,18 @@ import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment 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.mvvm.Status import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.utils.PatternUtils import com.gh.gamecenter.databinding.ActivityGameCollectionEditBinding import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding import com.gh.gamecenter.entity.* +import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.gamecollection.choose.ChooseGamesActivity import com.gh.gamecenter.gamecollection.choose.ChooseGamesViewModel import com.gh.gamecenter.gamecollection.tag.GameCollectionTagSelectActivity import com.gh.gamecenter.gamecollection.tag.GameCollectionTagSelectFragment -import com.gh.gamecenter.common.mvvm.Status -import com.gh.gamecenter.feature.entity.GameEntity import com.zhihu.matisse.Matisse import com.zhihu.matisse.internal.utils.PathUtils import org.greenrobot.eventbus.EventBus @@ -47,6 +48,8 @@ class GameCollectionEditActivity : ToolBarActivity() { private var mActivityId = "" private var mActivityName = "" private var mGameEntity: GameEntity? = null + private var mIsCreateGameCollection = false + private var mPath = "" override fun getLayoutId(): Int = R.layout.activity_game_collection_edit @@ -60,9 +63,20 @@ class GameCollectionEditActivity : ToolBarActivity() { mMenuPost = getMenuItem(R.id.menu_game_collection_post) setNavigationTitle("创建游戏单") mViewModel.gameCollectionPatch = intent.getParcelableExtra(GamesCollectionEntity::class.java.name) - val path = intent.getStringExtra(EntranceConsts.KEY_PATH) ?: "" - if (path.isNotEmpty()) { - NewLogUtils.logEnterGameCollectionEdit(path) + mIsCreateGameCollection = intent.getBooleanExtra(EntranceConsts.KEY_CREATE_GAME_COLLECTION, false) + mPath = intent.getStringExtra(EntranceConsts.KEY_PATH) ?: "" + if (mPath.isNotEmpty()) { + if (mIsCreateGameCollection) { + SensorsBridge.trackEvent("GameCollectCreateClick", "source_entrance", mPath) + NewLogUtils.logEnterGameCollectionCreate(mPath) + } else if (mViewModel.gameCollectionPatch != null) { + SensorsBridge.trackEvent("GameCollectEditClick", json { + "source_entrance" to mPath + "is_self_only" to (mViewModel.gameCollectionPatch?.display == "self_only") + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + } } mActivityId = intent.getStringExtra(EntranceConsts.KEY_ACTIVITY_ID) ?: "" mActivityName = intent.getStringExtra(EntranceConsts.KEY_ACTIVITY_NAME) ?: "" @@ -227,8 +241,24 @@ class GameCollectionEditActivity : ToolBarActivity() { toast("提交成功") EventBus.getDefault().post(EBReuse("createGameCollectionSuccess")) it.data?.run { + val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf() + if (mIsCreateGameCollection) { + SensorsBridge.trackEvent("GameCollectCreateSuccess", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "game_num" to games.size + "game_collect_title" to mBinding.gameCollectionTitleEt.text.toString().trim() + "game_collect_id" to it.data as String + }) + } else if (mViewModel.gameCollectionPatch != null) { + SensorsBridge.trackEvent("GameCollectEditSuccess", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "game_num" to games.size + "game_collect_title" to mBinding.gameCollectionTitleEt.text.toString().trim() + "game_collect_id" to it.data as String + }) + } + if (mActivityName.isNotEmpty()) { - val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf() NewLogUtils.logCreateGameCollectionSuccess( games.map { gameEntity -> gameEntity.id }.toList(), mBinding.gameCollectionTitleEt.text.toString().trim(), @@ -422,9 +452,44 @@ class GameCollectionEditActivity : ToolBarActivity() { override fun handleBackPressed(): Boolean { val patch = mViewModel.gameCollectionPatch if (patch != null && patch.status != "draft" && !patch.isLocalDraft) { - DialogHelper.showDialog(this, "温馨提示", "退出将不会保留本次游戏单编辑的内容,是否确定退出", "确定", "取消", { - finish() - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + SensorsBridge.trackEvent("GameCollectExitEditDialogShow", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "game_collect_title" to patch.title + "game_collect_id" to patch.id + }) + DialogHelper.showDialog( + this, + "温馨提示", + "退出将不会保留本次游戏单编辑的内容,是否确定退出", + "确定", + "取消", + { + SensorsBridge.trackEvent("GameCollectExitEditDialogClick", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "button_name" to "确定" + "game_collect_title" to patch.title + "game_collect_id" to patch.id + }) + finish() + }, + { + SensorsBridge.trackEvent("GameCollectExitEditDialogClick", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "button_name" to "取消" + "game_collect_title" to patch.title + "game_collect_id" to patch.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectExitEditDialogClick", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "button_name" to "关闭弹窗" + "game_collect_title" to patch.title + "game_collect_id" to patch.id + }) + }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) return true } else if (patch == null || patch.isLocalDraft) { val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf() @@ -454,6 +519,23 @@ class GameCollectionEditActivity : ToolBarActivity() { } private fun verifyData() { + val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf() + val title = mBinding.gameCollectionTitleEt.text.toString().trim() + + if (mIsCreateGameCollection) { + SensorsBridge.trackEvent("GameCollectCreateSubmit", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "game_num" to games.size + }) + } else if (mViewModel.gameCollectionPatch != null) { + SensorsBridge.trackEvent("GameCollectEditSubmit", json { + "is_self_only" to mBinding.selfOnlyCb.isChecked + "game_num" to games.size + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + } + if (mViewModel.imageUrl.isEmpty()) { toast("请上传游戏单的封面") return @@ -462,9 +544,7 @@ class GameCollectionEditActivity : ToolBarActivity() { toast("请选择游戏单的标签") return } - val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf() - val title = mBinding.gameCollectionTitleEt.text.toString().trim() if (title.isEmpty()) { toast("请填写游戏单的标题") return @@ -512,11 +592,51 @@ class GameCollectionEditActivity : ToolBarActivity() { } if (isSelfOnly) { - DialogHelper.showDialog(this, "温馨提示", "游戏单开启“仅自己可见”后,将不会对其他用户展示,是否继续提交", "确定", "取消", { - mViewModel.uploadContent(this, requestMap) - }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)) + SensorsBridge.trackEvent("GameCollectSelfOnlyDialogShow", json { + "source_entrance" to mPath + "game_num" to games.size + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + DialogHelper.showDialog( + this, + "温馨提示", + "游戏单开启“仅自己可见”后,将不会对其他用户展示,是否继续提交", + "确定", + "取消", + { + SensorsBridge.trackEvent("GameCollectSelfOnlyDialogClick", json { + "source_entrance" to mPath + "button_name" to "确定" + "game_num" to games.size + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + mViewModel.uploadContent(this, requestMap) + }, + { + SensorsBridge.trackEvent("GameCollectSelfOnlyDialogClick", json { + "source_entrance" to mPath + "button_name" to "取消" + "game_num" to games.size + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + }, + { + SensorsBridge.trackEvent("GameCollectSelfOnlyDialogClick", json { + "source_entrance" to mPath + "button_name" to "关闭弹窗" + "game_num" to games.size + "game_collect_title" to mViewModel.gameCollectionPatch?.title + "game_collect_id" to mViewModel.gameCollectionPatch?.id + }) + }, + extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) + ) } else { if (games.size < 8) { + SensorsBridge.trackEvent("GameCollectSaveDraftDialogShow") DialogHelper.showDialog( this, "温馨提示", @@ -524,11 +644,16 @@ class GameCollectionEditActivity : ToolBarActivity() { "继续保存", "添加游戏", { + SensorsBridge.trackEvent("GameCollectSaveDraftDialogClick", "button_name", "继续保存") mViewModel.uploadContent(this, requestMap) }, { + SensorsBridge.trackEvent("GameCollectSaveDraftDialogClick", "button_name", "添加游戏") startActivity(ChooseGamesActivity.getIntent(this)) }, + { + SensorsBridge.trackEvent("GameCollectSaveDraftDialogClick", "button_name", "关闭弹窗") + }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true) ) } else { @@ -542,6 +667,9 @@ class GameCollectionEditActivity : ToolBarActivity() { override fun onDestroy() { super.onDestroy() mChooseGamesViewModel.chooseGamesLiveData.postValue(arrayListOf()) + if (mIsCreateGameCollection) { + SensorsBridge.trackEvent("GameCollectCreateCancel") + } } override fun onDarkModeChanged() { @@ -594,8 +722,9 @@ class GameCollectionEditActivity : ToolBarActivity() { const val REQUEST_CHOOSE_ACTIVITY = 105 @JvmStatic - fun getIntent(context: Context, entrance: String = "", path: String = ""): Intent { + fun getCreateIntent(context: Context, entrance: String = "", path: String = ""): Intent { val intent = Intent(context, GameCollectionEditActivity::class.java) + intent.putExtra(EntranceConsts.KEY_CREATE_GAME_COLLECTION, true) intent.putExtra(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) intent.putExtra(EntranceConsts.KEY_PATH, path) return intent @@ -616,7 +745,7 @@ class GameCollectionEditActivity : ToolBarActivity() { } @JvmStatic - fun getIntent( + fun getCreateIntent( context: Context, activityId: String = "", activityName: String = "", @@ -630,6 +759,7 @@ class GameCollectionEditActivity : ToolBarActivity() { intent.putExtra(EntranceConsts.KEY_GAMEID, gameId) intent.putExtra(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) intent.putExtra(EntranceConsts.KEY_PATH, path) + intent.putExtra(EntranceConsts.KEY_CREATE_GAME_COLLECTION, true) return intent } } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionBannerAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionBannerAdapter.kt index 7a6798a063..e1cf844faf 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionBannerAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionBannerAdapter.kt @@ -3,11 +3,14 @@ package com.gh.gamecenter.gamecollection.square import android.content.Context import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.gh.common.exposure.* +import com.gh.common.exposure.ExposureManager import com.gh.common.util.DirectUtils import com.gh.gamecenter.common.base.BaseRecyclerViewHolder import com.gh.gamecenter.common.entity.ExposureEntity +import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.ImageUtils +import com.gh.gamecenter.common.utils.SensorsBridge import com.gh.gamecenter.common.utils.safelyGetInRelease import com.gh.gamecenter.common.utils.toBinding import com.gh.gamecenter.core.AppExecutor @@ -15,7 +18,6 @@ import com.gh.gamecenter.databinding.GameCollectionBannerItemBinding import com.gh.gamecenter.entity.AmwayCommentEntity import com.gh.gamecenter.entity.CarouselEntity import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.feature.exposure.ExposureType import com.lightgame.adapter.BaseRecyclerAdapter @@ -101,6 +103,12 @@ class GameCollectionBannerAdapter( event = ExposureType.CLICK ) ) + SensorsBridge.trackEvent("GameCollectSquareBannerClick", json { + "position" to position + "link_type" to entity.type + "link_id" to entity.link + "link_text" to entity.text + }) } } } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt index de2db283a6..d63fd07f46 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt @@ -26,6 +26,7 @@ import com.gh.gamecenter.common.baselist.ListAdapter import com.gh.gamecenter.common.baselist.LoadStatus import com.gh.gamecenter.common.constant.ItemViewType import com.gh.gamecenter.common.entity.ExposureEntity +import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.utils.ImageUtils.display import com.gh.gamecenter.common.view.ScrollEventListener @@ -38,7 +39,6 @@ import com.gh.gamecenter.entity.AmwayCommentEntity import com.gh.gamecenter.entity.CarouselEntity import com.gh.gamecenter.entity.GamesCollectionEntity import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.feature.exposure.ExposureType import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity import com.gh.gamecenter.gamecollection.tag.GameCollectionTagSelectActivity @@ -389,6 +389,11 @@ class GameCollectionSquareAdapter( binding.orderSfv.setOnCheckedCallback { position -> viewModel.view = GameCollectionSquareViewModel.getOrderNameByPosition(position) + SensorsBridge.trackEvent( + "GameCollectSquareSortClick", + "text", + GameCollectionSquareViewModel.getOrderChineseByName(viewModel.view) + ) refreshCallback() } @@ -398,6 +403,15 @@ class GameCollectionSquareAdapter( binding.tagFilter.setOnClickListener { NewLogUtils.logEnterGameCollectionTag("首页tab栏") + SensorsBridge.trackEvent( + "GameCollectTagEnter", + "label_category", + viewModel.selectedTagCategory, + "label_name", + viewModel.selectedTagEntity?.name ?: "", + "label_id", + viewModel.selectedTagEntity?.id ?: "" + ) fragment.startActivityForResult( GameCollectionTagSelectActivity.getIntent( fragment.requireContext(), diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareFragment.kt index a9b3c9e095..572ec3bed1 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareFragment.kt @@ -40,6 +40,7 @@ import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.entity.ExposureEntity import com.gh.gamecenter.common.eventbus.EBReuse import com.gh.gamecenter.common.exposure.ExposureSource +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.VerticalItemDecoration @@ -210,9 +211,21 @@ class GameCollectionSquareFragment : LazyListFragment mViewModel.view = GameCollectionSquareViewModel.getOrderNameByPosition(position) + SensorsBridge.trackEvent( + "GameCollectSquareSortClick", + "text", + GameCollectionSquareViewModel.getOrderChineseByName(mViewModel.view) + ) refresh() } @@ -338,14 +356,19 @@ class GameCollectionSquareFragment : LazyListFragment { - holder.bindSlideWithCards(mDataList[position], mBasicExposureSource) + holder.bindSlideWithCards(mDataList[position], mBasicExposureSource, "首页") } is HomeRecommendItemViewHolder -> holder.bindRecommend(mDataList[position], mBasicExposureSource) is HomeAmwayListViewHolder -> bindAmway(holder, position) diff --git a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt index 6f1580d8e7..838ef29144 100644 --- a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt +++ b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt @@ -21,6 +21,7 @@ import com.gh.gamecenter.adapter.viewholder.GameViewHolder import com.gh.gamecenter.common.constant.ItemViewType import com.gh.gamecenter.common.entity.LinkEntity import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.iinterface.IOffsetable import com.gh.gamecenter.core.runOnIoThread @@ -50,14 +51,13 @@ import com.gh.gamecenter.game.vertical.OnPagerSnapScrollListener import com.gh.gamecenter.home.gamecollection.carousel.HomeGameCollectionCarouselViewHolder import com.gh.gamecenter.home.gamecollection.refresh.HomeGameCollectionRefreshViewHolder import com.gh.gamecenter.home.gamecollection.slide.HomeGameCollectionSlideViewHolder -import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity import com.gh.gamecenter.home.horizontalslidevideo.HomeHorizontalSlideVideoListViewHolder import com.gh.gamecenter.home.video.ScrollCalculatorHelper +import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity import com.gh.gamecenter.subject.SubjectActivity import com.halo.assistant.fragment.game.GamePluginAdapter import com.halo.assistant.fragment.game.GamePluginViewHolder import java.util.* -import kotlin.collections.ArrayList class LegacyHomeFragmentAdapterAssistant( private var mContext: Context, @@ -719,6 +719,12 @@ class LegacyHomeFragmentAdapterAssistant( column.id ?: "", "游戏单广场" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "首页" + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "游戏单广场" + }) DirectUtils.directToGameCollectionSquare( mContext, "首页内容列表", diff --git a/app/src/main/java/com/gh/gamecenter/home/gamecollection/carousel/HomeGameCollectionCarouselAdapter.kt b/app/src/main/java/com/gh/gamecenter/home/gamecollection/carousel/HomeGameCollectionCarouselAdapter.kt index d8c660b902..c4a7b631c0 100644 --- a/app/src/main/java/com/gh/gamecenter/home/gamecollection/carousel/HomeGameCollectionCarouselAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/home/gamecollection/carousel/HomeGameCollectionCarouselAdapter.kt @@ -3,18 +3,18 @@ package com.gh.gamecenter.home.gamecollection.carousel import android.content.Context import android.view.View import android.view.ViewGroup -import com.gh.gamecenter.common.base.activity.BaseActivity -import com.gh.gamecenter.common.base.BaseRecyclerViewHolder -import com.gh.common.util.* -import com.gh.gamecenter.common.view.AsyncCell +import com.gh.common.util.DirectUtils +import com.gh.common.util.NewFlatLogUtils +import com.gh.common.util.NewLogUtils import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R -import com.gh.gamecenter.core.utils.TimeUtils -import com.gh.gamecenter.common.utils.dip2px -import com.gh.gamecenter.common.utils.goneIf -import com.gh.gamecenter.common.utils.safelyGetInRelease +import com.gh.gamecenter.common.base.BaseRecyclerViewHolder +import com.gh.gamecenter.common.base.activity.BaseActivity +import com.gh.gamecenter.common.json.json +import com.gh.gamecenter.common.utils.* +import com.gh.gamecenter.common.view.AsyncCell import com.gh.gamecenter.core.utils.DisplayUtils -import com.gh.gamecenter.common.utils.ImageUtils +import com.gh.gamecenter.core.utils.TimeUtils import com.gh.gamecenter.databinding.HomeGameCollectionCardItemBinding import com.gh.gamecenter.entity.GameListCollection import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity @@ -111,79 +111,41 @@ class HomeGameCollectionCarouselAdapter( timeTv.goneIf(gamesCollectionEntity.stamp.isNotEmpty()) stampIv.goneIf(gamesCollectionEntity.stamp.isEmpty()) stampIv.setBackgroundResource(if (gamesCollectionEntity.stamp == "official") R.drawable.ic_official else R.drawable.ic_chosen) - iconIvOne.setOnClickListener { - val game = gamesCollectionEntity.games?.get(0) - NewLogUtils.logClickGameCollectionGameIcon( - gamesCollectionEntity.title, - gamesCollectionEntity.id, - game?.name ?: "", - game?.id ?: "" - ) - NewFlatLogUtils.logGameListCollectionClick( - entrance, - blockName, - blockId, - collectionName, - collectionId, - "游戏" - ) - game?.id?.let { id -> - GameDetailActivity.startGameDetailActivity( - context, - id, - BaseActivity.mergeEntranceAndPath(entrance, "游戏单合集"), - game.exposureEvent + listOf(iconIvOne, iconIvTwo, iconIvThree).forEachIndexed { index, iconIv -> + val game = gamesCollectionEntity.games?.safelyGetInRelease(index) + iconIv.setOnClickListener { + NewLogUtils.logClickGameCollectionGameIcon( + gamesCollectionEntity.title, + gamesCollectionEntity.id, + game?.name ?: "", + game?.id ?: "" ) - } - } - iconIvTwo.setOnClickListener { - val game = gamesCollectionEntity.games?.get(1) - NewLogUtils.logClickGameCollectionGameIcon( - gamesCollectionEntity.title, - gamesCollectionEntity.id, - game?.name ?: "", - game?.id ?: "" - ) - NewFlatLogUtils.logGameListCollectionClick( - entrance, - blockName, - blockId, - collectionName, - collectionId, - "游戏" - ) - game?.id?.let { id -> - GameDetailActivity.startGameDetailActivity( - context, - id, - BaseActivity.mergeEntranceAndPath(entrance, "游戏单合集"), - game.exposureEvent - ) - } - } - iconIvThree.setOnClickListener { - val game = gamesCollectionEntity.games?.get(2) - NewLogUtils.logClickGameCollectionGameIcon( - gamesCollectionEntity.title, - gamesCollectionEntity.id, - game?.name ?: "", - game?.id ?: "" - ) - NewFlatLogUtils.logGameListCollectionClick( - entrance, - blockName, - blockId, - collectionName, - collectionId, - "游戏" - ) - game?.id?.let { id -> - GameDetailActivity.startGameDetailActivity( - context, - id, - BaseActivity.mergeEntranceAndPath(entrance, "游戏单合集"), - game.exposureEvent + NewFlatLogUtils.logGameListCollectionClick( + entrance, + blockName, + blockId, + collectionName, + collectionId, + "游戏" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to collectionName + "game_list_collection_id" to collectionId + "text" to "游戏" + "game_name" to game?.name + "game_id" to game?.id + }) + game?.id?.let { id -> + GameDetailActivity.startGameDetailActivity( + context, + id, + BaseActivity.mergeEntranceAndPath(entrance, "游戏单合集"), + game.exposureEvent + ) + } } } userContainer.setOnClickListener { @@ -196,6 +158,15 @@ class HomeGameCollectionCarouselAdapter( collectionId, "个人主页" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to collectionName + "game_list_collection_id" to collectionId + "text" to "个人主页" + "mongold_id" to gamesCollectionEntity.user?.id + }) DirectUtils.directToHomeActivity( context, gamesCollectionEntity.user?.id, @@ -214,6 +185,16 @@ class HomeGameCollectionCarouselAdapter( "游戏单" ) NewLogUtils.logEnterGameCollectionDetail(gamesCollectionEntity.title, gamesCollectionEntity.id) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to collectionName + "game_list_collection_id" to collectionId + "text" to "游戏单" + "game_collect_title" to gamesCollectionEntity.title + "game_collect_id" to gamesCollectionEntity.id + }) context.startActivity( GameCollectionDetailActivity.getIntent( context, diff --git a/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshAdapter.kt b/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshAdapter.kt index fc9306c483..dd1ee44241 100644 --- a/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshAdapter.kt @@ -6,10 +6,8 @@ import androidx.recyclerview.widget.RecyclerView import com.gh.common.util.NewFlatLogUtils import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R -import com.gh.gamecenter.common.utils.DarkModeUtils -import com.gh.gamecenter.common.utils.dip2px -import com.gh.gamecenter.common.utils.toBinding -import com.gh.gamecenter.common.utils.toColor +import com.gh.gamecenter.common.json.json +import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder import com.gh.gamecenter.game.vertical.GameVerticalAdapter @@ -72,6 +70,16 @@ class HomeGameCollectionRefreshAdapter( collectionId, "游戏" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to collectionName + "game_list_collection_id" to collectionId + "text" to "游戏" + "game_name" to gameEntity.name + "game_id" to gameEntity.id + }) GameDetailActivity.startGameDetailActivity( mContext, gameEntity.id, @@ -98,6 +106,16 @@ class HomeGameCollectionRefreshAdapter( collectionId, "游戏" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to collectionName + "game_list_collection_id" to collectionId + "text" to "游戏" + "game_name" to gameEntity.name + "game_id" to gameEntity.id + }) GameDetailActivity.startGameDetailActivity( mContext, gameEntity.id, diff --git a/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshViewHolder.kt index fe2070a38d..ff2e979acf 100644 --- a/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/gamecollection/refresh/HomeGameCollectionRefreshViewHolder.kt @@ -9,6 +9,7 @@ import com.gh.common.util.DirectUtils import com.gh.common.util.NewFlatLogUtils import com.gh.gamecenter.R import com.gh.gamecenter.common.base.BaseRecyclerViewHolder +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.FixLinearLayoutManager import com.gh.gamecenter.databinding.HomeGameCollectionRefreshItemBinding @@ -114,6 +115,16 @@ class HomeGameCollectionRefreshViewHolder(val binding: HomeGameCollectionRefresh gameListCollection.id, "全部" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (entrance.contains("首页")) "首页" else if (entrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to gameListCollection.name + "game_list_collection_id" to gameListCollection.id + "text" to "游戏单" + "game_collect_title" to mGameCollection?.title + "game_collect_id" to mGameCollection?.id + }) DirectUtils.directToGameCollectionDetail( view.context, mGameCollection?.id ?: "", @@ -133,6 +144,15 @@ class HomeGameCollectionRefreshViewHolder(val binding: HomeGameCollectionRefresh gameListCollection.id, "个人主页" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (entrance.contains("首页")) "首页" else if (entrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to gameListCollection.name + "game_list_collection_id" to gameListCollection.id + "text" to "个人主页" + "mongold_id" to mGameCollection?.user?.id + }) DirectUtils.directToHomeActivity( binding.root.context, mGameCollection?.user?.id, @@ -164,6 +184,14 @@ class HomeGameCollectionRefreshViewHolder(val binding: HomeGameCollectionRefresh gameListCollection.id, "刷新" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (entrance.contains("首页")) "首页" else if (entrance.contains("版块")) "版块" else "" + "block_name" to blockName + "block_id" to blockId + "game_list_collection_name" to gameListCollection.name + "game_list_collection_id" to gameListCollection.id + "text" to "刷新" + }) } } } diff --git a/app/src/main/java/com/gh/gamecenter/home/gamecollection/slide/HomeGameCollectionSlideAdapter.kt b/app/src/main/java/com/gh/gamecenter/home/gamecollection/slide/HomeGameCollectionSlideAdapter.kt index 94d98ee06e..022d0244d6 100644 --- a/app/src/main/java/com/gh/gamecenter/home/gamecollection/slide/HomeGameCollectionSlideAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/home/gamecollection/slide/HomeGameCollectionSlideAdapter.kt @@ -15,6 +15,7 @@ import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.GameViewHolder import com.gh.gamecenter.common.base.BaseRecyclerViewHolder import com.gh.gamecenter.common.base.activity.BaseActivity +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.AsyncCell import com.gh.gamecenter.databinding.ItemHomeGameCollectionBigSlideCardBinding @@ -78,6 +79,15 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "个人主页" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "个人主页" + "mongold_id" to entity?.user?.id + }) DirectUtils.directToHomeActivity(mContext, entity?.user?.id, 0, mEntrance, "游戏单合集") } } @@ -99,6 +109,16 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "游戏单" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "游戏单" + "game_collect_title" to entity?.title + "game_collect_id" to entity?.id + }) DirectUtils.directToGameCollectionDetail( it.context, entity?.id ?: "", @@ -137,6 +157,15 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "个人主页" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "个人主页" + "mongold_id" to entity?.user?.id + }) DirectUtils.directToHomeActivity(mContext, entity?.user?.id, 0, mEntrance, "游戏单合集") } } @@ -154,6 +183,16 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "游戏" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "游戏" + "game_name" to gameEntity.name + "game_id" to gameEntity.id + }) GameDetailActivity.startGameDetailActivity( mContext, gameEntity.id, @@ -172,6 +211,16 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "游戏单" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "游戏单" + "game_collect_title" to entity?.title + "game_collect_id" to entity?.id + }) DirectUtils.directToGameCollectionDetail( it.context, entity?.id ?: "", @@ -376,6 +425,16 @@ class HomeGameCollectionSlideAdapter( mGameListCollection.id, "游戏" ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to if (mEntrance.contains("首页")) "首页" else if (mEntrance.contains("版块")) "版块" else "" + "block_name" to mBlockName + "block_id" to mBlockId + "game_list_collection_name" to mGameListCollection.name + "game_list_collection_id" to mGameListCollection.id + "text" to "游戏" + "game_name" to gameEntity.name + "game_id" to gameEntity.id + }) GameDetailActivity.startGameDetailActivity( mContext, gameEntity.id, diff --git a/app/src/main/java/com/gh/gamecenter/home/recommend/HomeRecommendItemGridAdapter.kt b/app/src/main/java/com/gh/gamecenter/home/recommend/HomeRecommendItemGridAdapter.kt index f3ede2d5a5..90bdd41f5d 100644 --- a/app/src/main/java/com/gh/gamecenter/home/recommend/HomeRecommendItemGridAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/home/recommend/HomeRecommendItemGridAdapter.kt @@ -12,7 +12,6 @@ import com.gh.gamecenter.common.utils.ImageUtils import com.gh.gamecenter.common.utils.SensorsBridge import com.gh.gamecenter.common.utils.setDebouncedClickListener import com.gh.gamecenter.common.utils.toColor -import com.gh.gamecenter.core.utils.MtaHelper import com.gh.gamecenter.core.utils.PageSwitchDataHelper import com.gh.gamecenter.databinding.ItemHomeRecommendListItemBinding import com.gh.gamecenter.entity.HomeRecommend @@ -77,6 +76,7 @@ class HomeRecommendItemGridAdapter : BaseAdapter() { try { trackEvent.put("position", position) trackEvent.put("Recommended_location_name", recommend.name) + trackEvent.put("location", "首页") } catch (e: JSONException) { e.printStackTrace() } diff --git a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt index 6eb0c97dbe..14fa030700 100644 --- a/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/home/slide/HomeSlideWithCardsViewHolder.kt @@ -17,6 +17,8 @@ import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R import com.gh.gamecenter.common.base.BaseRecyclerViewHolder import com.gh.gamecenter.common.base.activity.BaseActivity +import com.gh.gamecenter.common.exposure.ExposureSource +import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.DrawableView import com.gh.gamecenter.common.view.FixLinearLayoutManager @@ -29,7 +31,6 @@ import com.gh.gamecenter.databinding.HomeSlideWithCardsBinding import com.gh.gamecenter.entity.HomeSubSlide import com.gh.gamecenter.feature.entity.GameEntity import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.feature.exposure.ExposureType import com.gh.gamecenter.home.HomeItemData import com.gh.gamecenter.home.HomeViewModel @@ -46,13 +47,18 @@ class HomeSlideWithCardsViewHolder( fun bindSlideWithCards( itemData: HomeItemData, - basicExposureSource: List + basicExposureSource: List, + location: String ) { - bindSlide(itemData, basicExposureSource) + bindSlide(itemData, basicExposureSource, location) bindCards(itemData, basicExposureSource) } - private fun bindSlide(itemData: HomeItemData, basicExposureSource: List) { + private fun bindSlide( + itemData: HomeItemData, + basicExposureSource: List, + location: String + ) { val slideList = itemData.slides!! val context = binding.recyclerView.context var adapter = binding.recyclerView.adapter @@ -156,6 +162,10 @@ class HomeSlideWithCardsViewHolder( curPosition = adapter.getActualPosition(layoutManager.getPosition(view)) } if (lastScrollState == RecyclerView.SCROLL_STATE_DRAGGING && curPosition != lastStatePosition) { + SensorsBridge.trackEvent("BannerSlide", json { + "position" to curPosition + "location" to location + }) MtaHelper.onEvent( "首页_新", "轮播_滑动", @@ -457,6 +467,11 @@ class HomeSlideWithCardsViewHolder( event = ExposureType.CLICK ) ) + SensorsBridge.trackEvent("RightSideCardClick", json { + "position" to position + "title" to homeSubSlide.title + "card_id" to homeSubSlide.id + }) com.gh.common.util.NewFlatLogUtils.logRightSideCardClick(homeSubSlide, viewModel.refreshCount, "卡片") DirectUtils.directToLinkPage( cardCv.context, diff --git a/app/src/main/java/com/gh/gamecenter/mygame/MyGameActivity.kt b/app/src/main/java/com/gh/gamecenter/mygame/MyGameActivity.kt index 3586fa84ad..33a78f4704 100644 --- a/app/src/main/java/com/gh/gamecenter/mygame/MyGameActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/mygame/MyGameActivity.kt @@ -9,16 +9,16 @@ import android.view.View import android.widget.LinearLayout import androidx.fragment.app.Fragment import com.gh.common.util.NewFlatLogUtils -import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout -import com.gh.gamecenter.core.AppExecutor -import com.gh.gamecenter.common.constant.Constants -import com.gh.gamecenter.common.view.BugFixedPopupWindow import com.gh.gamecenter.R -import com.gh.gamecenter.core.utils.SPUtils +import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout +import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.utils.showRegulationTestDialogIfNeeded import com.gh.gamecenter.common.utils.tryCatchInRelease import com.gh.gamecenter.common.utils.updateStatusBarColor +import com.gh.gamecenter.common.view.BugFixedPopupWindow +import com.gh.gamecenter.core.AppExecutor import com.gh.gamecenter.core.utils.MtaHelper +import com.gh.gamecenter.core.utils.SPUtils import com.gh.gamecenter.databinding.PopupMyGameGuideBinding import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity @@ -55,7 +55,7 @@ class MyGameActivity : BaseActivity_TabLayout() { override fun onMenuItemClick(item: MenuItem?): Boolean { if (item?.itemId == R.id.menu_create_game_collection) { showRegulationTestDialogIfNeeded { - startActivity(GameCollectionEditActivity.getIntent(this, mEntrance, "我的游戏")) + startActivity(GameCollectionEditActivity.getCreateIntent(this, mEntrance, "我的游戏")) } } return super.onMenuItemClick(item) diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt index f931b59d49..51a1d93dda 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt @@ -514,7 +514,7 @@ class ArticleEditActivity : BaseRichEditorActivity(), Keyb }, { SensorsBridge.trackEvent("ArticleCancelDialogClick", "button_name", "不保存") finish() - }, DialogHelper.Config(showCloseIcon = true, centerContent = true, centerTitle = true)) + }, extraConfig = DialogHelper.Config(showCloseIcon = true, centerContent = true, centerTitle = true)) return true } } @@ -569,11 +569,20 @@ class ArticleEditActivity : BaseRichEditorActivity(), Keyb private fun showBackDialog() { if (mRichEditor.hasPlaceholderImage()) return - DialogHelper.showDialog(this, "提示", "是否保存内容再退出?", "保存并退出", "不保存", { - mViewModel.title = mBinding.articleEditTitle.text.toString() - mViewModel.content = getReplaceRealContent() - mViewModel.postArticleDrafts(SaveDraftType.EXIT) - }, { finish() }, DialogHelper.Config(showCloseIcon = true, centerTitle = true, centerContent = true)) + DialogHelper.showDialog( + this, + "提示", + "是否保存内容再退出?", + "保存并退出", + "不保存", + { + mViewModel.title = mBinding.articleEditTitle.text.toString() + mViewModel.content = getReplaceRealContent() + mViewModel.postArticleDrafts(SaveDraftType.EXIT) + }, + { finish() }, + extraConfig = DialogHelper.Config(showCloseIcon = true, centerTitle = true, centerContent = true) + ) } private fun showSelectGameDialog() { diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentActivity.kt index df5323bace..ad1c434d31 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentActivity.kt @@ -46,6 +46,7 @@ class CommentActivity : BaseActivity() { val questionId = intent.getStringExtra(QUESTION_ID) ?: "" val commentId = intent.getStringExtra(KEY_COMMENT_ID) ?: "" val gameCollectionId = intent.getStringExtra(GAME_COLLECTION_ID) ?: "" + val gameCollectionTitle = intent.getStringExtra(GAME_COLLECTION_TITLE) ?: "" val isVideoAuthor = intent.getBooleanExtra(IS_VIDEO_AUTHOR, false) val isStairsComment = intent.getBooleanExtra(IS_STAIRS_COMMENT, false) @@ -118,6 +119,7 @@ class CommentActivity : BaseActivity() { gameCollectionId.isNotEmpty() -> { NewCommentFragment.getGameCollectionCommentInstance( gameCollectionId, + gameCollectionTitle, commentId, showKeyboard, commentCount, @@ -189,6 +191,7 @@ class CommentActivity : BaseActivity() { const val VIDEO_ID = "video_id" const val GAME_COLLECTION_ID = "game_collection_id" + const val GAME_COLLECTION_TITLE = "game_collection_title" const val REQUEST_CODE = 8123 @@ -402,10 +405,12 @@ class CommentActivity : BaseActivity() { fun getGameCollectionCommentIntent( context: Context, gameCollectionId: String, + gameCollectionTitle: String, commentCount: Int? = 0 ): Intent { val intent = Intent(context, CommentActivity::class.java) intent.putExtra(GAME_COLLECTION_ID, gameCollectionId) + intent.putExtra(GAME_COLLECTION_TITLE, gameCollectionTitle) intent.putExtra(COMMENT_COUNT, commentCount) intent.putExtra(SHOW_KEYBOARD, true) intent.putExtra(SHOW_INPUT_ONLY, true) diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt index f549edf741..95babcb31e 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt @@ -35,11 +35,12 @@ import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.view.VerticalItemDecoration import com.gh.gamecenter.core.utils.* import com.gh.gamecenter.databinding.ItemCommentEditImageBinding -import com.gh.gamecenter.feature.entity.CommentEntity import com.gh.gamecenter.eventbus.EBCommentSuccess +import com.gh.gamecenter.feature.entity.CommentEntity import com.gh.gamecenter.feature.eventbus.EBDeleteComment import com.gh.gamecenter.qa.answer.detail.AnswerDetailFragment import com.gh.gamecenter.qa.comment.CommentActivity.Companion.GAME_COLLECTION_ID +import com.gh.gamecenter.qa.comment.CommentActivity.Companion.GAME_COLLECTION_TITLE import com.gh.gamecenter.qa.comment.CommentActivity.Companion.QUESTION_ID import com.gh.gamecenter.qa.editor.LocalMediaActivity import com.halo.assistant.HaloApp @@ -78,6 +79,7 @@ open class NewCommentFragment : ListFragment protected var mVideoId: String = "" protected var mQuestionId: String = "" protected var mGameCollectionId: String = "" + protected var mGameCollectionTitle: String = "" protected var mCommentId: String = "" protected var mRootCommentId: String = "" protected var mShowInputOnly: Boolean = false // 是否只显示输入框,不显示列表 @@ -120,6 +122,7 @@ open class NewCommentFragment : ListFragment mVideoId = getString(VIDEO_ID, "") mQuestionId = getString(QUESTION_ID, "") mGameCollectionId = getString(GAME_COLLECTION_ID, "") + mGameCollectionTitle = getString(GAME_COLLECTION_TITLE, "") mRootCommentId = getString(KEY_COMMENT_ID, "") mCommentCount = getInt(COMMENT_COUNT, 0) mCommentType = getSerializable(COMMENT_TYPE) as? CommentType ?: CommentType.ANSWER @@ -230,6 +233,17 @@ open class NewCommentFragment : ListFragment requireContext(), errorString, false, { commentSendBtn.performClick() }, entrance ) + if (mCommentType == CommentType.GAME_COLLECTION) { + SensorsBridge.trackEvent( + "GameCollectDetailCommentClick", + "result", + "发表失败", + "game_collect_title", + mGameCollectionTitle, + "game_collect_id", + mGameCollectionId + ) + } } else -> { @@ -904,6 +918,7 @@ open class NewCommentFragment : ListFragment fun getGameCollectionCommentInstance( gameCollectionId: String, + gameCollectionTitle: String, commentId: String, showSoftKeyboardOnStartUp: Boolean, commentCount: Int, @@ -924,6 +939,7 @@ open class NewCommentFragment : ListFragment bundleOf( SHOW_SOFT_KEY_BOARD_ON_STARTUP to showSoftKeyboardOnStartUp, GAME_COLLECTION_ID to gameCollectionId, + GAME_COLLECTION_TITLE to gameCollectionTitle, KEY_COMMENT_ID to commentId, COMMENT_COUNT to commentCount, COMMENT_TYPE to commentType, diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java index 24a0034658..e7a4c3a2bd 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java @@ -297,4 +297,5 @@ public class EntranceConsts { public static final String KEY_FORCE_LOGIN = "force_login"; public static final String KEY_SEEK_GAME = "seek_game"; public static final String KEY_SMOOTH_GAME = "smooth_game"; + public static final String KEY_CREATE_GAME_COLLECTION = "create_game_collection"; } diff --git a/module_common/src/main/java/com/gh/gamecenter/common/utils/DialogHelper.kt b/module_common/src/main/java/com/gh/gamecenter/common/utils/DialogHelper.kt index 573f6cc17d..cf63362960 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/utils/DialogHelper.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/utils/DialogHelper.kt @@ -53,6 +53,7 @@ object DialogHelper { cancelText: String, confirmClickCallback: (() -> Unit)? = null, cancelClickCallback: (() -> Unit)? = null, + dialogCancelCallback: (() -> Unit)? = null, extraConfig: Config? = null, uiModificationCallback: ((binding: DefaultDialogAlertDefaultBindingWrapper) -> Unit)? = null, trackMtaEvent: Boolean = false, @@ -123,6 +124,9 @@ object DialogHelper { uiModificationCallback?.invoke(DefaultDialogAlertDefaultBindingWrapper(dialog, binding)) + dialog.setOnCancelListener { + dialogCancelCallback?.invoke() + } dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) dialog.setContentView(contentView) dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -355,8 +359,8 @@ object DialogHelper { gameType = gameType ) }, - Config(hint = "注意:卸载会让游戏数据丢失,请提前做好备份"), - { binding -> binding.hintTv.setTextColor(R.color.theme_font.toColor(context)) } + extraConfig = Config(hint = "注意:卸载会让游戏数据丢失,请提前做好备份"), + uiModificationCallback = { binding -> binding.hintTv.setTextColor(R.color.theme_font.toColor(context)) } ) } @@ -431,8 +435,8 @@ object DialogHelper { platform = platform ) }, - Config(hint = "注意:卸载前请妥善保存游戏账号与密码"), - { binding -> binding.hintTv.setTextColor(R.color.text_FF0000.toColor()) } + extraConfig = Config(hint = "注意:卸载前请妥善保存游戏账号与密码"), + uiModificationCallback = { binding -> binding.hintTv.setTextColor(R.color.text_FF0000.toColor()) } ) } diff --git a/module_setting/src/main/java/com/gh/gamecenter/setting/view/SettingsFragment.kt b/module_setting/src/main/java/com/gh/gamecenter/setting/view/SettingsFragment.kt index a717642f63..d867a0cad3 100644 --- a/module_setting/src/main/java/com/gh/gamecenter/setting/view/SettingsFragment.kt +++ b/module_setting/src/main/java/com/gh/gamecenter/setting/view/SettingsFragment.kt @@ -276,7 +276,7 @@ class SettingsFragment : ToolbarFragment() { requireContext(), USAGE_STATUS_REQUEST_CODE ) - }, {}, DialogHelper.Config(centerContent = true, centerTitle = true) + }, {}, extraConfig = DialogHelper.Config(centerContent = true, centerTitle = true) ) } else { val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils)