Merge branch 'dev' of git.ghzs.com:halo/android/assistant-android into dev

This commit is contained in:
jack
2021-07-22 17:34:02 +08:00
10 changed files with 120 additions and 95 deletions

View File

@ -669,7 +669,7 @@ object NewLogUtils {
val json = json {
"location" to "推荐信息流"
"event" to "click_for_you_badge"
"ref_user_id" to badgeId
"badge_id" to badgeId
"meta" to LogUtils.getMetaObject()
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
@ -1013,8 +1013,8 @@ object NewLogUtils {
//论坛详情滑动信息流内容
fun logForumDetailFeedSlide(slideContentNum: Int) {
val json = json {
"location" to "论坛详情页"
"event" to "slide_forum_detail_feed_content"
"location" to "论坛详情页"
"slide_content_num" to slideContentNum
"meta" to LogUtils.getMetaObject()
"launch_id" to Tracker.launchId
@ -1023,4 +1023,50 @@ object NewLogUtils {
}
log(json, "bbs_community", false)
}
//进入版规说明页
fun logForumRuleEnter(bbsId: String, bbsType: String) {
val json = json {
"event" to "view_layout_description"
"location" to "版规说明"
"bbs_id" to bbsId
"bbs_type" to bbsType
"meta" to LogUtils.getMetaObject()
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
"timestamp" to System.currentTimeMillis() / 1000
}
log(json, "bbs_community", false)
}
//进入版主成员页
fun logForumModeratorEnter(bbsId: String, bbsType: String) {
val json = json {
"event" to "view_forum_member"
"location" to "版主成员"
"bbs_id" to bbsId
"bbs_type" to bbsType
"meta" to LogUtils.getMetaObject()
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
"timestamp" to System.currentTimeMillis() / 1000
}
log(json, "bbs_community", false)
}
//进入版主成员页
fun logForumModeratorClick(event: String, userId: String = "") {
val json = json {
"event" to event
"location" to "版主成员"
if (userId.isNotEmpty()) {
"ref_user_id" to userId
}
"meta" to LogUtils.getMetaObject()
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
"timestamp" to System.currentTimeMillis() / 1000
}
log(json, "bbs_community", false)
}
}

View File

@ -78,7 +78,7 @@ class ForumArticleAskListAdapter(context: Context, val bbsId: String, val mEntra
binding.includeVoteAndComment.root.layoutParams = params
val tabInfo = "${path}tab"
answerViewHolder.bindForumAnswerItem(answer, mEntrance, path, position, tabInfo)
answerViewHolder.bindForumAnswerItem(answer, mEntrance, path, position)
answerViewHolder.itemView.setOnClickListener {
val entrance = BaseActivity.mergeEntranceAndPath(mEntrance, path)
val userId = answer.user.id ?: ""

View File

@ -215,21 +215,13 @@ class ForumDetailFragment : BaseLazyTabFragment() {
if (it < mFragmentsList.size) {
(mFragmentsList.safelyGetInRelease(it) as ForumArticleAskListFragment).refreshScrollHelper()
}
}
mTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabReselected(tab: TabLayout.Tab?) {}
override fun onTabUnselected(tab: TabLayout.Tab?) {}
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.position) {
0 -> NewLogUtils.logForumDetailEnterOrClick("click_all_tab", bbsId, bbsType, "", mFilter)
1 -> NewLogUtils.logForumDetailEnterOrClick("click_essence_tab", bbsId, bbsType)
2 -> NewLogUtils.logForumDetailEnterOrClick("click_question_tab", bbsId, bbsType)
3 -> NewLogUtils.logForumDetailEnterOrClick("click_video_tab", bbsId, bbsType, "", mVideoFilter)
}
when (it) {
0 -> NewLogUtils.logForumDetailEnterOrClick("click_all_tab", bbsId, bbsType, "", mFilter)
1 -> NewLogUtils.logForumDetailEnterOrClick("click_essence_tab", bbsId, bbsType)
2 -> NewLogUtils.logForumDetailEnterOrClick("click_question_tab", bbsId, bbsType)
3 -> NewLogUtils.logForumDetailEnterOrClick("click_video_tab", bbsId, bbsType, "", mVideoFilter)
}
})
}
mBinding.refreshLayout.setOnRefreshListener {
if (mAllForumArticleAskListFragment != null && mViewPager.currentItem == 0) {
mAllForumArticleAskListFragment?.refresh()
@ -378,7 +370,8 @@ class ForumDetailFragment : BaseLazyTabFragment() {
showCommunityEditWindow()
}
R.id.moderatorTv -> {
NewLogUtils.logForumDetailEnterOrClick("cilck_forum_member", bbsId, bbsType)
NewLogUtils.logForumDetailEnterOrClick("click_forum_member", bbsId, bbsType)
NewLogUtils.logForumModeratorEnter(bbsId, bbsType)
requireContext().startActivity(ModeratorListActivity.getIntent(requireContext(), mForumDetail?.id
?: "", mForumDetail?.type ?: "", mEntrance, "论坛详情"))
}
@ -387,7 +380,7 @@ class ForumDetailFragment : BaseLazyTabFragment() {
mViewModel?.getForumDetail()
}
R.id.gameZoneTv -> {
NewLogUtils.logForumDetailEnterOrClick("cilck_strategy_zone", bbsId, bbsType)
NewLogUtils.logForumDetailEnterOrClick("click_strategy_zone", bbsId, bbsType)
if (mForumDetail?.zone != null) {
MtaHelper.onEvent("论坛详情", "顶部区域", "游戏专区")
GameDetailActivity.startGameDetailByShortcut(requireContext(), mForumDetail?.game?.id
@ -395,7 +388,7 @@ class ForumDetailFragment : BaseLazyTabFragment() {
}
}
R.id.forumThumbBig -> {
NewLogUtils.logForumDetailEnterOrClick("cilck_forum_detail_forum_icon", bbsId)
NewLogUtils.logForumDetailEnterOrClick("click_forum_detail_forum_icon", bbsId)
MtaHelper.onEvent("论坛详情", "顶部区域", "游戏图标")
if (mForumDetail?.game?.active == true) {
GameDetailActivity.startGameDetailActivity(requireContext(), mForumDetail?.game?.id
@ -418,7 +411,7 @@ class ForumDetailFragment : BaseLazyTabFragment() {
} else {
mViewModel?.followForum {
val userId = UserManager.getInstance().userId
NewLogUtils.logForumDetailEnterOrClick("cilck_forum_detail_follow", bbsId, bbsType, userId)
NewLogUtils.logForumDetailEnterOrClick("click_forum_detail_follow", bbsId, bbsType, userId)
MtaHelper.onEvent("论坛详情", "顶部区域", "关注")
mForumDetail?.me?.isFollower = true
ToastUtils.showToast("关注成功")
@ -431,7 +424,8 @@ class ForumDetailFragment : BaseLazyTabFragment() {
}
R.id.forumRuleContainer -> {
NewLogUtils.logForumDetailEnterOrClick("cilck_layout_describtion",bbsId, bbsType)
NewLogUtils.logForumDetailEnterOrClick("click_layout_description", bbsId, bbsType)
NewLogUtils.logForumRuleEnter(bbsId, bbsType)
startActivity(NewsDetailActivity.getIntentById(requireContext(), Constants.FORUM_REGULATIONS_NEWS_ID, "论坛详情"))
}
}
@ -629,6 +623,7 @@ class ForumDetailFragment : BaseLazyTabFragment() {
}
override fun onBackPressed(): Boolean {
NewLogUtils.logForumDetailEnterOrClick("click_forum_detail_return", bbsId, bbsType)
return (mFragmentsList[mBinding.fragmentViewPager.currentItem] as ForumArticleAskListFragment).onBackPressed()
}

View File

@ -27,7 +27,7 @@ class ForumTopLinkAdapter(context: Context, val links: ArrayList<LinkEntity>, va
MtaHelper.onEvent("论坛详情", "论坛置顶", linkEntity.text)
DirectUtils.directToLinkPage(mContext, linkEntity, "论坛详情", "")
val bbsType = if (bbsType == "game_bbs") "游戏论坛" else "综合论坛"
NewLogUtils.logForumDetailEnterOrClick("cilck_top_content", bbsId, bbsType)
NewLogUtils.logForumDetailEnterOrClick("click_top_content", bbsId, bbsType)
NewLogUtils.logForumLinkTopClick(bbsId, bbsType)
}
if (position == 0) {

View File

@ -128,6 +128,11 @@ class CommunityHomeFragment : LazyFragment() {
onPageSelected = { position ->
updateTabTextStyle(position, 0F)
mBinding?.communityEditBtn?.goneIf(position != 0)
when (position) {
0 -> NewLogUtils.logCommunityHomeEvent("click_for_you_tab")
1 -> NewLogUtils.logCommunityHomeEvent("click_forum_tab")
2 -> NewLogUtils.logCommunityHomeEvent("click_activity_tab")
}
},
onPageScrolled = { position, positionOffset, _ ->
if (position + 1 != mTabList.size) {
@ -156,20 +161,6 @@ class CommunityHomeFragment : LazyFragment() {
)
}
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabReselected(tab: TabLayout.Tab?) {}
override fun onTabUnselected(tab: TabLayout.Tab?) {}
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.position) {
0 -> NewLogUtils.logCommunityHomeEvent("click_for_you_tab")
1 -> NewLogUtils.logCommunityHomeEvent("click_forum_tab")
2 -> NewLogUtils.logCommunityHomeEvent("click_activity_tab")
}
}
})
tabLayout.setupWithViewPager(viewPager)
indicatorView.run {
setupWithTabLayout(tabLayout)

View File

@ -119,7 +119,8 @@ class ForumActivityAdapter(context: Context,
}
root.setOnClickListener {
NewLogUtils.logForumActivityClick(mViewModel.categoryId, activityEntity.id)
val categoryId = if (mViewModel.categoryId.isEmpty()) "all" else mViewModel.categoryId
NewLogUtils.logForumActivityClick(categoryId, activityEntity.id)
if (status == "未开始") ToastUtils.toast("别着急,活动快开始咯")
if (status == "正在评奖") ToastUtils.toast("活动正在评奖中")
if (status == "奖励发放中") ToastUtils.toast("活动奖励发放中~")

View File

@ -27,9 +27,9 @@ import com.shuyu.gsyvideoplayer.utils.OrientationUtils
class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : BaseAnswerOrArticleItemViewHolder(binding.root) {
fun bindForumAnswerItem(entity: AnswerEntity, entrance: String, path: String, position: Int? = null, tabInfo: String? = null) {
bindItem(entity, entrance, path, tabInfo)
bindCommendAndVote(entity, BaseActivity.mergeEntranceAndPath(entrance, path), position, tabInfo)
fun bindForumAnswerItem(entity: AnswerEntity, entrance: String, path: String, position: Int? = null) {
bindItem(entity, entrance, path)
bindCommendAndVote(entity, BaseActivity.mergeEntranceAndPath(entrance, path), path, position)
}
fun bindForumArticleItem(entity: ArticleEntity, entrance: String, path: String, position: Int) {
@ -37,7 +37,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
bindCommendAndVote(entity, BaseActivity.mergeEntranceAndPath(entrance, path), position)
}
private fun bindItem(entity: AnswerEntity, entrance: String, path: String, tabInfo: String? = null) {
private fun bindItem(entity: AnswerEntity, entrance: String, path: String) {
binding.entity = entity
binding.executePendingBindings()
@ -89,7 +89,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
if (entrance == "社区") {
NewLogUtils.logRecommendFeedBadgeClick(user.badge?.name ?: "")
}
if (entrance == "论坛详情" && tabInfo != null) {
if (entrance == "论坛详情") {
NewLogUtils.logForumDetailFeedBadgeClick(user.badge?.name ?: "", bbsId, bbsType)
}
DialogUtils.showViewBadgeDialog(binding.root.context, user.badge) {
@ -103,8 +103,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
if (entrance == "社区") {
NewLogUtils.logRecommendFeedUserClick("click_for_you_profile_photo", userId, contentType)
}
if (entrance == "论坛详情" && tabInfo != null) {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_profile_photo", userId, contentType, tabInfo, bbsId, bbsType)
if (entrance == "论坛详情") {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_profile_photo", userId, contentType, "${path}tab", bbsId, bbsType)
}
MtaHelper.onEvent(getEventId(BaseActivity.mergeEntranceAndPath(entrance, path)), getKey(BaseActivity.mergeEntranceAndPath(entrance, path)), "用户头像")
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, 1, entrance, path)
@ -113,8 +113,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
if (entrance == "社区") {
NewLogUtils.logRecommendFeedUserClick("click_for_you_nickname", userId, contentType)
}
if (entrance == "论坛详情" && tabInfo != null) {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_nickname", userId, contentType, tabInfo, bbsId, bbsType)
if (entrance == "论坛详情") {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_nickname", userId, contentType, "${path}tab", bbsId, bbsType)
}
MtaHelper.onEvent(getEventId(BaseActivity.mergeEntranceAndPath(entrance, path)), getKey(BaseActivity.mergeEntranceAndPath(entrance, path)), "用户名字")
DirectUtils.directToHomeActivity(binding.root.context, entity.user.id, 1, entrance, path)
@ -128,8 +128,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
if (entrance == "论坛首页+(搜索)") {
NewLogUtils.logForumSearchFollowClick("关注用户", bbsId, bbsType, userId)
}
if (entrance == "论坛详情" && tabInfo != null) {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_follow", userId, contentType, tabInfo, bbsId, bbsType)
if (entrance == "论坛详情") {
NewLogUtils.logForumDetailFeedUserClick("click_forum_detail_follow", userId, contentType, "${path}tab", bbsId, bbsType)
}
followUser(entity, object : EmptyCallback {
override fun onCallback() {
@ -209,7 +209,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
}
}
override fun bindCommendAndVote(entity: AnswerEntity, entrance: String, position: Int?, tabInfo: String?) {
override fun bindCommendAndVote(entity: AnswerEntity, entrance: String, path: String?, position: Int?) {
if (entity.type != "question") {
binNormalView(entity)
} else {
@ -241,15 +241,10 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
commentCountContainer.setOnClickListener {
if (filterIllegalCommentStatus(entity.commentable, entity.active)) return@setOnClickListener
if (entrance == "论坛详情" && position != null && tabInfo != null) {
if (entrance.contains("论坛详情") && position != null) {
entity.run {
val userId = entity.user.id ?: ""
val contentId = entity.id ?: ""
val commentType = when (entity.type) {
"community_article" -> "帖子评论"
"video" -> "视频帖评论"
else -> "提问帖评论"
}
val contentType = when (entity.type) {
"community_article" -> "帖子"
"video" -> "视频帖"
@ -259,6 +254,12 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
val sequence = position + 1
val bbsId = entity.bbs.id
val bbsType = if (entity.bbs.type == "official_bbs") "综合论坛" else "游戏论坛"
val tabInfo = "${path}tab"
val commentType = when (entity.type) {
"community_article" -> "帖子评论"
"video" -> "视频帖评论"
else -> "提问帖评论"
}
NewLogUtils.logForumDetailFeedContentClick("click_forum_detail_comment", userId, contentId, contentType, sequence, bbsId, bbsType, tabInfo, commentType)
}
}
@ -293,7 +294,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
if (entrance == "论坛详情" && position != null && tabInfo != null) {
if (entrance.contains("论坛详情") && position != null) {
entity.run {
val userId = entity.user.id ?: ""
val contentId = entity.id ?: ""
@ -306,6 +307,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
val sequence = position + 1
val bbsId = entity.bbs.id
val bbsType = if (entity.bbs.type == "official_bbs") "综合论坛" else "游戏论坛"
val tabInfo = "${path}tab"
NewLogUtils.logForumDetailFeedContentClick("click_forum_detail_like", userId, contentId, contentType, sequence, bbsId, bbsType, tabInfo)
}
}

View File

@ -3,40 +3,11 @@ package com.gh.gamecenter.forum.list
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.gh.common.util.EntranceUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.NormalActivity
class ForumListActivity : NormalActivity() {
override fun provideNavigationItemClickListener() = View.OnClickListener {
val bundle = intent.getBundleExtra(NORMAL_FRAGMENT_BUNDLE)
bundle?.run {
var event = ""
var location = ""
when (getString(EntranceUtils.KEY_TYPE)) {
TYPE_FOLLOW -> {
event = "click_followforum_return"
location = "关注论坛页"
}
TYPE_HOT -> {
event = "click_hotforum_return"
location = "热门论坛页"
}
TYPE_OFFICIAL -> {
event = "click_multipleforum_return"
location = "综合论坛页"
}
}
NewLogUtils.logForumPageEnterOrReturnClick(event, location)
}
onBackPressed()
}
companion object {
const val TYPE_FOLLOW = "follow"
const val TYPE_HOT = "hot"

View File

@ -1,12 +1,8 @@
package com.gh.gamecenter.forum.list
import android.os.Bundle
import com.gh.common.util.EntranceUtils
import com.gh.common.util.dip2px
import com.gh.common.util.toColor
import com.gh.common.util.viewModelProvider
import com.gh.common.util.*
import com.gh.common.view.SpacingItemDecoration
import com.gh.gamecenter.R
import com.gh.gamecenter.baselist.ListFragment
import com.gh.gamecenter.entity.ForumEntity
@ -38,4 +34,27 @@ class ForumListFragment: ListFragment<ForumEntity, ForumListViewModel>() {
super.onCreate(savedInstanceState)
}
override fun onBackPressed(): Boolean {
var event = ""
var location = ""
when (mViewModel?.type) {
ForumListActivity.TYPE_FOLLOW -> {
event = "click_followforum_return"
location = "关注论坛页"
}
ForumListActivity.TYPE_HOT -> {
event = "click_hotforum_return"
location = "热门论坛页"
}
ForumListActivity.TYPE_OFFICIAL -> {
event = "click_multipleforum_return"
location = "综合论坛页"
}
}
NewLogUtils.logForumPageEnterOrReturnClick(event, location)
return super.onBackPressed()
}
}

View File

@ -47,7 +47,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
val forumIcon: GameIconView? = itemView.findViewById(R.id.forumIcon)
open fun bindCommendAndVote(entity: AnswerEntity, entrance: String, position: Int? = null, tabInfo: String? = null) {
open fun bindCommendAndVote(entity: AnswerEntity, entrance: String, path: String? = null, position: Int? = null) {
binNormalView(entity)
commentCountContainer.setOnClickListener {
@ -130,7 +130,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
val bbsType = if (entity.bbs.type == "official_bbs") "综合论坛" else "游戏论坛"
forumNameTv.setOnClickListener {
if (entrance == "社区") {
if (entrance == "社区+(推荐)") {
NewLogUtils.logRecommendFeedForumClick(contentType, entity.id, entity.bbs.id, bbsType)
}
@ -146,7 +146,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
commentCountContainer.setOnClickListener {
if (filterIllegalCommentStatus(entity.commentable, entity.active)) return@setOnClickListener
if (entrance == "社区" && position != null) {
if (entrance == "社区+(推荐)" && position != null) {
entity.run {
val commentType = when (entity.type) {
"community_article" -> "帖子评论"
@ -187,7 +187,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
if (entrance == "社区" && position != null) {
if (entrance == "社区+(推荐)" && position != null) {
entity.run {
NewLogUtils.logRecommendFeedContentClick("click_for_you_like", contentType, id, position + 1, bbs.id, bbsType, user.id ?: "")
}