This commit is contained in:
@ -26,7 +26,6 @@ import com.gh.gamecenter.gamedetail.rating.RatingFragment
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
|
||||
import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant
|
||||
import com.gh.gamecenter.home.slide.HomeSlideListAdapter
|
||||
import com.halo.assistant.fragment.game.GamePluginAdapter
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.view.CheckableImageView
|
||||
@ -163,7 +162,6 @@ class AmwayAdapter(context: Context, private var mViewModel: AmwayViewModel, pri
|
||||
when (val adapter = recyclerView?.adapter) {
|
||||
is GameVerticalAdapter -> adapter.notifyItemByDownload(download)
|
||||
is GamePluginAdapter -> adapter.notifyItemByDownload(download)
|
||||
is HomeSlideListAdapter -> adapter.notifyItemByDownload(download)
|
||||
}
|
||||
} else {
|
||||
notifyItemChanged(gameAndPosition.position)
|
||||
|
||||
@ -9,6 +9,7 @@ import androidx.recyclerview.widget.PagerSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.databind.BindingAdapters
|
||||
import com.gh.common.exposure.ExposureEvent
|
||||
import com.gh.common.exposure.ExposureSource
|
||||
import com.gh.common.util.DataLogUtils
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
@ -27,7 +28,8 @@ class HomeSlideListAdapter(context: Context,
|
||||
var itemData: HomeItemData,
|
||||
val layoutManager: LinearLayoutManager,
|
||||
val snapHelper: PagerSnapHelper,
|
||||
val recyclerView: RecyclerView) : BaseRecyclerAdapter<HomeSlideListItemViewHolder>(context) {
|
||||
val recyclerView: RecyclerView,
|
||||
val basicExposureSource: ExposureSource) : BaseRecyclerAdapter<HomeSlideListItemViewHolder>(context) {
|
||||
|
||||
private var mSlideList: List<HomeSlide> = itemData.slides ?: arrayListOf()
|
||||
private val mLooperHandle = LooperHandle(this)
|
||||
@ -57,19 +59,28 @@ class HomeSlideListAdapter(context: Context,
|
||||
}
|
||||
|
||||
val homeSlide = mSlideList[actualPosition]
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
if (homeSlide.linkType == "game") {
|
||||
exposureEvent = ExposureEvent.createEvent(
|
||||
gameEntity = homeSlide.linkGame,
|
||||
source = listOf(basicExposureSource, ExposureSource("轮播图", "")))
|
||||
itemData.exposureEventList?.add(exposureEvent)
|
||||
}
|
||||
|
||||
holder.bindSlideListItem(homeSlide)
|
||||
holder.binding.root.setOnClickListener {
|
||||
val actualPositionString = (actualPosition + 1).toString()
|
||||
if (homeSlide.linkType == "video") {
|
||||
MtaHelper.onEvent("首页_新", "轮播_点击", actualPositionString + "_视频详情")
|
||||
} else {
|
||||
} else if (homeSlide.linkType == "game") {
|
||||
MtaHelper.onEvent("首页_新", "轮播_点击", actualPositionString + "_游戏详情")
|
||||
}
|
||||
|
||||
DataLogUtils.uploadLunbotuLog(mContext, homeSlide.linkType, homeSlide.linkText, actualPositionString, "新首页")
|
||||
DirectUtils.directToLinkPage(mContext, homeSlide.transformLinkEntity(),
|
||||
"", "新首页-轮播图[${homeSlide.linkText}=${homeSlide.linkType}=$actualPositionString]",
|
||||
findExposureEvent(homeSlide.linkId),
|
||||
exposureEvent,
|
||||
unknownCallback = {
|
||||
mContext.startActivity(AboutActivity.getIntent(mContext, true))
|
||||
})
|
||||
@ -80,22 +91,13 @@ class HomeSlideListAdapter(context: Context,
|
||||
val linkGame = homeSlide.linkGame
|
||||
DataLogUtils.uploadLunbotuLog(mContext, homeSlide.linkType, homeSlide.linkText, actualPositionString, "新首页")
|
||||
if (linkGame != null) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, linkGame.id, "(新首页-轮播图[${homeSlide.linkText}=${homeSlide.linkType}=$actualPositionString])", findExposureEvent(homeSlide.linkId))
|
||||
GameDetailActivity.startGameDetailActivity(mContext, linkGame.id, "(新首页-轮播图[${homeSlide.linkText}=${homeSlide.linkType}=$actualPositionString])", exposureEvent)
|
||||
}
|
||||
}
|
||||
BindingAdapters.setGameTags(holder.binding.includeGame.gameTags, homeSlide.linkGame?.tagStyle, 3)
|
||||
holder.binding.unknownBackground.goneIf(DirectUtils.directLinkTypes.contains(homeSlide.linkType))
|
||||
}
|
||||
|
||||
private fun findExposureEvent(gameId: String): ExposureEvent? {
|
||||
for (ev in itemData.exposureEventList ?: arrayListOf()) {
|
||||
if (ev.payload.gameId == gameId) {
|
||||
return ev
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun getActualPosition(position: Int): Int {
|
||||
var actualPosition = position
|
||||
if (mSlideList.size in 1..position) {
|
||||
|
||||
@ -6,7 +6,6 @@ import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.PagerSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.common.exposure.ExposureEvent
|
||||
import com.gh.common.exposure.ExposureSource
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.common.view.FixLinearLayoutManager
|
||||
@ -21,7 +20,7 @@ class HomeSlideListViewHolder(val binding: HomeSlideListBinding) : BaseRecyclerV
|
||||
val context = binding.recyclerView.context
|
||||
var adapter = binding.recyclerView.adapter
|
||||
|
||||
generateExposure(itemData, basicExposureSource)
|
||||
itemData.exposureEventList = arrayListOf()
|
||||
|
||||
if (adapter is HomeSlideListAdapter) {
|
||||
adapter.checkResetData(slideList)
|
||||
@ -33,7 +32,7 @@ class HomeSlideListViewHolder(val binding: HomeSlideListBinding) : BaseRecyclerV
|
||||
|
||||
val snapHelper = PagerSnapHelper()
|
||||
val layoutManager = FixLinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
adapter = HomeSlideListAdapter(context, itemData, layoutManager, snapHelper, binding.recyclerView)
|
||||
adapter = HomeSlideListAdapter(context, itemData, layoutManager, snapHelper, binding.recyclerView, basicExposureSource)
|
||||
(binding.recyclerView.itemAnimator as DefaultItemAnimator).supportsChangeAnimations = false
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.adapter = adapter
|
||||
@ -76,19 +75,6 @@ class HomeSlideListViewHolder(val binding: HomeSlideListBinding) : BaseRecyclerV
|
||||
})
|
||||
}
|
||||
|
||||
private fun generateExposure(itemData: HomeItemData, basicExposureSource: ExposureSource) {
|
||||
val exposureList = arrayListOf<ExposureEvent>()
|
||||
for (slide in itemData.slides!!) {
|
||||
if (slide.linkType == "game") {
|
||||
val event = ExposureEvent.createEvent(
|
||||
gameEntity = slide.linkGame,
|
||||
source = listOf(basicExposureSource, ExposureSource("轮播图", "")))
|
||||
exposureList.add(event)
|
||||
}
|
||||
}
|
||||
itemData.exposureEventList = exposureList
|
||||
}
|
||||
|
||||
// 缩放控制
|
||||
fun updateZoomAnimation() {
|
||||
val childCount = binding.recyclerView.childCount
|
||||
|
||||
Reference in New Issue
Block a user