Compare commits
47 Commits
feat/GHZSC
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c944e529ba | |||
| eaa1a3609f | |||
| 2b9478a1b9 | |||
| dbd6e7bb43 | |||
| 09a823d4da | |||
| 0b49c58884 | |||
| 2e93bcc173 | |||
| 03f6906b46 | |||
| 0f382baec1 | |||
| 62f80bbfdd | |||
| 63be9ac221 | |||
| ade32ef92d | |||
| 58702b46aa | |||
| e6d6fc5309 | |||
| 1460348582 | |||
| c49b3c5efe | |||
| 4f7c468cde | |||
| df93bdda2e | |||
| 086796915b | |||
| f99e5f403d | |||
| 9785f4fa13 | |||
| 6cdff338ed | |||
| 761093a768 | |||
| e5a0db4513 | |||
| a3df62bba8 | |||
| ee773f7e31 | |||
| 227a5e677f | |||
| c41939cd79 | |||
| 125ef60176 | |||
| e2bf2773e4 | |||
| e3596c758e | |||
| 75ca0a8379 | |||
| ef7d2860e5 | |||
| bfc8981253 | |||
| 12d6d338aa | |||
| 4da3c3aec1 | |||
| e608a51cce | |||
| 4f2aea7fcf | |||
| 3abcad5d5d | |||
| 1cca908327 | |||
| 63c0b859f4 | |||
| 5deb741942 | |||
| fd5a3104c4 | |||
| 486dd57a24 | |||
| 058b51f050 | |||
| 149a49fdd8 | |||
| 4314797166 |
@ -154,7 +154,7 @@ android {
|
||||
zipAlignEnabled false
|
||||
signingConfig signingConfigs.debug
|
||||
|
||||
buildConfigField "String", "EXPOSURE_REPO", "\"test\""
|
||||
buildConfigField "String", "EXPOSURE_REPO", "\"exposure\""
|
||||
buildConfigField "String", "EXPOSURE_VERSION", "\"E4\""
|
||||
|
||||
multiDexKeepProguard file("tinker_multidexkeep.pro")
|
||||
|
||||
@ -5,6 +5,7 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.os.Build
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@ -43,6 +44,7 @@ import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* 广告实现代理类
|
||||
@ -120,7 +122,12 @@ object AdDelegateHelper {
|
||||
if (isFromRetry && mAdConfigList.isNotEmpty()) {
|
||||
return
|
||||
}
|
||||
val paramsMap = if (keyword.isNotEmpty()) mapOf("keyword" to keyword) else mapOf()
|
||||
|
||||
val paramsMap = if (keyword.isNotEmpty()) {
|
||||
mapOf("keyword" to keyword, "android_sdk_version" to Build.VERSION.SDK_INT)
|
||||
} else {
|
||||
mapOf("android_sdk_version" to Build.VERSION.SDK_INT)
|
||||
}
|
||||
RetrofitManager.getInstance()
|
||||
.newApi
|
||||
.getAdConfig(paramsMap)
|
||||
@ -182,11 +189,16 @@ object AdDelegateHelper {
|
||||
// HarmonyOS 2.2.0 版本不展示第三方开屏广告 (因为会引起奇怪的闪退)
|
||||
if (MetaUtil.getRom().name == "HarmonyOS"
|
||||
&& MetaUtil.getRom().versionName == "2.2.0"
|
||||
&& config.displayRule.adSource == "third_party_ads") {
|
||||
&& config.displayRule.adSource == AD_TYPE_SDK) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 华为系 Android 10 不展示第三方开屏广告 (因为会引起奇怪的闪退)
|
||||
if (isBuggyHuaweiDevice() && config.displayRule.adSource == AD_TYPE_SDK) {
|
||||
return
|
||||
}
|
||||
|
||||
mSplashAd = config
|
||||
}
|
||||
|
||||
@ -215,6 +227,7 @@ object AdDelegateHelper {
|
||||
private fun shouldShowStartUpAdWhenHotLaunch() = (mCsjAdImpl != null)
|
||||
&& mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
|
||||
&& mSplashAd?.hotStartThirdPartyAd != null
|
||||
&& !isBuggyHuaweiDevice()
|
||||
|
||||
/**
|
||||
* 是否需要显示下载管理广告
|
||||
@ -783,4 +796,16 @@ object AdDelegateHelper {
|
||||
mCsjAdImpl?.cancelSplashAd(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为有问题的华为系 Android 10 设备
|
||||
*/
|
||||
private fun isBuggyHuaweiDevice(): Boolean {
|
||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
|
||||
val manufacturer = Build.MANUFACTURER.lowercase(Locale.CHINA) ?: ""
|
||||
return manufacturer == "huawei" || manufacturer == "honor"
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,12 +16,10 @@ import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.FixLinearLayoutManager
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
|
||||
import com.gh.gamecenter.databinding.DialogReserveBinding
|
||||
import com.gh.gamecenter.databinding.DialogReserveItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.gh.common.exposure
|
||||
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureStateChangeListener
|
||||
import com.gh.gamecenter.feature.exposure.RecyclerViewExposureHelper
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
class DefaultExposureStateChangeListener : IExposureStateChangeListener {
|
||||
|
||||
override fun onExposureStateChange(
|
||||
exposureEvent: ExposureEvent,
|
||||
position: Int,
|
||||
inExposure: Boolean
|
||||
) {
|
||||
val exposureStatus = if (inExposure) "曝光中" else "结束曝光"
|
||||
|
||||
val isCPMExposureEvent = exposureEvent.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM
|
||||
|
||||
Utils.log(
|
||||
RecyclerViewExposureHelper.TAG,
|
||||
"onExposureStateChange: 名称 ${exposureEvent.payload.gameName} 位置 $position, $exposureStatus"
|
||||
)
|
||||
|
||||
// 如果是 CPM 曝光事件,且在曝光中,直接上报 CPM 曝光 (内部有做简单的去重处理,CPM 曝光追求一个及时上报,不用理会曝光时长)
|
||||
if (isCPMExposureEvent && inExposure) {
|
||||
Utils.log(
|
||||
RecyclerViewExposureHelper.TAG,
|
||||
"上报 CPM 曝光 ${exposureEvent.payload.gameName} ${exposureEvent.id}"
|
||||
)
|
||||
ExposureManager.logCPM(exposureEvent)
|
||||
}
|
||||
|
||||
if (!inExposure
|
||||
&& System.currentTimeMillis() - exposureEvent.timeInMillisecond > DEFAULT_VALID_EXPOSURE_THRESHOLD
|
||||
) {
|
||||
Utils.log(
|
||||
RecyclerViewExposureHelper.TAG,
|
||||
"上报曝光 ${exposureEvent.payload.gameName} ${exposureEvent.id},是否为 CPM 小游戏 -> ${isCPMExposureEvent}," +
|
||||
"曝光时长为 ${System.currentTimeMillis() - exposureEvent.timeInMillisecond}ms"
|
||||
)
|
||||
|
||||
// 标记当前 ExposureEvent 已经被使用过
|
||||
exposureEvent.markIsUsed()
|
||||
ExposureManager.log(exposureEvent)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
// 默认曝光有效时长
|
||||
const val DEFAULT_VALID_EXPOSURE_THRESHOLD = 1000L
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,12 +4,14 @@ import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.loghub.TLogHubHelper
|
||||
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
|
||||
import com.gh.gamecenter.common.utils.toJson
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.dsp.DspReportHelper
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.minigame.wechat.WGameSubjectCPMListReportHelper
|
||||
import com.google.gson.ExclusionStrategy
|
||||
import com.google.gson.FieldAttributes
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.lightgame.utils.Utils
|
||||
import com.volcengine.model.tls.LogItem
|
||||
|
||||
@ -31,6 +33,20 @@ object ExposureManager {
|
||||
private val exposureSet by lazy { hashSetOf<ExposureEvent>() }
|
||||
private val exposureCache by lazy { FixedSizeLinkedHashSet<String>(300) }
|
||||
|
||||
private val gson by lazy {
|
||||
GsonBuilder()
|
||||
.addSerializationExclusionStrategy(object: ExclusionStrategy {
|
||||
override fun shouldSkipClass(clazz: Class<*>): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun shouldSkipField(f: FieldAttributes): Boolean {
|
||||
return f.name == "additional"
|
||||
}
|
||||
})
|
||||
.create()
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a single exposure event.
|
||||
*/
|
||||
@ -86,6 +102,15 @@ object ExposureManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a wechat mini game cpm collection of exposure event.
|
||||
*/
|
||||
fun logCPM(event: ExposureEvent) {
|
||||
AppExecutor.logExecutor.execute {
|
||||
WGameSubjectCPMListReportHelper.reportExposure(event)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param forcedUpload Ignore all restrictions.
|
||||
*/
|
||||
@ -114,14 +139,14 @@ object ExposureManager {
|
||||
|
||||
private fun buildLog(event: ExposureEvent) = LogItem(System.currentTimeMillis()).apply {
|
||||
addContent("__id", event.id)
|
||||
addContent("payload", event.payload.toJson())
|
||||
addContent("payload", gson.toJson(event.payload))
|
||||
addContent("event", event.event.toString())
|
||||
addContent("source", eliminateMultipleBrackets(event.source.toJson()))
|
||||
addContent("meta", event.meta.toJson())
|
||||
addContent("source", eliminateMultipleBrackets(gson.toJson(event.source)))
|
||||
addContent("meta", gson.toJson(event.meta))
|
||||
addContent("real_millisecond", event.timeInMillisecond.toString())
|
||||
addContent(
|
||||
"e-traces", if (event.eTrace != null) {
|
||||
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
|
||||
eliminateMultipleBrackets(gson.toJson(event.eTrace))
|
||||
} else ""
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,13 +8,13 @@ object ExposureTraceUtils {
|
||||
val traceList = arrayListOf<ExposureEvent>()
|
||||
|
||||
event?.let {
|
||||
//这里使用deepCopy,是为了防止循环引用调用hashCode方法触发StackOverflowError错误
|
||||
val deepCopy = it.deepCopy()
|
||||
if (deepCopy.eTrace == null) {
|
||||
traceList.add(deepCopy)
|
||||
//这里使用 copy,是为了防止循环引用调用hashCode方法触发StackOverflowError错误
|
||||
val exposureCopy = it.shallowCopy()
|
||||
if (exposureCopy.eTrace == null) {
|
||||
traceList.add(exposureCopy)
|
||||
} else {
|
||||
traceList.addAll(deepCopy.eTrace!!)
|
||||
traceList.add(flattenTrace(deepCopy))
|
||||
traceList.addAll(exposureCopy.eTrace!!)
|
||||
traceList.add(flattenTrace(exposureCopy))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.entity.LaunchRedirect
|
||||
import com.gh.gamecenter.common.entity.LaunchRedirectWrapper
|
||||
import com.gh.gamecenter.common.pagelevel.PageLevelManager
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.utils.singleToMain
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
@ -65,9 +66,11 @@ class LaunchRedirectHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity) && launchData?.type != "bottom_tab") {
|
||||
if (getStatus() == STATUS_VALID) {
|
||||
// 当 type 为 "bottom_tab" 时上面 doPreProcess 中已经处理过了,但再选中一次好像也没有什么问题,先不特殊处理这个 case 了
|
||||
// 设置下一个页面为顶级页面
|
||||
PageLevelManager.setNextPageAsSupremePageLevel()
|
||||
|
||||
DirectUtils.directToLinkPage(currentActivity!!, launchData!!, "首次启动跳转", "")
|
||||
// 跳转页面不管回调,延迟 500ms 后执行下一个 handler
|
||||
AppExecutor.uiExecutor.executeWithDelay({
|
||||
|
||||
@ -30,6 +30,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
var packageName = ""
|
||||
var exposureSourceList: List<ExposureSource>? = null
|
||||
var customPageTrackData: CustomPageTrackData? = null
|
||||
var isAd = false
|
||||
var adGroupId = ""
|
||||
val pushMessageId = (HaloApp.get(Constants.PUSH_MESSAGE_ID, false) as? String) ?: ""
|
||||
val pushLinkId = (HaloApp.get(Constants.PUSH_LINK_ENTITY, false) as? LinkEntity)?.link ?: ""
|
||||
val isFromPush = pushMessageId.isNotEmpty()
|
||||
@ -60,6 +62,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
packageName = boundedObject.getUniquePackageName() ?: ""
|
||||
exposureSourceList = boundedObject.exposureEvent?.source
|
||||
customPageTrackData = boundedObject.customPageTrackData
|
||||
isAd = boundedObject.adGroupId.isNotEmpty()
|
||||
adGroupId = boundedObject.adGroupId
|
||||
}
|
||||
|
||||
is GameUpdateEntity -> {
|
||||
@ -144,6 +148,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
|
||||
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
|
||||
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
|
||||
"is_ad", isAd.toString(),
|
||||
"ad_group_id", adGroupId,
|
||||
"is_from_push_notifications", isFromPush,
|
||||
"message_id", pushMessageId,
|
||||
"link_id", pushLinkId,
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.IExposureManagerProvider
|
||||
|
||||
@ -12,4 +9,8 @@ class ExposureManagerProviderImpl: IExposureManagerProvider {
|
||||
override fun logExposure(exposureEvent: ExposureEvent) {
|
||||
ExposureManager.log(exposureEvent)
|
||||
}
|
||||
|
||||
override fun logExposureList(exposureEventList: List<ExposureEvent>) {
|
||||
ExposureManager.log(exposureEventList)
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,20 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.entity.IdfaData
|
||||
import com.gh.gamecenter.common.pagelevel.IPageLevelProvider
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.tracker.IBusiness
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.entity.StartupAdEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object AdHelper {
|
||||
|
||||
@ -12,6 +24,102 @@ object AdHelper {
|
||||
const val LOCATION_SUGGESTION_FUNCTION = "suggestion_function"
|
||||
const val LOCATION_SIMULATOR_GAME = "simulator_game"
|
||||
|
||||
// 广告标识 https://jira.shanqu.cc/browse/GHZSCY-7041
|
||||
private var idfa = ""
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@JvmStatic
|
||||
fun getIdfa(versionName: String, channel: String) {
|
||||
RetrofitManager.getInstance().newApi.getIdfa(versionName, channel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : BiResponse<IdfaData>() {
|
||||
override fun onSuccess(data: IdfaData) {
|
||||
idfa = data.AD
|
||||
|
||||
SensorsBridge.trackGetAdTag(data.AD)
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
|
||||
SensorsBridge.trackGetAdTag("")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun getIdfaString() : String {
|
||||
return idfa
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录广告游戏填充
|
||||
*/
|
||||
fun reportAdRequest(exposureEvent: ExposureEvent) {
|
||||
val payload = exposureEvent.payload
|
||||
NewFlatLogUtils.logAdRequest(
|
||||
pageLevel = payload.pageLevel ?: "",
|
||||
currentPageCode = payload.currentPageCode ?: "",
|
||||
currentPageId = payload.currentPageId ?: "",
|
||||
gameName = payload.gameName ?: "",
|
||||
gameId = payload.gameId ?: "",
|
||||
moduleType = payload.moduleType ?: "",
|
||||
moduleStyle = payload.moduleStyle ?: "",
|
||||
moduleName = payload.moduleName ?: "",
|
||||
moduleId = payload.moduleId ?: "",
|
||||
searchContent = payload.searchContent ?: "",
|
||||
sequence = payload.sequence ?: -1,
|
||||
outerSequence = payload.outerSequence ?: -1,
|
||||
adGroupId = payload.adGroupId ?: "",
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录广告游戏填充
|
||||
*/
|
||||
fun reportAdRequest(gameEntity: GameEntity) {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
val subPageCode = gameEntity.subPageCode
|
||||
val subPageId = gameEntity.subPageId
|
||||
|
||||
val currentActivitySimpleName = if (currentActivity != null) currentActivity::class.simpleName else "unknown"
|
||||
val businessId = if (currentActivity is IBusiness) currentActivity.getBusinessId() else null
|
||||
|
||||
var currentPageCode = currentActivitySimpleName
|
||||
var currentPageId = businessId?.first
|
||||
|
||||
// 子页面的 pageCode 添加到主页面后, pageId 优先级高于主页面 pageId
|
||||
if (!subPageCode.isNullOrEmpty()) {
|
||||
currentPageCode = "$currentActivitySimpleName-$subPageCode"
|
||||
if (!subPageId.isNullOrEmpty()) {
|
||||
currentPageId = subPageId
|
||||
}
|
||||
}
|
||||
|
||||
var pageLevelString: String? = gameEntity.pageLevelString
|
||||
|
||||
if (TextUtils.isEmpty(pageLevelString)) {
|
||||
val pageLevelProvider = currentActivity as? IPageLevelProvider
|
||||
pageLevelString = pageLevelProvider?.getPageLevel()?.toFormattedString()
|
||||
}
|
||||
|
||||
NewFlatLogUtils.logAdRequest(
|
||||
pageLevel = pageLevelString ?: "",
|
||||
currentPageCode = currentPageCode ?: "",
|
||||
currentPageId = currentPageId ?: "",
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameId = gameEntity.id,
|
||||
moduleStyle = gameEntity.customPageTrackData?.modulePattern ?: "",
|
||||
moduleType = gameEntity.customPageTrackData?.moduleType ?: "",
|
||||
moduleName = gameEntity.customPageTrackData?.linkContentName ?: "",
|
||||
moduleId = gameEntity.customPageTrackData?.linkContentId ?: "",
|
||||
searchContent = "",
|
||||
sequence = gameEntity.sequence ?: -1,
|
||||
outerSequence = gameEntity.outerSequence ?: -1,
|
||||
adGroupId = gameEntity.adGroupId,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getStartUp(): StartupAdEntity? {
|
||||
return Config.getNewApiSettingsEntity()?.startup
|
||||
|
||||
@ -867,6 +867,8 @@ object DownloadItemUtils {
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"source", gameEntity.exposureEvent?.source?.toString() ?: "",
|
||||
"is_ad", if (gameEntity.adGroupId.isEmpty()) "false" else "true",
|
||||
"ad_group_id", gameEntity.adGroupId,
|
||||
*gameEntity.customPageTrackData?.toKV() ?: arrayOf()
|
||||
)
|
||||
allStateClickCallback?.onCallback()
|
||||
|
||||
@ -501,6 +501,7 @@ object DownloadObserver {
|
||||
|
||||
val isPlatformRecommend =
|
||||
java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
|
||||
val adGroupId = downloadEntity.getMetaExtra(Constants.AD_GROUP_ID)
|
||||
val exposureEvent = ExposureUtils.logADownloadCompleteExposureEvent(
|
||||
GameEntity(
|
||||
_id = downloadEntity.gameId,
|
||||
@ -534,6 +535,8 @@ object DownloadObserver {
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_type", downloadEntity.categoryChinese,
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
"is_ad", if (adGroupId.isEmpty()) "false" else "true",
|
||||
"ad_group_id", adGroupId,
|
||||
*kvs
|
||||
)
|
||||
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
|
||||
@ -598,6 +601,8 @@ object DownloadObserver {
|
||||
if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
"is_from_push_notifications",
|
||||
isFromPush,
|
||||
"is_ad", if (adGroupId.isEmpty()) "false" else "true",
|
||||
"ad_group_id", adGroupId,
|
||||
"message_id",
|
||||
pushMessageId,
|
||||
"link_id",
|
||||
|
||||
@ -99,6 +99,11 @@ object GameSubstituteRepositoryHelper {
|
||||
continue
|
||||
}
|
||||
|
||||
// 广告系统的广告游戏不替换
|
||||
if (game.adGroupId.isNotEmpty()) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 这个 position 的游戏是否需要被替换
|
||||
var thisPositionNeedToBeReplaced = false
|
||||
|
||||
|
||||
@ -2779,6 +2779,44 @@ object NewFlatLogUtils {
|
||||
}.let(::log)
|
||||
}
|
||||
|
||||
/**
|
||||
* 广告游戏填充
|
||||
* 广告游戏填充到广告位置时,上报该广告游戏插入的位置信息(用于数据回收验证策略的效果,无须曝光,只要请求了广告,就上报)
|
||||
*/
|
||||
fun logAdRequest(
|
||||
pageLevel: String,
|
||||
currentPageCode: String,
|
||||
currentPageId: String,
|
||||
gameName: String,
|
||||
gameId: String,
|
||||
moduleType: String,
|
||||
moduleStyle: String,
|
||||
moduleName: String,
|
||||
moduleId: String,
|
||||
searchContent: String,
|
||||
sequence: Int,
|
||||
outerSequence: Int,
|
||||
adGroupId: String,
|
||||
) {
|
||||
json {
|
||||
KEY_EVENT to "ad_request"
|
||||
"page_level" to pageLevel
|
||||
"current_page_code" to currentPageCode
|
||||
"current_page_id" to currentPageId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_ID to gameId
|
||||
"module_type" to moduleType
|
||||
"module_style" to moduleStyle
|
||||
"module_name" to moduleName
|
||||
"module_id" to moduleId
|
||||
"search_content" to searchContent
|
||||
"sequence" to sequence
|
||||
"outer_sequence" to outerSequence
|
||||
"ad_group_id" to adGroupId
|
||||
parseAndPutMeta()(this)
|
||||
}.let(::log)
|
||||
}
|
||||
|
||||
// 自有开屏广告加载
|
||||
fun logSplashAdLoad(id: String) {
|
||||
json {
|
||||
|
||||
@ -80,6 +80,8 @@ object ReservationHelper {
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"source", game?.exposureEvent?.source?.toString() ?: "",
|
||||
"is_ad", if (game?.adGroupId.isNullOrEmpty() == true) "false" else "true",
|
||||
"ad_group_id", game?.adGroupId ?: "",
|
||||
*game?.customPageTrackData?.toKV() ?: arrayOf()
|
||||
)
|
||||
|
||||
@ -118,6 +120,8 @@ object ReservationHelper {
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"source", game?.exposureEvent?.source?.toString() ?: "",
|
||||
"is_ad", if (game?.adGroupId.isNullOrEmpty() == true) "false" else "true",
|
||||
"ad_group_id", game?.adGroupId ?: "",
|
||||
*game?.customPageTrackData?.toKV() ?: arrayOf()
|
||||
)
|
||||
ToastUtils.showToast(exception.message ?: "")
|
||||
|
||||
@ -20,6 +20,7 @@ import com.gh.gamecenter.common.utils.setDrawableEnd
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import splitties.views.leftPadding
|
||||
|
||||
class ConfigFilterView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
@ -213,6 +214,10 @@ class ConfigFilterView @JvmOverloads constructor(
|
||||
fun initSubjectFilterView(subjectSetting: SubjectSettingEntity) {
|
||||
ratingTv.visibility = View.VISIBLE
|
||||
|
||||
if (subjectSetting.typeEntity.layout == "hide") {
|
||||
container.leftPadding = 8F.dip2px()
|
||||
}
|
||||
|
||||
if (subjectSetting.filterOptions.size > 1) {
|
||||
// 重排序
|
||||
subjectSetting.filterOptions.forEachIndexed { index, s ->
|
||||
|
||||
@ -60,6 +60,7 @@ import com.gh.ndownload.NDownloadBridge;
|
||||
import com.gh.ndownload.NDownloadService;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lg.vspace.archive.common.Const;
|
||||
import com.lightgame.download.DataWatcher;
|
||||
import com.lightgame.download.DownloadConfig;
|
||||
import com.lightgame.download.DownloadDao;
|
||||
@ -413,6 +414,9 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
// 将下载事件放入 downloadEntity 中供下载完成时取出使用
|
||||
downloadEntity.setExposureTrace(GsonUtils.toJson(downloadExposureEvent));
|
||||
|
||||
// 记录广告组 id
|
||||
ExtensionsKt.addMetaExtra(downloadEntity, Constants.AD_GROUP_ID, gameEntity.getAdGroupId());
|
||||
|
||||
// 保存所有游戏标签
|
||||
List<String> tags = new ArrayList<>();
|
||||
for (TagStyleEntity tag : gameEntity.getTagStyle()) {
|
||||
@ -445,7 +449,9 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_type", gameEntity.getCategoryChinese(),
|
||||
"game_schema_type", gameEntity.getGameBitChinese()
|
||||
"game_schema_type", gameEntity.getGameBitChinese(),
|
||||
"is_ad", TextUtils.isEmpty(gameEntity.getAdGroupId()) ? "false" : "true",
|
||||
"ad_group_id", gameEntity.getAdGroupId(),
|
||||
};
|
||||
List<String> vaList = new ArrayList<>(Arrays.asList(vaKvs));
|
||||
if (customPageTrackData != null) {
|
||||
@ -475,6 +481,8 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_type", gameEntity.getCategoryChinese(),
|
||||
"is_ad", TextUtils.isEmpty(gameEntity.getAdGroupId()) ? "false" : "true",
|
||||
"ad_group_id", gameEntity.getAdGroupId(),
|
||||
"game_label", String.join(",", tags),
|
||||
"game_schema_type", gameEntity.getGameBitChinese(),
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
|
||||
|
||||
@ -76,6 +76,8 @@ import com.gh.gamecenter.common.entity.SuggestType;
|
||||
import com.gh.gamecenter.common.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.common.pagelevel.PageLevel;
|
||||
import com.gh.gamecenter.common.pagelevel.PageLevelManager;
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
@ -88,7 +90,6 @@ import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.utils.ClassUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
@ -228,9 +229,6 @@ public class MainActivity extends BaseActivity {
|
||||
},
|
||||
() -> {
|
||||
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.APP, "APP闪退:", false, 100);
|
||||
MtaHelper.onEventWithBasicDeviceInfo(
|
||||
"闪退弹窗",
|
||||
"玩家操作", "点击反馈");
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
@ -238,17 +236,9 @@ public class MainActivity extends BaseActivity {
|
||||
, "暂不", "马上反馈",
|
||||
() -> {
|
||||
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.APP, "APP闪退:", false, 100);
|
||||
MtaHelper.onEventWithBasicDeviceInfo(
|
||||
"闪退弹窗",
|
||||
"玩家操作", "点击反馈");
|
||||
return null;
|
||||
},
|
||||
() -> {
|
||||
MtaHelper.onEventWithBasicDeviceInfo(
|
||||
"闪退弹窗",
|
||||
"玩家操作", "点击关闭");
|
||||
return null;
|
||||
});
|
||||
() -> null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,7 +383,6 @@ public class MainActivity extends BaseActivity {
|
||||
HistoryHelper.deleteAttentionVideoRecord();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1110,6 +1099,28 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPageLevel(@Nullable Bundle savedInstanceState) {
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.getParcelable(PageLevelManager.KEY_PAGE_LEVEL) != null) {
|
||||
mPageLevel = savedInstanceState.getParcelable(PageLevelManager.KEY_PAGE_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
if (mPageLevel == null) {
|
||||
mPageLevel = new PageLevel(
|
||||
PageLevel.TYPE_T,
|
||||
-1,
|
||||
-1,
|
||||
new HashMap<>(),
|
||||
-1,
|
||||
null);
|
||||
}
|
||||
|
||||
PageLevelManager.INSTANCE.setCurrentPageLevel(mPageLevel);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Pair<String, String> getBusinessId() {
|
||||
if (mMainWrapperFragment != null) {
|
||||
|
||||
@ -330,6 +330,9 @@ class SplashScreenActivity : BaseActivity(), ISplashScreen {
|
||||
}
|
||||
}
|
||||
|
||||
override fun initPageLevel(savedInstanceState: Bundle?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KEY_REGISTRATION_ID = "registration_id"
|
||||
|
||||
@ -135,7 +135,7 @@ class DetailViewHolder(
|
||||
vUpdate = view.findViewById(R.id.v_update)
|
||||
tvUpdate = view.findViewById(R.id.tv_update)
|
||||
|
||||
context = view.context
|
||||
context = view.context.getActivity() ?: view.context
|
||||
com.gh.gamecenter.common.R.color.text_aw_primary.toColor()
|
||||
|
||||
var gameDownloadMode = gameEntity.getGameDownloadButtonMode()
|
||||
@ -605,6 +605,8 @@ class DetailViewHolder(
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"source", mGameEntity.exposureEvent?.source?.toString() ?: "",
|
||||
"is_ad", if (mGameEntity.adGroupId.isEmpty()) "false" else "true",
|
||||
"ad_group_id", mGameEntity.adGroupId,
|
||||
*mGameEntity.customPageTrackData?.toKV() ?: arrayOf()
|
||||
)
|
||||
CheckLoginUtils.checkLogin(mViewHolder.context, mEntrance) {
|
||||
|
||||
@ -8,14 +8,20 @@ import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.GameImageItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
|
||||
/**
|
||||
* 游戏专题-大图-显示/只显示
|
||||
*/
|
||||
class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewHolder<Any>(binding.root),
|
||||
IExposureProvider {
|
||||
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
// 注意:专题详情的大图不能用此方法
|
||||
fun bindImage(entity: GameEntity, applyRoundCorner: Boolean = false) {
|
||||
boundedGameEntity = entity
|
||||
binding.run {
|
||||
gameContainer.goneIf(!(entity.type == "game" && entity.getApk().isNotEmpty()))
|
||||
gameIcon.displayGameIcon(entity)
|
||||
@ -28,11 +34,17 @@ class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewH
|
||||
|
||||
if (applyRoundCorner) {
|
||||
val roundingParams = RoundingParams.fromCornersRadius(
|
||||
binding.root.resources.getDimensionPixelSize(com.gh.gamecenter.common.R.dimen.home_large_image_radius).toFloat()
|
||||
binding.root.resources.getDimensionPixelSize(com.gh.gamecenter.common.R.dimen.home_large_image_radius)
|
||||
.toFloat()
|
||||
)
|
||||
binding.gameImageIcon.hierarchy.roundingParams = roundingParams
|
||||
}
|
||||
|
||||
ImageUtils.displayWithAdaptiveHeight(binding.gameImageIcon, entity.image, width)
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,6 @@ class BannerAdapter(
|
||||
private var mExposureSourceList = ArrayList<ExposureSource>()
|
||||
|
||||
init {
|
||||
mItemData.exposureEventList = arrayListOf()
|
||||
mExposureSourceList.addAll(mExposureSource)
|
||||
mExposureSourceList.add(ExposureSource("精选页轮播图"))
|
||||
}
|
||||
@ -67,7 +66,6 @@ class BannerAdapter(
|
||||
payload.sourcePageName = it[PageSwitchDataHelper.PAGE_BUSINESS_NAME]
|
||||
}
|
||||
}
|
||||
mItemData.exposureEventList?.add(exposureEvent)
|
||||
}
|
||||
|
||||
view.setOnClickListener {
|
||||
@ -88,12 +86,6 @@ class BannerAdapter(
|
||||
mBanners = banners
|
||||
}
|
||||
|
||||
if (mItemData.exposureEventList != null) {
|
||||
mItemData.exposureEventList?.clear()
|
||||
mItemData = itemData
|
||||
mItemData.exposureEventList = arrayListOf()
|
||||
}
|
||||
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@ -13,27 +13,27 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.common.constant.ItemViewType
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
|
||||
import com.gh.gamecenter.databinding.*
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SpecialCatalogEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.subject.SubjectActivity.Companion.startSubjectActivity
|
||||
|
||||
class SpecialCatalogAdapter(
|
||||
context: Context,
|
||||
private val mCatalogViewModel: SpecialCatalogViewModel,
|
||||
private val mLastPageDataMap: HashMap<String, String>? = null
|
||||
) : ListAdapter<SpecialCatalogItemData>(context), IExposable {
|
||||
) : ListAdapter<SpecialCatalogItemData>(context) {
|
||||
|
||||
private val mExposureEventSparseArray: SparseArray<ExposureEvent> = SparseArray()
|
||||
var isAutoScroll = true
|
||||
var isBannerSizeMoreThanOne = false
|
||||
|
||||
@ -153,8 +153,8 @@ class SpecialCatalogAdapter(
|
||||
payload.sourcePageName = it[PageSwitchDataHelper.PAGE_BUSINESS_NAME]
|
||||
}
|
||||
}
|
||||
mExposureEventSparseArray.append(position, exposureEvent)
|
||||
}
|
||||
holder.exposureEvent = exposureEvent
|
||||
root.setOnClickListener {
|
||||
DirectUtils.directToLinkPage(
|
||||
mContext,
|
||||
@ -208,28 +208,32 @@ class SpecialCatalogAdapter(
|
||||
is CatalogSubjectItemHolder -> {
|
||||
val subject = mEntityList[position].subject!!
|
||||
|
||||
val exposureList = arrayListOf<ExposureEvent>()
|
||||
for ((index, game) in subject.link.data.withIndex()) {
|
||||
game.sequence = index
|
||||
game.subjectName = subject.link.text
|
||||
game.outerSequence = mEntityList[position].position
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
for ((index, game) in subject.link.data.withIndex()) {
|
||||
game.sequence = index
|
||||
game.subjectName = subject.link.text
|
||||
game.outerSequence = mEntityList[position].position
|
||||
|
||||
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
|
||||
game,
|
||||
mCatalogViewModel.basicExposureSource,
|
||||
listOf(ExposureSource("精选页专题", subject.link.text ?: ""))
|
||||
).apply {
|
||||
mLastPageDataMap?.let {
|
||||
payload.sourcePage = it[PageSwitchDataHelper.PAGE_BUSINESS_TYPE]
|
||||
payload.sourcePageId = it[PageSwitchDataHelper.PAGE_BUSINESS_ID]
|
||||
payload.sourcePageName = it[PageSwitchDataHelper.PAGE_BUSINESS_NAME]
|
||||
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
|
||||
game,
|
||||
mCatalogViewModel.basicExposureSource,
|
||||
listOf(ExposureSource("精选页专题", subject.link.text ?: ""))
|
||||
).apply {
|
||||
mLastPageDataMap?.let {
|
||||
payload.sourcePage = it[PageSwitchDataHelper.PAGE_BUSINESS_TYPE]
|
||||
payload.sourcePageId = it[PageSwitchDataHelper.PAGE_BUSINESS_ID]
|
||||
payload.sourcePageName = it[PageSwitchDataHelper.PAGE_BUSINESS_NAME]
|
||||
}
|
||||
}
|
||||
|
||||
game.exposureEvent = exposureEvent
|
||||
|
||||
if (game.adGroupId.isNotEmpty() && !game.isAdRequestReported) {
|
||||
AdHelper.reportAdRequest(exposureEvent)
|
||||
game.isAdRequestReported = true
|
||||
}
|
||||
}
|
||||
exposureList.add(exposureEvent)
|
||||
|
||||
game.exposureEvent = exposureEvent
|
||||
}
|
||||
mEntityList[position].exposureEventList = exposureList
|
||||
|
||||
holder.bindSubject(subject.link.data, mEntityList[position].position)
|
||||
}
|
||||
@ -265,10 +269,6 @@ class SpecialCatalogAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEventByPosition(pos: Int): ExposureEvent? = mExposureEventSparseArray.get(pos)
|
||||
|
||||
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? = mEntityList[pos].exposureEventList
|
||||
|
||||
inner class CatalogBannerItemHolder(val binding: CatalogBannerItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
|
||||
@ -393,7 +393,14 @@ class SpecialCatalogAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
inner class CatalogImageItemHolder(val binding: CatalogImageItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
|
||||
inner class CatalogImageItemHolder(val binding: CatalogImageItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root), IExposureProvider {
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
inner class CatalogHeaderItemHolder(val binding: CatalogHeaderItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
|
||||
@ -3,14 +3,15 @@ package com.gh.gamecenter.catalog
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.ethanhua.skeleton.Skeleton
|
||||
import com.gh.common.exposure.DefaultExposureStateChangeListener
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.baselist.ListFragment
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.FragmentListBaseSkeletonBinding
|
||||
import com.gh.gamecenter.feature.exposure.addExposureHelper
|
||||
|
||||
class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatalogViewModel>() {
|
||||
|
||||
@ -21,8 +22,6 @@ class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatal
|
||||
private var mAdapter: SpecialCatalogAdapter? = null
|
||||
private var mLastPageDataMap: HashMap<String, String>? = null
|
||||
|
||||
private lateinit var mExposureListener: ExposureListener
|
||||
|
||||
override fun getLayoutId() = 0
|
||||
|
||||
override fun getInflatedLayout() = mBinding.root
|
||||
@ -43,7 +42,6 @@ class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatal
|
||||
mLastPageDataMap
|
||||
).apply {
|
||||
mAdapter = this
|
||||
mExposureListener = ExposureListener(this@SpecialCatalogFragment, this)
|
||||
}
|
||||
|
||||
override fun getItemDecoration() = null
|
||||
@ -51,7 +49,6 @@ class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatal
|
||||
override fun isAutomaticLoad(): Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
mIsCategoryV2 = arguments?.getBoolean(EntranceConsts.KEY_IS_CATEGORY_V2) ?: false
|
||||
mCatalogId = arguments?.getString(EntranceConsts.KEY_CATALOG_ID) ?: ""
|
||||
mCatalogTitle = arguments?.getString(EntranceConsts.KEY_CATALOG_TITLE) ?: ""
|
||||
@ -65,6 +62,8 @@ class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatal
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
mListRv.addExposureHelper(this, DefaultExposureStateChangeListener())
|
||||
|
||||
val skeletonLayoutId =
|
||||
if (mIsCategoryV2) R.layout.fragment_special_catalog_second_skeleton else R.layout.fragment_special_catalog_first_skeleton
|
||||
mSkeletonScreen = Skeleton.bind(mBinding.listSkeleton)
|
||||
@ -77,8 +76,6 @@ class SpecialCatalogFragment : ListFragment<SpecialCatalogItemData, SpecialCatal
|
||||
.load(skeletonLayoutId)
|
||||
.show()
|
||||
onLoadRefresh()
|
||||
|
||||
mListRv.addOnScrollListener(mExposureListener)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.gamecenter.catalog
|
||||
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.entity.SpecialCatalogEntity
|
||||
|
||||
class SpecialCatalogItemData(
|
||||
@ -11,5 +10,4 @@ class SpecialCatalogItemData(
|
||||
val subjectCollection: SpecialCatalogEntity? = null,
|
||||
|
||||
var position: Int = 0,
|
||||
var exposureEventList: ArrayList<ExposureEvent>? = null
|
||||
)
|
||||
|
||||
@ -9,6 +9,8 @@ import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.CatalogSubjectGameItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
class SpecialCatalogSubjectAdapter(
|
||||
@ -41,6 +43,8 @@ class SpecialCatalogSubjectAdapter(
|
||||
}
|
||||
|
||||
val entity = mList[position]
|
||||
|
||||
holder.bindGameEntity(entity)
|
||||
gameIcon.displayGameIcon(entity)
|
||||
gameName.text = entity.name
|
||||
gameName.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(mContext))
|
||||
@ -84,5 +88,15 @@ class SpecialCatalogSubjectAdapter(
|
||||
}
|
||||
|
||||
class CatalogSubjectGameItemViewHolder(val binding: CatalogSubjectGameItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
BaseRecyclerViewHolder<Any>(binding.root), IExposureProvider {
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
fun bindGameEntity(gameEntity: GameEntity) {
|
||||
boundedGameEntity = gameEntity
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,6 @@ class SpecialCatalogSubjectCollectionAdapter(
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
|
||||
CatalogSubjectCollectionListItemViewHolder(parent.toBinding())
|
||||
|
||||
|
||||
override fun onBindViewHolder(holder: CatalogSubjectCollectionListItemViewHolder, position: Int) {
|
||||
holder.binding.run {
|
||||
root.layoutParams = (root.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
|
||||
@ -9,6 +9,7 @@ import com.gh.gamecenter.common.baselist.ListViewModel
|
||||
import com.gh.gamecenter.common.entity.ExposureEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.entity.SpecialCatalogEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
@ -60,6 +61,8 @@ class SpecialCatalogViewModel(
|
||||
game.containerType =
|
||||
if (mIsCategoryV2) ExposureEntity.CATEGORY_V2_ID else ExposureEntity.CATEGORY_ID
|
||||
game.containerId = mCatalogId
|
||||
game.subPageCode = ExposureConstants.CATEGORY_V2
|
||||
game.subPageId = mCatalogId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,11 @@ class CategoryV2Activity : DownloadToolbarActivity() {
|
||||
|
||||
override fun isAutoResetViewBackgroundEnabled() = true
|
||||
|
||||
override fun getBusinessId(): Pair<String, String> {
|
||||
val categoryId = intent.extras?.getString(EntranceConsts.KEY_CATEGORY_ID, "") ?: ""
|
||||
return Pair(categoryId, "")
|
||||
}
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||
|
||||
@ -290,7 +290,6 @@ class CategoryV2Fragment : LazyFragment() {
|
||||
mEntity?.run {
|
||||
viewModel.run {
|
||||
clearSelectedTag()
|
||||
childFragmentManager.fragments.find { it.isAdded }
|
||||
val targetFragment =
|
||||
if (hasSpecial && position == 1) {
|
||||
val fragment = childFragmentManager.findFragmentByTag(SpecialCatalogFragment::class.java.name)
|
||||
@ -319,7 +318,6 @@ class CategoryV2Fragment : LazyFragment() {
|
||||
)
|
||||
fragment
|
||||
}
|
||||
|
||||
childFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.gamesContainer, targetFragment, targetFragment::class.java.name)
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
package com.gh.gamecenter.category2
|
||||
|
||||
import android.content.Context
|
||||
import android.util.SparseArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.databind.BindingAdapters
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.common.util.DownloadItemUtils
|
||||
import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
@ -17,6 +16,7 @@ import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.DrawableView
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
|
||||
import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.databinding.CategoryGameItemBinding
|
||||
@ -24,6 +24,7 @@ import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import org.json.JSONException
|
||||
@ -35,9 +36,7 @@ class CategoryV2ListAdapter(
|
||||
private val mCategoryViewModel: CategoryV2ViewModel,
|
||||
private val mEntrance: String?,
|
||||
private var mLastPageDataMap: HashMap<String, String>? = null
|
||||
) : ListAdapter<GameEntity>(context), IExposable {
|
||||
|
||||
private val mExposureEventSparseArray: SparseArray<ExposureEvent> = SparseArray()
|
||||
) : ListAdapter<GameEntity>(context) {
|
||||
|
||||
val positionAndPackageMap = HashMap<String, Int>()
|
||||
|
||||
@ -125,7 +124,13 @@ class CategoryV2ListAdapter(
|
||||
payload.sourcePageName = it[PageSwitchDataHelper.PAGE_BUSINESS_NAME]
|
||||
}
|
||||
}
|
||||
mExposureEventSparseArray.put(position, event)
|
||||
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
if (gameEntity.adGroupId.isNotEmpty() && !gameEntity.isAdRequestReported) {
|
||||
AdHelper.reportAdRequest(event)
|
||||
gameEntity.isAdRequestReported = true
|
||||
}
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
@ -231,17 +236,13 @@ class CategoryV2ListAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEventByPosition(pos: Int): ExposureEvent? {
|
||||
return mExposureEventSparseArray.get(pos)
|
||||
}
|
||||
|
||||
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
|
||||
return null
|
||||
}
|
||||
|
||||
inner class CategoryGameItemViewHolder(val binding: CategoryGameItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
BaseRecyclerViewHolder<Any>(binding.root), IExposureProvider {
|
||||
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
fun bindGameItem(gameEntity: GameEntity) {
|
||||
boundedGameEntity = gameEntity
|
||||
binding.run {
|
||||
gameIconView.displayGameIcon(gameEntity)
|
||||
gameRating.textSize = if (gameEntity.commentCount > 3) 12F else 10F
|
||||
@ -294,6 +295,10 @@ class CategoryV2ListAdapter(
|
||||
// 由于RecyclerView的复用机制 需要每次测量gameName的宽
|
||||
binding.gameName.requestLayout()
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
inner class CategoryGameViewHolder(val binding: CategoryGameItemBinding) : GameViewHolder(binding.root) {
|
||||
|
||||
@ -6,7 +6,7 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.ethanhua.skeleton.Skeleton
|
||||
import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.common.exposure.DefaultExposureStateChangeListener
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.view.CategoryFilterView
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
@ -24,6 +24,8 @@ import com.gh.gamecenter.databinding.FragmentCategoryListBinding
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.exposure.addExposureHelper
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -113,7 +115,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
onRefresh()
|
||||
}
|
||||
|
||||
mListRv.addOnScrollListener(ExposureListener(this, provideListAdapter()))
|
||||
mListRv.addExposureHelper(this, DefaultExposureStateChangeListener())
|
||||
|
||||
mSkeletonScreen = Skeleton.bind(mBinding?.listSkeleton)
|
||||
.shimmer(true)
|
||||
|
||||
@ -5,12 +5,14 @@ import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.common.view.CategoryFilterView
|
||||
import com.gh.gamecenter.common.baselist.ListViewModel
|
||||
import com.gh.gamecenter.common.entity.ExposureEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
@ -33,7 +35,7 @@ class CategoryV2ListViewModel(
|
||||
return RetrofitManager
|
||||
.getInstance()
|
||||
.api
|
||||
.getCategoryV2Games(categoryId, getFilter(), getSortType(), page)
|
||||
.getCategoryV2Games(categoryId, getFilter(), getSortType(), AdHelper.getIdfaString(), page)
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
@ -43,7 +45,11 @@ class CategoryV2ListViewModel(
|
||||
containerId = categoryId,
|
||||
containerType = ExposureEntity.CATEGORY_V2_ID
|
||||
)
|
||||
it.forEach { game -> game.hideSizeInsideDes = true }
|
||||
it.forEach { game ->
|
||||
game.hideSizeInsideDes = true
|
||||
game.subPageCode = ExposureConstants.CATEGORY_V2
|
||||
game.subPageId = categoryId
|
||||
}
|
||||
mResultLiveData.postValue(it)
|
||||
}
|
||||
}
|
||||
@ -62,7 +68,6 @@ class CategoryV2ListViewModel(
|
||||
"min_size", gameFiltered.size.min.toString(),
|
||||
"max_size", gameFiltered.size.max.toString()
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private fun getSortType(): String? {
|
||||
|
||||
@ -166,7 +166,7 @@ class CategoryV2ViewModel : ViewModel() {
|
||||
if (position != oldPosition) {
|
||||
_selectedSidebarsPosition.value = position
|
||||
// 如果是点击搜索而被动切换到 “全部” tab,则这里不需要更新筛选条件
|
||||
if (triggerSearch && position != 1) {
|
||||
if (triggerSearch && position != INVALID_POSITION) {
|
||||
updateGameFiltered()
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,8 +33,10 @@ import com.gh.gamecenter.discovery.interestedgame.InterestedGameActivity
|
||||
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
@ -137,6 +139,7 @@ class DiscoveryAdapter(
|
||||
if (mOuterSequence >= 0) {
|
||||
outerSequence = mOuterSequence
|
||||
}
|
||||
subPageCode = ExposureConstants.DISCOVERY
|
||||
},
|
||||
mBaseExposureSource,
|
||||
exposureSources,
|
||||
@ -346,7 +349,9 @@ class DiscoveryAdapter(
|
||||
return null
|
||||
}
|
||||
|
||||
class DiscoveryGameViewHolder(val binding: DiscoveryGameItemBinding) : GameViewHolder(binding.root) {
|
||||
class DiscoveryGameViewHolder(val binding: DiscoveryGameItemBinding) : GameViewHolder(binding.root), IExposureProvider {
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
init {
|
||||
gameDownloadBtn = binding.downloadBtn
|
||||
gameDes = binding.gameDes
|
||||
@ -358,6 +363,7 @@ class DiscoveryAdapter(
|
||||
}
|
||||
|
||||
fun bindGameItem(gameEntity: GameEntity) {
|
||||
boundedGameEntity = gameEntity
|
||||
binding.run {
|
||||
root.background = com.gh.gamecenter.common.R.drawable.reuse_listview_item_style.toDrawable(root.context)
|
||||
gameKaifuType.setBackgroundColor(com.gh.gamecenter.common.R.color.primary_theme.toColor(root.context))
|
||||
@ -415,8 +421,11 @@ class DiscoveryAdapter(
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
class RecommendInterestViewHolder(val binding: ItemRecommendInterestBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
|
||||
@ -9,7 +9,7 @@ import io.reactivex.Single
|
||||
|
||||
class GameSubjectDSPRemoteDataSource(private val api: DspApiService = RetrofitManager.getInstance().dspApiService) {
|
||||
|
||||
fun getDspGames(type: String, count: Int): Single<List<GameEntity>> {
|
||||
fun getDspGames(count: Int): Single<List<GameEntity>> {
|
||||
val meta = MetaUtil.getMeta()
|
||||
val request = mapOf(
|
||||
"device" to mapOf(
|
||||
|
||||
@ -4,6 +4,7 @@ import android.os.Parcelable
|
||||
import com.gh.gamecenter.common.entity.IconFloat
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
@ -42,12 +43,16 @@ data class AmwayCommentEntity(
|
||||
// 曝光用的位置
|
||||
var sequence: Int = 0,
|
||||
var outerSequence: Int = 0
|
||||
|
||||
) : Parcelable {
|
||||
|
||||
@IgnoredOnParcel
|
||||
val name: String?
|
||||
get() = mName.removeSuffix(".")
|
||||
|
||||
@IgnoredOnParcel
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
fun toGameEntity(): GameEntity {
|
||||
val gameEntity = GameEntity()
|
||||
gameEntity.id = id
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.servers.gametest2.GameServerTestV2ViewModel
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class GameServerTestDisplaySetting(
|
||||
@SerializedName("time_text_past")
|
||||
val timeTextPast: String = RECENT,
|
||||
@SerializedName("time_text_present")
|
||||
val timeTextPresent: String = TODAY,
|
||||
@SerializedName("time_text_future")
|
||||
val timeTextFuture: String = FUTURE,
|
||||
@SerializedName("game_category")
|
||||
val gameCategory: List<String> = listOf(
|
||||
GameServerTestV2ViewModel.GameCategory.Local.value,
|
||||
GameServerTestV2ViewModel.GameCategory.Online.value,
|
||||
GameServerTestV2ViewModel.GameCategory.Welfare.value,
|
||||
GameServerTestV2ViewModel.GameCategory.Gjonline.value
|
||||
),
|
||||
) {
|
||||
companion object {
|
||||
const val RECENT = "近期"
|
||||
const val TODAY = "今天"
|
||||
const val FUTURE = "预约"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class SearchGameUnionEntity(
|
||||
@SerializedName("type")
|
||||
private val _type: String? = null,
|
||||
@SerializedName("link_game")
|
||||
val linkGame: GameEntity? = null,
|
||||
@SerializedName("link_wechat_game_cpm_column")
|
||||
val linkWechatGameCpmColumn: SearchSubjectEntity? = null,
|
||||
@SerializedName("link_dsp_game_column")
|
||||
val linkDspGameColumn: SearchSubjectEntity? = null,
|
||||
@SerializedName("link_wechat_game")
|
||||
val linkWechatGame: GameEntity? = null,
|
||||
@SerializedName("link_column")
|
||||
val linkColum: SearchSubjectEntity? = null,
|
||||
@SerializedName("link_ad_space")
|
||||
val linkAdSpace: AdConfig? = null
|
||||
) {
|
||||
val type: String
|
||||
get() = _type ?: ""
|
||||
|
||||
companion object {
|
||||
const val TYPE_GAME = "game"
|
||||
const val TYPE_WECHAT_GAME_CPM_COLUMN = "wechat_game_cpm_column"
|
||||
const val TYPE_DSP_GAME_COLUMN = "dsp_game_column"
|
||||
const val TYPE_WECHAT_GAME = "wechat_game"
|
||||
const val TYPE_COLUMN = "column"
|
||||
const val TYPE_AD_SPACE = "ad_space"
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,9 @@ package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.gamecenter.entity.SearchGameUnionEntity.Companion.TYPE_DSP_GAME_COLUMN
|
||||
import com.gh.gamecenter.entity.SearchGameUnionEntity.Companion.TYPE_WECHAT_GAME_CPM_COLUMN
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.personalhome.home.UserHistoryViewModel
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@ -18,10 +19,6 @@ data class SearchSubjectEntity(
|
||||
val codeId: String = "", // 广告CODE_ID(本地字段),不为空时为广告专题
|
||||
@SerializedName("ad_icon_active")
|
||||
val adIconActive: Boolean = false,
|
||||
// 本地字段,标记是否为微信小游戏CPM专题
|
||||
var isWGameSubjectCPM: Boolean = false,
|
||||
// 本地字段,标记是否为DSP专题
|
||||
var isDspSubject: Boolean = false,
|
||||
val type: String = "",
|
||||
|
||||
@SerializedName("column_type")
|
||||
@ -31,10 +28,11 @@ data class SearchSubjectEntity(
|
||||
val size: Int = -1, // 专题游戏数量
|
||||
) : Parcelable {
|
||||
|
||||
companion object {
|
||||
const val TYPE_WECHAT_GAME_CPM_COLUMN = "wechat_game_cpm_column"
|
||||
const val TYPE_DSP_GAME_COLUMN = "dsp_game_column"
|
||||
}
|
||||
val isWGameSubjectCPM: Boolean
|
||||
get() = type == TYPE_WECHAT_GAME_CPM_COLUMN
|
||||
|
||||
val isDspSubject: Boolean
|
||||
get() = type == TYPE_DSP_GAME_COLUMN
|
||||
|
||||
fun getFilterGame() = RegionSettingHelper.filterGame(games)
|
||||
}
|
||||
@ -122,7 +122,9 @@ data class SubjectEntity(
|
||||
@SerializedName("column_type")
|
||||
private val _columnType: String? = null,
|
||||
@SerializedName("size")
|
||||
private val _size: Size? = null
|
||||
private val _size: Size? = null,
|
||||
@SerializedName("onlyFee")
|
||||
private val _onlyFee: Boolean? = false,
|
||||
) : Parcelable {
|
||||
|
||||
@IgnoredOnParcel
|
||||
@ -161,6 +163,9 @@ data class SubjectEntity(
|
||||
val size: Size
|
||||
get() = _size ?: Size()
|
||||
|
||||
val onlyFee: Boolean
|
||||
get() = _onlyFee ?: false
|
||||
|
||||
var isDspSubject: Boolean = false
|
||||
|
||||
companion object {
|
||||
@ -173,9 +178,13 @@ data class SubjectEntity(
|
||||
@Parcelize
|
||||
data class Size(
|
||||
@SerializedName("index")
|
||||
private val _index: Int? = null
|
||||
private val _index: Int? = null,
|
||||
@SerializedName("limit")
|
||||
private val _limit: Int? = null,
|
||||
) : Parcelable {
|
||||
val index: Int
|
||||
get() = _index ?: 0
|
||||
val limit: Int
|
||||
get() = _limit ?: -1
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,6 @@ class FollowCommonCollectionViewHolder(
|
||||
override fun addExposureEvent(childPosition: Int, link: ExposureLinkEntity) = Unit
|
||||
|
||||
override fun onChildItemClick(childPosition: Int, entity: CommonCollectionContentEntity) {
|
||||
|
||||
val linkEntity = entity.linkEntity
|
||||
|
||||
NewLogUtils.logCommonCollectionClick(
|
||||
|
||||
@ -50,9 +50,6 @@ class FollowHomeSlideListViewHolder(
|
||||
}
|
||||
|
||||
override fun updateImmersiveColor(color: Int) = Unit
|
||||
|
||||
override fun createExposureEvent(childPosition: Int, game: GameEntity?): ExposureEvent? = null
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -29,15 +29,12 @@ class FollowHomeSlideWithCardsViewHolder(
|
||||
useCase,
|
||||
lifecycleOwner,
|
||||
binding,
|
||||
0,
|
||||
null,
|
||||
"",
|
||||
object : CommonContentHomeSlideWithCardsUi.HomeSLideWithCardsEventListener {
|
||||
override fun updateImmersiveColor(color: Int) = Unit
|
||||
|
||||
override fun createEventWithSourceConcat(game: GameEntity, subSlideId: String) = Unit
|
||||
|
||||
override fun createExposureEvent(actualPosition: Int, game: GameEntity?): ExposureEvent? = null
|
||||
|
||||
override fun addGameExposureEvent(position: Int, game: GameEntity, subSlideId: String) = Unit
|
||||
|
||||
override fun navigateToGameDetailPage(
|
||||
childPosition: Int,
|
||||
gameEntity: GameEntity,
|
||||
|
||||
@ -399,7 +399,8 @@ class GameFragmentAdapter(
|
||||
position = prefixedPosition,
|
||||
gameColumnName = gameEntity.name ?: "",
|
||||
gameColumnId = gameEntity.link ?: "",
|
||||
text = "游戏专题"
|
||||
text = "游戏专题",
|
||||
adGroupId = gameEntity.adGroupId
|
||||
)
|
||||
}
|
||||
|
||||
@ -574,7 +575,7 @@ class GameFragmentAdapter(
|
||||
position = sequence,
|
||||
gameColumnName = subject.name ?: "",
|
||||
gameColumnId = subject.id ?: "",
|
||||
text = "游戏专题"
|
||||
text = "游戏专题",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,8 @@ import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
|
||||
import com.gh.gamecenter.databinding.GameColumnCollectionItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
|
||||
class ColumnCollectionDetailAdapter(
|
||||
@ -95,8 +97,13 @@ class ColumnCollectionDetailAdapter(
|
||||
text = "游戏专题"
|
||||
)
|
||||
}
|
||||
|
||||
val fakeGameEntity = GameEntity(_id = ExposureConstants.COLUMN_COLLECTION_DETAIL)
|
||||
fakeGameEntity.subPageCode = ExposureConstants.COLUMN_COLLECTION_DETAIL
|
||||
fakeGameEntity.subPageId = mViewModel.collectionId
|
||||
|
||||
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
|
||||
null,
|
||||
fakeGameEntity,
|
||||
mBasicExposureSourceList ?: arrayListOf(),
|
||||
arrayListOf(
|
||||
ExposureSource("合集详情", ""),
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.game.data.CommonContentCollectionDetailItem
|
||||
import com.gh.gamecenter.game.data.CommonContentCollectionDetailRecommendCardItem
|
||||
@ -142,6 +143,8 @@ class CustomCommonCollectionDetailAdapter(
|
||||
ExposureEvent.createEventWithSourceConcat(
|
||||
gameEntity.also {
|
||||
it.sequence = position
|
||||
it.subPageCode = ExposureConstants.CUSTOM_COMMON_COLLECTION_DETAIL
|
||||
it.subPageId = commonCollectionEntity?.id ?: ""
|
||||
},
|
||||
basicSource = mBasicExposureSourceList ?: listOf(),
|
||||
listOf(
|
||||
|
||||
@ -18,6 +18,8 @@ import com.gh.gamecenter.gamedetail.detail.viewholder.BaseGameDetailItemViewHold
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.subjectTypeToComponentStyle
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import kotlin.collections.forEachIndexed
|
||||
import kotlin.collections.isNotEmpty
|
||||
|
||||
class GameHorizontalAdapter(
|
||||
context: Context,
|
||||
@ -136,7 +138,8 @@ class GameHorizontalAdapter(
|
||||
gameColumnName = subjectEntity.name ?: "",
|
||||
gameColumnId = subjectEntity.id ?: "",
|
||||
text = "游戏",
|
||||
columnPattern = subjectTypeToComponentStyle[subjectEntity.type] ?: ""
|
||||
columnPattern = subjectTypeToComponentStyle[subjectEntity.type] ?: "",
|
||||
adGroupId = gameEntity.adGroupId,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,9 +6,22 @@ import android.widget.TextView
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.databinding.GameHorizontalSimpleItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
|
||||
class GameHorizontalSimpleItemViewHolder(val binding: GameHorizontalSimpleItemBinding) :
|
||||
BaseRecyclerViewHolder<GameEntity>(binding.root) {
|
||||
BaseRecyclerViewHolder<GameEntity>(binding.root), IExposureProvider {
|
||||
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
fun bindData(game: GameEntity) {
|
||||
boundedGameEntity = game
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun setHorizontalNameAndGravity(view: TextView, name: String?) {
|
||||
|
||||
@ -26,8 +26,9 @@ class HotGameListViewModel(
|
||||
subjectData.subjectId,
|
||||
subjectData.sort,
|
||||
subjectData.filter.ifEmpty { "type:全部" },
|
||||
page
|
||||
)
|
||||
"",
|
||||
"",
|
||||
page)
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
|
||||
@ -30,6 +30,7 @@ import com.gh.gamecenter.entity.GamesCollectionDetailEntity
|
||||
import com.gh.gamecenter.eventbus.EBUserFollow
|
||||
import com.gh.gamecenter.feature.entity.CommentEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.qa.article.detail.CommentItemData
|
||||
import com.gh.gamecenter.qa.comment.base.BaseCommentViewModel
|
||||
@ -136,6 +137,9 @@ open class GameCollectionDetailViewModel(
|
||||
|
||||
games?.forEach {
|
||||
it.isAdData = adIconActive
|
||||
it.subPageCode = ExposureConstants.GAME_COLLECTION_DETAIL
|
||||
it.subPageId = gameCollectionId
|
||||
|
||||
add(CommentItemData(game = it))
|
||||
gameList?.add(it)
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import com.gh.gamecenter.entity.RecommendPopupEntity
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.entity.UnifiedUserTrendEntity
|
||||
import com.gh.gamecenter.feature.entity.*
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.feature.utils.ConcernUtils
|
||||
import com.gh.gamecenter.feature.utils.ContentBlockedHelper
|
||||
@ -190,6 +191,7 @@ class GameDetailViewModel(
|
||||
.subscribe(object : Response<GameEntity>() {
|
||||
override fun onResponse(response: GameEntity?) {
|
||||
game = response
|
||||
game?.subPageCode = ExposureConstants.GAME_DETAIL
|
||||
gameLiveData.postValue(Resource.success(game))
|
||||
loadGameDetailData()
|
||||
}
|
||||
@ -557,6 +559,9 @@ class GameDetailViewModel(
|
||||
detailDataList.find { it.linkEveryonePlaying != null }?.let {
|
||||
if (relatedGameList.isNotEmpty()) {
|
||||
relatedGameList.shuffle()
|
||||
relatedGameList.forEach { game ->
|
||||
game.subPageCode = ExposureConstants.GAME_DETAIL
|
||||
}
|
||||
val recommendedGames = SubjectEntity().apply { data = relatedGameList }
|
||||
it.linkEveryonePlaying?.recommendedGames = recommendedGames
|
||||
} else {
|
||||
|
||||
@ -14,6 +14,7 @@ import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.menu.ActionMenuItemView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.doOnNextLayout
|
||||
import androidx.core.view.isVisible
|
||||
@ -96,6 +97,7 @@ import io.reactivex.disposables.Disposable
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import retrofit2.HttpException
|
||||
import splitties.views.horizontalPadding
|
||||
import java.util.*
|
||||
|
||||
class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
@ -286,7 +288,7 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
initSkeleton()
|
||||
|
||||
binding.reuseNoneData.reuseNoneDataTv.text = "页面不见了"
|
||||
bodyBinding.tabIndicator.setIndicatorWidth(12)
|
||||
bodyBinding.tabIndicator.setIndicatorWidth(16)
|
||||
bodyBinding.viewPager.offscreenPageLimit = 4
|
||||
binding.expandSpecialDownloadIv.enlargeTouchArea()
|
||||
|
||||
@ -357,8 +359,14 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
}
|
||||
backBtn.setOnClickListener { requireActivity().finish() }
|
||||
moreMenuItem = actionMenuView.menu.findItem(R.id.menu_more)
|
||||
downloadMenuItem = actionMenuView.menu.findItem(R.id.menu_download)
|
||||
downloadMenuItem = actionMenuView.menu.findItem(R.id.menu_download)?.apply {
|
||||
actionView?.updateLayoutParams<LayoutParams> { width = 40F.dip2px() }
|
||||
}
|
||||
downloadMenuItem?.isVisible = Config.isShow()
|
||||
actionMenuView.findViewById<ActionMenuItemView>(R.id.menu_more)?.run {
|
||||
updateLayoutParams<LayoutParams> { width = 40F.dip2px() }
|
||||
horizontalPadding = 8F.dip2px()
|
||||
}
|
||||
}
|
||||
|
||||
downloadMenuIcon = downloadMenuItem?.actionView?.findViewById(R.id.menu_download_iv)
|
||||
@ -467,6 +475,10 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
gameEntity?.gameBitChinese ?: "",
|
||||
"download_type",
|
||||
gameEntity?.downloadType ?: "",
|
||||
"is_ad",
|
||||
traceEvent?.payload?.isAd ?: false,
|
||||
"ad_group_id",
|
||||
traceEvent?.payload?.adGroupId ?: "",
|
||||
*(traceEvent?.additional ?: emptyArray())
|
||||
)
|
||||
}, 120)
|
||||
@ -803,7 +815,10 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
downloadStatus = gameEntity?.downloadStatusChinese ?: "",
|
||||
gameType = gameEntity?.categoryChinese ?: "",
|
||||
position = position,
|
||||
tabContent = tabEntity.name
|
||||
tabContent = tabEntity.name,
|
||||
linkType = tabEntity.link?.type ?: "",
|
||||
linkId = tabEntity.link?.link ?: "",
|
||||
linkText = tabEntity.link?.text ?: ""
|
||||
)
|
||||
|
||||
val entrance = if (mEntrance.contains("论坛详情")) "论坛" else "游戏"
|
||||
@ -906,7 +921,7 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
tab.customView = tabItemBinding.root
|
||||
updateTabStyle(tab, i == bodyBinding.viewPager.currentItem)
|
||||
tab.view.clipChildren = false
|
||||
tab.view.setPadding(0, 0, 0, 0)
|
||||
tab.view.setPadding(0, 0, if (i == tabEntityList.size - 1) 8F.dip2px() else 0, 0)
|
||||
tab.view.setOnTouchListener { _, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
handleTabTouchEvent(tabEntity?.name ?: "")
|
||||
@ -933,7 +948,7 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
tab.customView?.findViewById<TextView>(R.id.tab_title)
|
||||
?.setTypeface(if (isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT)
|
||||
tab.customView?.findViewById<TextView>(R.id.tab_title)?.setTextColor(
|
||||
if (isChecked) com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()) else com.gh.gamecenter.common.R.color.text_tertiary.toColor(
|
||||
if (isChecked) com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()) else com.gh.gamecenter.common.R.color.text_secondary.toColor(
|
||||
requireContext()
|
||||
)
|
||||
)
|
||||
|
||||
@ -922,8 +922,10 @@ class GameDetailFragment : LazyFragment(), IScrollable {
|
||||
}
|
||||
|
||||
override fun scrollToTop() {
|
||||
binding.gamedetailAppbar.setExpanded(true)
|
||||
binding.detailRv.scrollToPosition(0)
|
||||
if (::binding.isInitialized) {
|
||||
binding.gamedetailAppbar.setExpanded(true)
|
||||
binding.detailRv.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
|
||||
// 登录事件/礼包状态变更事件
|
||||
|
||||
@ -20,6 +20,8 @@ import com.gh.gamecenter.game.horizontal.GameHorizontalListType
|
||||
import com.gh.gamecenter.gamedetail.GameDetailViewModel
|
||||
import com.gh.gamecenter.gamedetail.entity.GameDetailData
|
||||
import com.gh.gamecenter.gamedetail.entity.GameDetailRecommendColumn
|
||||
import kotlin.collections.firstOrNull
|
||||
import kotlin.collections.withIndex
|
||||
|
||||
class GameDetailRecommendColumnItemViewHolder(
|
||||
val binding: ItemGameDetailRecyclerViewBinding,
|
||||
@ -73,7 +75,8 @@ class GameDetailRecommendColumnItemViewHolder(
|
||||
linkType = columnData.display?.moreLink?.type ?: "",
|
||||
linkId = columnData.display?.moreLink?.link ?: "",
|
||||
text = "右上角",
|
||||
buttonType = columnData.display?.home ?: ""
|
||||
buttonType = columnData.display?.home ?: "",
|
||||
adGroupId = viewModel.game?.adGroupId ?: ""
|
||||
)
|
||||
|
||||
when (columnData.display?.home) {
|
||||
|
||||
@ -360,7 +360,8 @@ class LegacyHomeFragmentAdapterAssistant(
|
||||
position = prefixedPosition,
|
||||
gameColumnName = gameEntity.name ?: "",
|
||||
gameColumnId = gameEntity.link ?: "",
|
||||
text = "游戏专题"
|
||||
text = "游戏专题",
|
||||
adGroupId = gameEntity.adGroupId
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.gh.gamecenter.home.custom
|
||||
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.custom.model.CustomSubjectCollectionItem
|
||||
|
||||
@ -18,6 +20,9 @@ fun createExposureEvent(
|
||||
game?.sequence = childPosition
|
||||
game?.outerSequence = position
|
||||
game?.customPageTrackData = customPageTrackData
|
||||
game?.pageLevelString = customPageTrackData.pageLocation.pageLevelString
|
||||
game?.subPageCode = ExposureConstants.CUSTOM_PAGE
|
||||
game?.subPageId = customPageTrackData.pageLocation.pageId
|
||||
val event = ExposureEvent.createEventWithSourceConcat(
|
||||
gameEntity = game,
|
||||
basicSource = base,
|
||||
@ -32,9 +37,7 @@ fun fillExposureInSubjectCollection(
|
||||
base: List<ExposureSource>,
|
||||
customPageTrackData: CustomPageTrackData
|
||||
) {
|
||||
|
||||
val eventList = arrayListOf<ExposureEvent>()
|
||||
runOnIoThread(true) {
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
item.data.data.forEachIndexed { index, customSubject ->
|
||||
val source = if (item.isSubjectCollection) {
|
||||
listOf(
|
||||
@ -51,8 +54,9 @@ fun fillExposureInSubjectCollection(
|
||||
)
|
||||
}
|
||||
customSubject.games.forEach { game ->
|
||||
game.pageLevelString = customPageTrackData.pageLocation.pageLevelString
|
||||
game.isAdData = customSubject.adIconActive
|
||||
val event = createExposureEvent(
|
||||
game.exposureEvent = createExposureEvent(
|
||||
game,
|
||||
source,
|
||||
base,
|
||||
@ -60,10 +64,15 @@ fun fillExposureInSubjectCollection(
|
||||
item.componentPosition,
|
||||
customPageTrackData
|
||||
)
|
||||
eventList.add(event)
|
||||
game.subPageCode = ExposureConstants.CUSTOM_PAGE
|
||||
game.subPageId = customPageTrackData.pageLocation.pageId
|
||||
game.exposureSource = game.exposureEvent?.source
|
||||
|
||||
if (game.adGroupId.isNotEmpty() && !game.isAdRequestReported) {
|
||||
AdHelper.reportAdRequest(game.exposureEvent!!)
|
||||
game.isAdRequestReported = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
item.exposureEventList = eventList
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.common.exposure.DefaultExposureStateChangeListener
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.iinterface.ISearchToolbarTab
|
||||
import com.gh.common.iinterface.ISmartRefresh
|
||||
@ -41,6 +41,7 @@ import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.tracker.IBusiness
|
||||
import com.gh.gamecenter.common.pagelevel.IPageLevelProvider
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.ScrollableLinearLayoutManager
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
@ -59,6 +60,7 @@ import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PageLocation
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.exposure.addExposureHelper
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.feature.utils.SentryHelper
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailActivity
|
||||
@ -88,7 +90,11 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
private var searchToolbarTabWrapperViewModel: SearchToolbarTabWrapperViewModel? = null
|
||||
private var mainWrapperViewModel: MainWrapperViewModel? = null
|
||||
|
||||
private val viewModel by viewModels<CustomPageViewModel>()
|
||||
private val viewModel by viewModels<CustomPageViewModel>(
|
||||
factoryProducer = {
|
||||
CustomPageViewModel.Factory(com.gh.gamecenter.login.HaloApp.getInstance())
|
||||
}
|
||||
)
|
||||
|
||||
private lateinit var binding: FragmentCustomBinding
|
||||
|
||||
@ -111,6 +117,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
private var customPageName = ""
|
||||
private var bottomTabId = ""
|
||||
private var bottomTabName = ""
|
||||
private var bottomTabIndex = -1
|
||||
private var tabIndex = -1
|
||||
private var showFloatingWindow = true
|
||||
private var showPullDownPush = true
|
||||
@ -144,6 +151,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
customPageName = arguments?.getString(EntranceConsts.KEY_CUSTOM_PAGE_NAME, "") ?: ""
|
||||
bottomTabId = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_ID, "") ?: ""
|
||||
bottomTabName = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_NAME, "") ?: ""
|
||||
bottomTabIndex = arguments?.getInt(EntranceConsts.KEY_BOTTOM_TAB_INDEX, -1) ?: -1
|
||||
tabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX, -1) ?: -1
|
||||
showFloatingWindow = arguments?.getBoolean(EntranceConsts.KEY_SHOW_FLOATING_WINDOW, true) ?: true
|
||||
showPullDownPush = arguments?.getBoolean(EntranceConsts.KEY_SHOW_PULL_DOWN_PUSH, true) ?: true
|
||||
@ -182,8 +190,17 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
exposureSourceList,
|
||||
isInSearchToolbarTabWrapperPage
|
||||
)
|
||||
|
||||
val precisePageLevelString = (activity as? IPageLevelProvider)
|
||||
?.getPageLevel()
|
||||
?.getTempNewPageLevel(topTabPosition = tabIndex, bottomTabPosition = bottomTabIndex)
|
||||
?.toFormattedString(ignoreBottomTabPositionMap = true)
|
||||
?: ""
|
||||
|
||||
pageLocation = PageLocation(
|
||||
bottomTabName,
|
||||
bottomTabIndex,
|
||||
precisePageLevelString,
|
||||
multiTabNavName,
|
||||
multiTabNavId,
|
||||
tabIndex,
|
||||
@ -230,7 +247,12 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
})
|
||||
|
||||
dataList.observe(viewLifecycleOwner) {
|
||||
adapter.submitList(it)
|
||||
adapter.submitList(it) {
|
||||
if (shouldScrollToTop) {
|
||||
shouldScrollToTop = false
|
||||
binding.gameList.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadStatus.observe(viewLifecycleOwner) { (status, isPullToRefresh) ->
|
||||
@ -352,7 +374,6 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
subjectDestination.observe(viewLifecycleOwner, EventObserver { subject ->
|
||||
@ -553,6 +574,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
binding.gameList.itemAnimator = null
|
||||
binding.gameList.layoutManager = layoutManager
|
||||
binding.gameList.adapter = adapter
|
||||
binding.gameList.addExposureHelper(this, DefaultExposureStateChangeListener())
|
||||
|
||||
var listScrollHeight = 0
|
||||
binding.gameList.addOnScrollListener(object : OnScrollListener() {
|
||||
@ -570,9 +592,6 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable, IB
|
||||
}
|
||||
})
|
||||
|
||||
val exposureListener = ExposureListener(this, adapter)
|
||||
binding.gameList.addOnScrollListener(exposureListener)
|
||||
|
||||
binding.gameRefresh.setOnRefreshListener {
|
||||
onRefresh()
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.gh.common.util.GameUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.NewLogUtils
|
||||
@ -31,10 +33,24 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
import com.gh.gamecenter.home.custom.GamePositionAndPackageHelper.Companion.putGameWithPosition
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OnCustomPageEventListener
|
||||
import com.gh.gamecenter.home.custom.model.*
|
||||
import com.gh.gamecenter.home.custom.model.CustomCommonContentCollectionItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomDspPlaceholderItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPKItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_COLLECTION_STYLE_REFRESH_ICONS_4_2
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMPONENTS_COLLECTION_STYLE_REFRESH_SLIDE_LIST
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageRepository
|
||||
import com.gh.gamecenter.home.custom.model.CustomPluginItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomRecentGamesItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomSplitCommonContentCollectionItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomSplitSubjectItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomSubjectCollectionItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomSubjectItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomWeChatMiniGamesCPMSubjectItem
|
||||
import com.gh.gamecenter.livedata.Event
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.gh.gamecenter.login.user.UserViewModel
|
||||
import com.gh.gamecenter.wrapper.SearchToolbarTabWrapperViewModel
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -44,9 +60,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
import retrofit2.HttpException
|
||||
import kotlin.collections.set
|
||||
|
||||
class CustomPageViewModel(
|
||||
application: Application
|
||||
) : AndroidViewModel(application), OnCustomPageEventListener {
|
||||
class CustomPageViewModel(application: Application) : AndroidViewModel(application), OnCustomPageEventListener {
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
@ -108,8 +122,6 @@ class CustomPageViewModel(
|
||||
*/
|
||||
private val cpmSubjectChangedPageMap: ArrayMap<String, Int> = ArrayMap()
|
||||
|
||||
var slideDiscoveryGamesPage = -1
|
||||
|
||||
private lateinit var _pageTracker: CustomPageTracker
|
||||
|
||||
val pageTracker: CustomPageTracker
|
||||
@ -120,10 +132,12 @@ class CustomPageViewModel(
|
||||
|
||||
val pkVoteResultLiveData = MutableLiveData<Event<Pair<String, Boolean>>>()
|
||||
|
||||
var shouldScrollToTop: Boolean = false
|
||||
|
||||
fun init(
|
||||
pageConfigure: PageConfigure,
|
||||
searchToolbarTabWrapperViewModel: SearchToolbarTabWrapperViewModel?,
|
||||
pageLocation: PageLocation
|
||||
pageLocation: PageLocation,
|
||||
) {
|
||||
this.searchToolbarTabWrapperViewModel = searchToolbarTabWrapperViewModel
|
||||
_pageConfigure = pageConfigure
|
||||
@ -397,7 +411,7 @@ class CustomPageViewModel(
|
||||
if (gameList != null) {// 直接读取缓存数据
|
||||
notifyWGameCPMABatchChanged(gameList, subjectId, page)
|
||||
} else {
|
||||
repository.loadChangeSubjectWGameCPM(page)
|
||||
repository.loadChangeSubjectWGameCPM(page, subjectEntity.size.limit, subjectEntity.onlyFee)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<List<GameEntity>>() {
|
||||
@ -459,7 +473,7 @@ class CustomPageViewModel(
|
||||
// 随机产生专题数据(换一换)
|
||||
private fun getRandomGameList(
|
||||
oldList: MutableList<GameEntity>?,
|
||||
sourceList: MutableList<GameEntity>
|
||||
sourceList: MutableList<GameEntity>,
|
||||
): MutableList<GameEntity> {
|
||||
val resultGameList = ArrayList<GameEntity>()
|
||||
val filterGameList = GameUtils.removeDuplicateData(oldList, sourceList)//排除重复
|
||||
@ -570,6 +584,11 @@ class CustomPageViewModel(
|
||||
subjectItem.data
|
||||
)
|
||||
if (customPageItemList.isEmpty()) return
|
||||
|
||||
if (index == 0) {
|
||||
shouldScrollToTop = true
|
||||
}
|
||||
|
||||
newData[index] = customPageItemList[0]
|
||||
newData.addAll(index + 1, customPageItemList.subList(1, customPageItemList.size))
|
||||
newData.forEachIndexed { pos, customPageItem ->
|
||||
@ -607,6 +626,10 @@ class CustomPageViewModel(
|
||||
subjectItem.data
|
||||
)
|
||||
if (customPageItemList.isEmpty()) return
|
||||
|
||||
if (index == 0) {
|
||||
shouldScrollToTop = true
|
||||
}
|
||||
newData[index] = customPageItemList[0]
|
||||
newData.addAll(index + 1, customPageItemList.subList(1, customPageItemList.size))
|
||||
newData.forEachIndexed { pos, customPageItem ->
|
||||
@ -701,7 +724,7 @@ class CustomPageViewModel(
|
||||
|
||||
private fun getPositionAndPackageMap(
|
||||
customPageItem: CustomPageItem,
|
||||
gameList: List<GameEntity>?
|
||||
gameList: List<GameEntity>?,
|
||||
): HashMap<String, Int> {
|
||||
val hashMap = hashMapOf<String, Int>()
|
||||
if (customPageItem.shouldShowDownloadButton) {
|
||||
@ -720,7 +743,7 @@ class CustomPageViewModel(
|
||||
item: CustomPageItem,
|
||||
childPosition: Int,
|
||||
game: GameEntity,
|
||||
text: String
|
||||
text: String,
|
||||
) {
|
||||
_gameDetailDestination.value = Event(Pair("", game))
|
||||
}
|
||||
@ -746,7 +769,7 @@ class CustomPageViewModel(
|
||||
|
||||
override fun navigateSubjectDetailPage(
|
||||
item: CustomSubjectCollectionItem,
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
) {
|
||||
_subjectDestinationWithCustom.value = Event(subject to item.data.subjectType)
|
||||
}
|
||||
@ -759,7 +782,7 @@ class CustomPageViewModel(
|
||||
override fun navigateSubjectCollectionPage(
|
||||
item: CustomSubjectCollectionItem,
|
||||
childPosition: Int,
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity?
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity?,
|
||||
) {
|
||||
_subjectCollectionDestination.value = Event(Triple(item, childPosition, subject))
|
||||
}
|
||||
@ -772,7 +795,7 @@ class CustomPageViewModel(
|
||||
override fun navigateGameListDetailPage(
|
||||
item: CustomSubjectCollectionItem,
|
||||
childPosition: Int,
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
) {
|
||||
_gameListDetailDestination.value = Event(Triple(item, childPosition, subject))
|
||||
}
|
||||
@ -808,7 +831,7 @@ class CustomPageViewModel(
|
||||
item: CustomPageItem,
|
||||
link: LinkEntity,
|
||||
text: String,
|
||||
exposureEvent: ExposureEvent?
|
||||
exposureEvent: ExposureEvent?,
|
||||
) {
|
||||
_linkDestination.value = Event(Pair(link, exposureEvent))
|
||||
}
|
||||
@ -834,7 +857,7 @@ class CustomPageViewModel(
|
||||
item: CustomPageItem,
|
||||
gameId: String,
|
||||
gameName: String?,
|
||||
childPosition: Int
|
||||
childPosition: Int,
|
||||
) {
|
||||
val exposureEvent = item.exposureEventList.getOrNull(childPosition)
|
||||
_gameDetailDestinationOnAmway.value = Event(Pair(gameId, exposureEvent))
|
||||
@ -909,7 +932,7 @@ class CustomPageViewModel(
|
||||
|
||||
class SubjectChanged(
|
||||
val subjectId: String,
|
||||
val page: Int
|
||||
val page: Int,
|
||||
) {
|
||||
companion object {
|
||||
private const val HASH = 30
|
||||
@ -929,4 +952,13 @@ class CustomPageViewModel(
|
||||
|
||||
}
|
||||
|
||||
class Factory(private val mApplication: Application)
|
||||
: ViewModelProvider.NewInstanceFactory() {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return CustomPageViewModel(mApplication) as T
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -7,6 +7,8 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.databinding.GameCollectionBannerItemBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
|
||||
class AnnouncementBannerAdapter(
|
||||
@ -44,7 +46,6 @@ class AnnouncementBannerAdapter(
|
||||
} else {
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +73,6 @@ class AnnouncementBannerAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: AnnouncementBannerChildViewHolder, position: Int) {
|
||||
val item = getItem(position)
|
||||
listener.exposure(position, item)
|
||||
holder.bind(item)
|
||||
holder.binding.bannerIv.setOnClickListener {
|
||||
listener.onItemClick(getDataPosition(position), item)
|
||||
@ -80,19 +80,23 @@ class AnnouncementBannerAdapter(
|
||||
}
|
||||
|
||||
class AnnouncementBannerChildViewHolder(val binding: GameCollectionBannerItemBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
fun bind(item: CustomPageData.Announcement) {
|
||||
exposureEvent = item.exposureEvent
|
||||
ImageUtils.display(binding.bannerIv, item.image)
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
interface OnChildEventListener {
|
||||
|
||||
fun onItemClick(childPosition: Int, announcement: CustomPageData.Announcement)
|
||||
|
||||
fun getCurrentPosition(): Int
|
||||
|
||||
fun exposure(childPosition: Int, announcement: CustomPageData.Announcement)
|
||||
}
|
||||
}
|
||||
@ -9,12 +9,13 @@ import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.databinding.RecyclerContentLabelLaneItemBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
|
||||
class ContentLabelLaneAdapter(
|
||||
context: Context,
|
||||
private val clickInvoke: (Int, CustomPageData.CommonContentCollection.ContentTag) -> Unit,
|
||||
private val exposureInvoke: (Int, CustomPageData.CommonContentCollection.ContentTag) -> Unit
|
||||
) : CustomBaseChildAdapter<CustomPageData.CommonContentCollection.ContentTag, ContentLabelLaneAdapter.ContentLabelChildViewHolder>(
|
||||
context
|
||||
) {
|
||||
@ -29,6 +30,9 @@ class ContentLabelLaneAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: ContentLabelChildViewHolder, position: Int) {
|
||||
val item = getItem(position)
|
||||
|
||||
holder.exposureEvent = item.exposureEvent
|
||||
|
||||
with(holder.binding) {
|
||||
vBackground.background = R.drawable.bg_shape_content_label_lane_item.toDrawable(context)
|
||||
tvTitle.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
|
||||
@ -47,7 +51,6 @@ class ContentLabelLaneAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
exposureInvoke(position, item)
|
||||
holder.itemView.setOnClickListener {
|
||||
clickInvoke(position, item)
|
||||
}
|
||||
@ -55,9 +58,12 @@ class ContentLabelLaneAdapter(
|
||||
|
||||
class ContentLabelChildViewHolder(
|
||||
val binding: RecyclerContentLabelLaneItemBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
) : RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
var exposureEvent : ExposureEvent? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -9,6 +9,8 @@ import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.databinding.CommonCollectionItemBinding
|
||||
import com.gh.gamecenter.entity.CommonCollectionContentEntity
|
||||
import com.gh.gamecenter.entity.ExposureLinkEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_HORIZONTAL_IMAGE_TEXT
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_HORIZONTAL_SLIDE_BANNER
|
||||
@ -57,6 +59,7 @@ class CustomCommonCollectionAdapter(
|
||||
}
|
||||
}
|
||||
listener.addExposureEvent(position, item.linkEntity)
|
||||
holder.boundedLinkEntity = item.linkEntity
|
||||
|
||||
holder.binding.apply {
|
||||
ImageUtils.display(commonCollectionImage, item.image)
|
||||
@ -109,10 +112,15 @@ class CustomCommonCollectionAdapter(
|
||||
}
|
||||
|
||||
class CustomCommonCollectionItemViewHolder(val binding: CommonCollectionItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
BaseRecyclerViewHolder<Any>(binding.root), IExposureProvider {
|
||||
var boundedLinkEntity: ExposureLinkEntity? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedLinkEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
interface OnEventListener {
|
||||
|
||||
fun addExposureEvent(childPosition: Int, exposureLinkEntity: ExposureLinkEntity)
|
||||
|
||||
fun onChildItemClick(childPosition: Int, item: CommonCollectionContentEntity)
|
||||
|
||||
@ -166,7 +166,6 @@ class CustomDiscoverCardGameAdapter(
|
||||
RetrofitManager.getInstance().api.discorveryFeedback(gameId, paramsMap.toRequestBody())
|
||||
.compose(singleToMain())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
callback.invoke()
|
||||
}
|
||||
@ -194,7 +193,6 @@ class CustomDiscoverCardGameAdapter(
|
||||
notifyChildItem(busFour.packageName)
|
||||
}
|
||||
|
||||
|
||||
private fun notifyChildItem(packageName: String) {
|
||||
dataList.forEachIndexed { position, gameEntity ->
|
||||
gameEntity.getApk().forEach { apkEntity ->
|
||||
|
||||
@ -25,8 +25,9 @@ import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.databinding.RecyclerFoldSlideLargeImageItemBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.home.custom.eventlistener.SubjectEventHelper
|
||||
@ -53,7 +54,6 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
}
|
||||
submitList(list, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getKey(t: GameEntity): String {
|
||||
@ -88,10 +88,8 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
holder.itemView.setOnClickListener {
|
||||
eventHelper.navigateToGameDetailPage(realPosition, game)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
|
||||
_recyclerView = recyclerView
|
||||
}
|
||||
@ -107,7 +105,6 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun notifyDownloadDeleted(status: EBDownloadStatus) {
|
||||
@ -139,7 +136,6 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
action(position, game)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getInitPosition() =
|
||||
@ -153,7 +149,7 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
private val eventHelper: SubjectEventHelper,
|
||||
val binding: RecyclerFoldSlideLargeImageItemBinding
|
||||
) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
|
||||
private lateinit var item: GameEntity
|
||||
|
||||
@ -200,7 +196,6 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
}
|
||||
|
||||
if (data.shouldShowDownloadButton) {
|
||||
|
||||
binding.btnDownload.goneIf(false)
|
||||
DownloadItemUtils.setOnClickListener(
|
||||
itemView.context, binding.btnDownload, game, bindingAdapterPosition,
|
||||
@ -226,7 +221,6 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
} else {
|
||||
binding.btnDownload.goneIf(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getBottomBackground(oColor: String): Pair<Int, Drawable> {
|
||||
@ -303,6 +297,10 @@ class CustomFoldSlideLargeImageItemAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return item.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val BUBBLE_SHOW_DURATION = 4000L
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ class CustomGameHorizontalSlideAdapter(
|
||||
|
||||
var gameName = ""
|
||||
var entrance = ""
|
||||
private var _exposureEventList: List<ExposureEvent>? = null
|
||||
|
||||
private var isShowFirstLine = false
|
||||
private var isShowSecondLine = false
|
||||
@ -42,12 +41,11 @@ class CustomGameHorizontalSlideAdapter(
|
||||
get() = _data.data
|
||||
|
||||
|
||||
fun setData(data: CustomSubjectItem, exposureEventList: List<ExposureEvent>?) {
|
||||
fun setData(data: CustomSubjectItem) {
|
||||
isShowFirstLine = false
|
||||
isShowSecondLine = false
|
||||
hasTwoLinesName = false
|
||||
_data = data
|
||||
_exposureEventList = exposureEventList
|
||||
data.data.data?.forEach {
|
||||
if (!isShowFirstLine && it.assignRemark.firstLine.isNotEmpty()) {
|
||||
isShowFirstLine = true
|
||||
@ -86,7 +84,6 @@ class CustomGameHorizontalSlideAdapter(
|
||||
}
|
||||
holder.bindGameHorizontalItem(gameEntity, subjectEntity, isShowFirstLine, isShowSecondLine)
|
||||
holder.itemView.setOnClickListener {
|
||||
gameEntity.exposureEvent = _exposureEventList?.getOrNull(position)
|
||||
eventHelper.navigateToGameDetailPage(position, gameEntity)
|
||||
}
|
||||
|
||||
@ -99,7 +96,7 @@ class CustomGameHorizontalSlideAdapter(
|
||||
this,
|
||||
StringUtils.buildString("(游戏-专题:", subjectEntity.name, "-列表[", (position + 1).toString(), "])"),
|
||||
location = StringUtils.buildString("游戏-专题-", subjectEntity.name, ":", gameEntity.name),
|
||||
traceEvent = _exposureEventList?.getOrNull(position)
|
||||
traceEvent = gameEntity.exposureEvent
|
||||
) {
|
||||
eventHelper.onDownloadButtonClick(position, gameEntity)
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ 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
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
|
||||
class CustomGameNavigationAdapter(
|
||||
context: Context,
|
||||
@ -46,6 +47,7 @@ class CustomGameNavigationAdapter(
|
||||
// 是否显示小红点
|
||||
var isShowHint = false
|
||||
val entity = dataList[position]
|
||||
holder.exposureEvent = exposureEventList?.getOrNull(position)
|
||||
ImageUtils.display(holder.binding.navigationView, entity.image)
|
||||
holder.binding.navigationNameTv.text = if (entity.isShowEntryName) {
|
||||
entity.entryName
|
||||
@ -132,7 +134,6 @@ class CustomGameNavigationAdapter(
|
||||
listener.navigateToLinkPage(it, "导航栏", exposureEvent)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun showGuide(entity: GameNavigationEntity, binding: ItemGameNavigationCustomBinding) {
|
||||
@ -156,7 +157,6 @@ class CustomGameNavigationAdapter(
|
||||
gradientDrawable.setStroke(1F.dip2px(), entity.guide.borderColorInt)
|
||||
gradientDrawable.setColor(entity.guide.backgroundColorInt)
|
||||
binding.tvBubble.background = gradientDrawable
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -164,7 +164,14 @@ class CustomGameNavigationAdapter(
|
||||
}
|
||||
|
||||
class GameNavigationViewHolder(val binding: ItemGameNavigationCustomBinding) :
|
||||
BaseRecyclerViewHolder<RecyclerView.ViewHolder>(binding.root)
|
||||
BaseRecyclerViewHolder<RecyclerView.ViewHolder>(binding.root), IExposureProvider {
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
interface OnEventListener {
|
||||
fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?)
|
||||
|
||||
@ -15,7 +15,6 @@ import com.gh.common.util.HomePluggableHelper
|
||||
import com.gh.gamecenter.common.constant.ItemViewType
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.MtaHelper.onEvent
|
||||
import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
@ -120,7 +119,6 @@ class CustomGamePluginAdapter(
|
||||
null
|
||||
)
|
||||
holder.itemView.setOnClickListener { v: View? ->
|
||||
onEvent("首页_新", "点击", "插件化" + (position + 1) + "_" + gameEntity.name)
|
||||
DataCollectionUtils.uploadClick(
|
||||
context,
|
||||
"插件化" + "-列表",
|
||||
|
||||
@ -11,10 +11,10 @@ import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.game.vertical.GameItemUi
|
||||
import com.gh.gamecenter.home.custom.eventlistener.GameSubjectCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
@ -95,12 +95,13 @@ class CustomGameRefreshVerticalAdapter(
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inner class SimpleGameItemViewHolder(private val ui: GameItemUi) : ViewHolder(ui.root) {
|
||||
inner class SimpleGameItemViewHolder(private val ui: GameItemUi) : ViewHolder(ui.root), IExposureProvider {
|
||||
var placeholderGameViewHolder: GameViewHolder? = null
|
||||
|
||||
private var exposureEvent: ExposureEvent? = null
|
||||
|
||||
fun bindSimpleGameItem(
|
||||
adapter: RecyclerView.Adapter<ViewHolder>,
|
||||
gameEntity: GameEntity,
|
||||
@ -124,6 +125,8 @@ class CustomGameRefreshVerticalAdapter(
|
||||
var paddingEnd = if (isEndOfRow) 16F.dip2px() else 0F.dip2px()
|
||||
val height = 80F.dip2px()
|
||||
|
||||
exposureEvent = gameEntity.exposureEvent
|
||||
|
||||
itemView.layoutParams = if (!isEndOfRow) {
|
||||
paddingEnd += 1
|
||||
ViewGroup.LayoutParams(maxWidth - 24F.dip2px(), height)
|
||||
@ -210,6 +213,9 @@ class CustomGameRefreshVerticalAdapter(
|
||||
root.setPadding(paddingStart, 8F.dip2px(), paddingEnd, 8F.dip2px())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,9 @@ import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.game.vertical.GameItemUi
|
||||
@ -103,9 +104,11 @@ class CustomGameVerticalAdapter(
|
||||
class SimpleGameItemViewHolder(
|
||||
private val ui: GameItemUi,
|
||||
private val eventHelper: SubjectEventHelper
|
||||
) : ViewHolder(ui.root) {
|
||||
) : ViewHolder(ui.root), IExposureProvider {
|
||||
var placeholderGameViewHolder: GameViewHolder? = null
|
||||
|
||||
private var boundedGameEntity: GameEntity? = null
|
||||
|
||||
fun bindSimpleGameItem(
|
||||
adapter: RecyclerView.Adapter<ViewHolder>,
|
||||
gameEntity: GameEntity,
|
||||
@ -122,6 +125,8 @@ class CustomGameVerticalAdapter(
|
||||
) {
|
||||
val context = itemView.context
|
||||
|
||||
boundedGameEntity = gameEntity
|
||||
|
||||
val paddingStart = 16F.dip2px()
|
||||
val isEndOfRow = position >= if (adapter.itemCount % spanCount == 0) {
|
||||
adapter.itemCount - spanCount
|
||||
@ -220,6 +225,10 @@ class CustomGameVerticalAdapter(
|
||||
root.setPadding(paddingStart, root.paddingTop, paddingEnd, root.paddingBottom)
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,6 +12,8 @@ import com.gh.gamecenter.common.utils.safelyGetInRelease
|
||||
import com.gh.gamecenter.common.view.AsyncCell
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.HomeGameCollectionCardItemCustomBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureListProvider
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
import com.gh.gamecenter.home.custom.eventlistener.GameSubjectCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
@ -21,10 +23,9 @@ class CustomHomeGameCollectionCarouselAdapter(
|
||||
context: Context,
|
||||
private val pageConfigure: PageConfigure,
|
||||
private val eventHelper: GameSubjectCollectionEventHelper
|
||||
) :
|
||||
CustomBaseChildAdapter<CustomPageData.LinkColumnCollection.CustomSubjectEntity, CustomHomeGameCollectionCarouselAdapter.HomeGameCollectionCardViewHolder>(
|
||||
context
|
||||
) {
|
||||
) : CustomBaseChildAdapter<
|
||||
CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
CustomHomeGameCollectionCarouselAdapter.HomeGameCollectionCardViewHolder>(context) {
|
||||
|
||||
private val mPosterWidth = DisplayUtils.getScreenWidth() - 50F.dip2px()
|
||||
|
||||
@ -48,10 +49,8 @@ class CustomHomeGameCollectionCarouselAdapter(
|
||||
pageConfigure.entrance,
|
||||
position
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int) = position
|
||||
@ -68,15 +67,18 @@ class CustomHomeGameCollectionCarouselAdapter(
|
||||
}
|
||||
|
||||
inner class HomeGameCollectionCardViewHolder(cell: HomeGameCollectionCarouselItemCell) :
|
||||
BaseRecyclerViewHolder<Any>(cell) {
|
||||
BaseRecyclerViewHolder<Any>(cell), IExposureListProvider {
|
||||
private var boundedItemData: CustomPageData.LinkColumnCollection.CustomSubjectEntity? = null
|
||||
|
||||
fun bindGameCollectionCard(
|
||||
binding: HomeGameCollectionCardItemCustomBinding,
|
||||
itemData: CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
entrance: String,
|
||||
itemPosition: Int
|
||||
) {
|
||||
boundedItemData = itemData
|
||||
|
||||
binding.run {
|
||||
val context = root.context
|
||||
root.layoutParams.width = mPosterWidth
|
||||
|
||||
if (itemData.user.isValid) {
|
||||
@ -121,8 +123,15 @@ class CustomHomeGameCollectionCarouselAdapter(
|
||||
root.setOnClickListener {
|
||||
eventHelper.navigateSubjectCollectionPage(itemPosition, itemData)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
return boundedItemData?.games?.map {
|
||||
it.exposureEvent?.getFreshExposureEvent()!!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,8 +18,9 @@ import com.gh.gamecenter.databinding.ItemHomeGameCollectionBigSlideCardGameBindi
|
||||
import com.gh.gamecenter.databinding.ItemHomeGameCollectionSmallSlideCardCustomBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureListProvider
|
||||
import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
import com.gh.gamecenter.home.custom.eventlistener.GameSubjectCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
@ -106,6 +107,7 @@ class CustomHomeGameCollectionSlideAdapter(
|
||||
|
||||
// 小卡片
|
||||
if (holder is HomeGameCollectionSmallSlideCardViewHolder) {
|
||||
holder.updateSubject(subject)
|
||||
holder.binding.run {
|
||||
val params = root.layoutParams as ViewGroup.MarginLayoutParams
|
||||
params.leftMargin = if (position == 0) 0 else (-24F).dip2px()
|
||||
@ -184,8 +186,10 @@ class CustomHomeGameCollectionSlideAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
inner class HomeGameCollectionBigSlideCardViewHolder(view: View) : BaseRecyclerViewHolder<Any>(view),
|
||||
IGameChangedNotifier {
|
||||
inner class HomeGameCollectionBigSlideCardViewHolder(view: View) :
|
||||
BaseRecyclerViewHolder<Any>(view),
|
||||
IGameChangedNotifier,
|
||||
IExposureListProvider {
|
||||
|
||||
private var subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity? = null
|
||||
|
||||
@ -294,8 +298,33 @@ class CustomHomeGameCollectionSlideAdapter(
|
||||
eventHelper.navigateToGameDetailPage(bindingAdapterPosition, gameEntity, subject)
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
return subject?.games?.map {
|
||||
it.exposureEvent?.getFreshExposureEvent()!!
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
|
||||
}
|
||||
|
||||
class HomeGameCollectionSmallSlideCardViewHolder(val binding: ItemHomeGameCollectionSmallSlideCardCustomBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
RecyclerView.ViewHolder(binding.root),
|
||||
IExposureListProvider {
|
||||
|
||||
private var boundedSubject: CustomPageData.LinkColumnCollection.CustomSubjectEntity? = null
|
||||
|
||||
fun updateSubject(subject: CustomPageData.LinkColumnCollection.CustomSubjectEntity) {
|
||||
boundedSubject = subject
|
||||
}
|
||||
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
return boundedSubject?.games?.map {
|
||||
it.exposureEvent?.getFreshExposureEvent()!!
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
}
|
||||
}
|
||||
@ -5,20 +5,28 @@ import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.gh.common.util.DownloadItemUtils
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.entity.GameDataWrapper
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PageLocation
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.test_v2.HomeGameTestV2GameListPlaceHolderViewHolder
|
||||
import com.gh.gamecenter.home.test_v2.HomeGameTestV2GameListSpaceViewHolder
|
||||
import com.gh.gamecenter.home.test_v2.HomeGameTestV2GameListViewHolder
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* @author : liujiarui
|
||||
@ -30,7 +38,9 @@ class CustomHomeGameTestV2GameListRvAdapter(
|
||||
private val childEventHelper: OtherItemEventHelper,
|
||||
private val linkText: String,
|
||||
private val pageLocation: PageLocation,
|
||||
private val exposureInvoke: (Int, GameEntity) -> ExposureEvent
|
||||
private val pageConfigure: PageConfigure,
|
||||
private val componentPosition: Int,
|
||||
private val trackData: CustomPageTrackData,
|
||||
) : CustomBaseChildAdapter<GameDataWrapper, ViewHolder>(context) {
|
||||
|
||||
private val mEntrance: String = "新游开测"
|
||||
@ -62,7 +72,6 @@ class CustomHomeGameTestV2GameListRvAdapter(
|
||||
&& oldItem.gameData?.id == newItem.gameData?.id
|
||||
&& oldItem.gameData?.name == newItem.gameData?.name
|
||||
}
|
||||
|
||||
}, false).dispatchUpdatesTo(this)
|
||||
}
|
||||
|
||||
@ -175,7 +184,6 @@ class CustomHomeGameTestV2GameListRvAdapter(
|
||||
notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun notifyDownloadDeleted(status: EBDownloadStatus) {
|
||||
@ -201,17 +209,21 @@ class CustomHomeGameTestV2GameListRvAdapter(
|
||||
gameEntity: GameEntity,
|
||||
position: Int
|
||||
): ExposureEvent {
|
||||
return exposureInvoke(position, gameEntity)
|
||||
val time = gameEntity.time?.time ?: 0L
|
||||
val date = Date(time * 1000L)
|
||||
val sdf = SimpleDateFormat("MM.dd", Locale.CHINA)
|
||||
val format = sdf.format(date)
|
||||
|
||||
gameEntity.exposureEvent = createExposureEvent(
|
||||
gameEntity,
|
||||
listOf(ExposureSource("新游开测", "$linkText-$format")),
|
||||
pageConfigure.exposureSourceList,
|
||||
position,
|
||||
componentPosition,
|
||||
trackData
|
||||
)
|
||||
|
||||
return gameEntity.exposureEvent!!
|
||||
}
|
||||
|
||||
/**
|
||||
* 左右滑动曝光条目
|
||||
*/
|
||||
fun exposureItem(firstItemPosition: Int) {
|
||||
val gameList = dataList
|
||||
for (position in firstItemPosition..firstItemPosition + 2) {
|
||||
val gameEntity = gameList.getOrNull(position)?.gameData ?: continue
|
||||
putExposureEvent(gameEntity, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,9 +6,7 @@ import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
import com.gh.gamecenter.home.custom.eventlistener.SubjectEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomSubjectItem
|
||||
@ -23,7 +21,6 @@ class CustomHomeHorizontalSlideVideoAdapter(
|
||||
context: Context,
|
||||
private val pageConfigure: PageConfigure,
|
||||
private val eventHelper: SubjectEventHelper,
|
||||
private val exposureClosure: (GameEntity, Int) -> ExposureEvent,
|
||||
) : CustomBaseChildAdapter<GameEntity, CustomHomeHorizontalSlideVideoItemViewHolder>(context) {
|
||||
|
||||
private lateinit var item: CustomSubjectItem
|
||||
@ -44,8 +41,6 @@ class CustomHomeHorizontalSlideVideoAdapter(
|
||||
override fun onBindViewHolder(holder: CustomHomeHorizontalSlideVideoItemViewHolder, position: Int) {
|
||||
val gameEntity = dataList[position]
|
||||
|
||||
val event = exposureClosure(gameEntity, position)
|
||||
|
||||
holder.binding.root.setPadding(
|
||||
16F.dip2px(),
|
||||
holder.binding.root.topPadding,
|
||||
@ -67,13 +62,11 @@ class CustomHomeHorizontalSlideVideoAdapter(
|
||||
gameEntity,
|
||||
this,
|
||||
pageConfigure.entrance,
|
||||
event,
|
||||
item.data.showIndexIconSubscript,
|
||||
item.data.showIndexSubtitle
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
override fun notifyDownload(download: DownloadEntity) {
|
||||
dataList.forEachIndexed { index, game ->
|
||||
if (game.id == download.gameId) {
|
||||
|
||||
@ -10,6 +10,8 @@ import com.gh.gamecenter.common.entity.IconFloat
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.databinding.ItemHomeVgameRefactorBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.eventlistener.OtherItemEventHelper
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.vspace.VGameItemData
|
||||
@ -52,9 +54,13 @@ class CustomHomeRecentVGameAdapter(
|
||||
private var binding: ItemHomeVgameRefactorBinding,
|
||||
private val childEventHelper: OtherItemEventHelper
|
||||
) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
|
||||
private var boundedItem: VGameItemData? = null
|
||||
|
||||
fun bindView(entity: VGameItemData) {
|
||||
boundedItem = entity
|
||||
|
||||
if (binding.gameIconIv.getTag(R.string.app_name) != entity.downloadEntity.packageName) {
|
||||
val iconFloat = IconFloat(
|
||||
entity.downloadEntity.getMetaExtra(Constants.GAME_ICON_FLOAT_TOP_TEXT),
|
||||
@ -176,5 +182,9 @@ class CustomHomeRecentVGameAdapter(
|
||||
binding.controlTv.text = itemData.controlText
|
||||
binding.progressBar.progress = downloadEntity.percent.toInt()
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedItem?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,6 @@ class CustomHomeRecommendItemGridAdapter(
|
||||
}
|
||||
|
||||
interface OnEventListener {
|
||||
|
||||
fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?)
|
||||
}
|
||||
}
|
||||
@ -15,8 +15,6 @@ import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.utils.DataLogUtils
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
|
||||
import com.gh.gamecenter.entity.HomeSlide
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
@ -50,7 +48,6 @@ class CustomHomeSlideListAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val dataCount: Int
|
||||
get() = dataList.size
|
||||
|
||||
@ -77,21 +74,8 @@ class CustomHomeSlideListAdapter(
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
val homeSlide = dataList[actualPosition]
|
||||
|
||||
val game = homeSlide.linkGame
|
||||
if (homeSlide.linkType == "game") {
|
||||
game?.exposureEvent = listener.createExposureEvent(actualPosition, game)
|
||||
} else {
|
||||
game?.exposureEvent = listener.createExposureEvent(actualPosition, game)
|
||||
?.also {
|
||||
it.payload.controlType = "轮播图"
|
||||
it.payload.controlName = homeSlide.title
|
||||
it.payload.controlLinkName = homeSlide.linkText
|
||||
it.payload.controlLinkType = homeSlide.linkType
|
||||
}
|
||||
}
|
||||
|
||||
if (holder is CustomHomeSlideListItemViewHolder) {
|
||||
holder.bindSlideListItem(homeSlide)
|
||||
@ -129,11 +113,6 @@ class CustomHomeSlideListAdapter(
|
||||
) {
|
||||
rootView.setOnClickListener {
|
||||
val actualPositionString = (actualPosition + 1).toString()
|
||||
if (homeSlide.linkType == "video") {
|
||||
MtaHelper.onEvent("首页_新", "轮播_点击", actualPositionString + "_视频详情")
|
||||
} else if (homeSlide.linkType == "game") {
|
||||
MtaHelper.onEvent("首页_新", "轮播_点击", actualPositionString + "_游戏详情")
|
||||
}
|
||||
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
@ -240,11 +219,8 @@ class CustomHomeSlideListAdapter(
|
||||
fun getActualSize() = dataList.size
|
||||
|
||||
interface OnEventListener {
|
||||
fun createExposureEvent(actualPosition: Int, game: GameEntity?): ExposureEvent?
|
||||
|
||||
fun navigateToGameDetailPage(actualPosition: Int, game: GameEntity, text: String, link: LinkEntity?)
|
||||
|
||||
fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?)
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,20 +1,18 @@
|
||||
package com.gh.gamecenter.home.custom.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.gh.common.util.DownloadItemUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.databinding.RecyclerChildIconMatrixCustomBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.adapter.CustomPageAdapter.Companion.PAYLOAD_REFRESH_GAME_CHANGED
|
||||
import com.gh.gamecenter.home.custom.eventlistener.SubjectEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomSplitSubjectItem
|
||||
@ -50,6 +48,9 @@ class CustomIconMatrixAdapter(
|
||||
val isRefreshDownloadStatus = payloads.any {
|
||||
PAYLOAD_REFRESH_GAME_CHANGED == it
|
||||
}
|
||||
|
||||
holder.boundedGameEntity = getItem(position)
|
||||
|
||||
if (isRefreshDownloadStatus) {
|
||||
DownloadItemUtils.updateItem(
|
||||
context,
|
||||
@ -77,7 +78,6 @@ class CustomIconMatrixAdapter(
|
||||
item.name
|
||||
)
|
||||
gameName.maxLines = if (subject.showDownload) 1 else 2
|
||||
|
||||
}
|
||||
val showStar = subject.showStar
|
||||
&& subject.data?.any { it.commentCount > 3 } ?: false
|
||||
@ -123,7 +123,6 @@ class CustomIconMatrixAdapter(
|
||||
notifyItemChanged(index, PAYLOAD_REFRESH_GAME_CHANGED)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun notifyDownloadDeleted(status: EBDownloadStatus) {
|
||||
@ -147,5 +146,11 @@ class CustomIconMatrixAdapter(
|
||||
|
||||
class CustomChildIconMatrixViewHolder(
|
||||
val binding: RecyclerChildIconMatrixCustomBinding
|
||||
) : ViewHolder(binding.root)
|
||||
) : ViewHolder(binding.root), IExposureProvider {
|
||||
var boundedGameEntity: GameEntity? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return boundedGameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,13 +9,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.baselist.LoadStatus
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.game.GameAndPosition
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
@ -69,7 +67,7 @@ class CustomPageAdapter(
|
||||
private val viewModel: CustomPageViewModel,
|
||||
private val lifecycleOwner: LifecycleOwner,
|
||||
private val scrollCalculatorHelper: ScrollCalculatorHelper,
|
||||
) : ListAdapter<CustomPageItem, BaseCustomViewHolder>(CALLBACK), IExposable, IGameChangedNotifier {
|
||||
) : ListAdapter<CustomPageItem, BaseCustomViewHolder>(CALLBACK), IGameChangedNotifier {
|
||||
|
||||
private var loadStatus: LoadStatus? = null
|
||||
|
||||
@ -86,13 +84,13 @@ class CustomPageAdapter(
|
||||
}
|
||||
val firstShowPosition: LiveData<Int> = _firstShowPosition
|
||||
|
||||
override fun submitList(list: List<CustomPageItem>?) {
|
||||
override fun submitList(list: List<CustomPageItem>?, commitCallback: Runnable?) {
|
||||
val dataWithFooter = if (list.isNullOrEmpty()) {
|
||||
ArrayList(list)
|
||||
} else {
|
||||
list + CustomFooterItem
|
||||
}
|
||||
super.submitList(dataWithFooter)
|
||||
super.submitList(dataWithFooter, commitCallback)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,10 +304,10 @@ class CustomPageAdapter(
|
||||
val item = getItem(position)
|
||||
when (holder) {
|
||||
is CustomDoubleCardViewHolder -> holder.bindView(item)
|
||||
|
||||
is CustomHomeHorizontalSlideVideoListViewHolder -> holder.bindView(item)
|
||||
is CustomGameItemViewHolder -> {
|
||||
holder.bindView(item, this)
|
||||
}
|
||||
|
||||
is CustomGameItemViewHolder -> holder.bindView(item, this)
|
||||
|
||||
is CustomGameVerticalSlideViewHolder -> holder.bindView(item)
|
||||
|
||||
@ -339,9 +337,7 @@ class CustomPageAdapter(
|
||||
|
||||
is CustomHomeItemGameTestV2ViewHolder -> holder.bindView(item, position)
|
||||
|
||||
is CustomHomeDiscoverCardViewHolder -> {
|
||||
holder.bindView(item, position)
|
||||
}
|
||||
is CustomHomeDiscoverCardViewHolder -> holder.bindView(item, position)
|
||||
|
||||
is CustomBigImageRecommendViewHolder -> holder.bindView(item)
|
||||
|
||||
@ -415,14 +411,6 @@ class CustomPageAdapter(
|
||||
holder.onViewDetach(recyclerView)
|
||||
}
|
||||
|
||||
override fun getEventByPosition(pos: Int): ExposureEvent? {
|
||||
return getItem(pos).exposureEvent
|
||||
}
|
||||
|
||||
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
|
||||
return getItem(pos).exposureEventList
|
||||
}
|
||||
|
||||
override fun notifyDownload(download: DownloadEntity) {
|
||||
val data = getGameEntityByPackage(download.packageName)
|
||||
data.forEach { (game, position, _) ->
|
||||
@ -448,7 +436,6 @@ class CustomPageAdapter(
|
||||
it.notifyDownloadDeleted(status)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun notifyInstalled(busFour: EBPackage) {
|
||||
@ -517,7 +504,6 @@ class CustomPageAdapter(
|
||||
|
||||
|
||||
private val onLoadMoreListener = object : OnScrollListener() {
|
||||
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
val layoutManger = recyclerView.layoutManager
|
||||
@ -528,7 +514,6 @@ class CustomPageAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -10,8 +10,9 @@ import com.gh.gamecenter.common.view.AsyncCell
|
||||
import com.gh.gamecenter.databinding.RankCollectionItemCustomBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureListProvider
|
||||
import com.gh.gamecenter.game.rank.CustomRankGameItem
|
||||
import com.gh.gamecenter.game.rank.RankGameItemUi
|
||||
import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
@ -109,8 +110,6 @@ class CustomRankCollectionAdapter(
|
||||
holder.gameItemList[i].rankItemUi.root.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,7 +137,6 @@ class CustomRankCollectionAdapter(
|
||||
override fun onViewAttachedToWindow(holder: RankCollectionItemViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
viewHolderList.add(holder)
|
||||
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(holder: RankCollectionItemViewHolder) {
|
||||
@ -162,7 +160,7 @@ class CustomRankCollectionAdapter(
|
||||
}
|
||||
|
||||
inner class RankCollectionItemViewHolder(view: View) :
|
||||
BaseRecyclerViewHolder<Any>(view), IGameChangedNotifier {
|
||||
BaseRecyclerViewHolder<Any>(view), IGameChangedNotifier, IExposureListProvider {
|
||||
|
||||
val gameItemList = arrayListOf<CustomRankGameItem>()
|
||||
|
||||
@ -235,5 +233,13 @@ class CustomRankCollectionAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
return subjectEntity?.games?.map {
|
||||
it.exposureEvent?.getFreshExposureEvent()!!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,8 @@ import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.RecyclerRefreshIconItemCustomBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.game.horizontal.GameHorizontalSimpleItemViewHolder
|
||||
import com.gh.gamecenter.home.custom.eventlistener.GameSubjectCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
@ -16,7 +18,6 @@ import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
class CustomRefreshIconAdapter(
|
||||
context: Context,
|
||||
private val eventHelper: GameSubjectCollectionEventHelper,
|
||||
private val exposureInvoke: (Int, GameEntity) -> Unit
|
||||
) : CustomBaseChildAdapter<GameEntity, CustomRefreshIconAdapter.RefreshIconChildViewHolder>(context) {
|
||||
|
||||
private var collectionName = ""
|
||||
@ -45,8 +46,7 @@ class CustomRefreshIconAdapter(
|
||||
override fun onBindViewHolder(holder: RefreshIconChildViewHolder, position: Int) {
|
||||
val gameEntity = getItem(position)
|
||||
|
||||
exposureInvoke(position, gameEntity)
|
||||
|
||||
holder.exposureEvent = gameEntity.exposureEvent
|
||||
holder.binding.run {
|
||||
val padR = if (position == itemCount - 1) 16F.dip2px() else 0
|
||||
root.setPadding(16F.dip2px(), 0, padR, 0)
|
||||
@ -65,10 +65,15 @@ class CustomRefreshIconAdapter(
|
||||
)
|
||||
eventHelper.navigateToGameDetailPage(position, gameEntity, subject)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class RefreshIconChildViewHolder(val binding: RecyclerRefreshIconItemCustomBinding) : ViewHolder(binding.root)
|
||||
class RefreshIconChildViewHolder(val binding: RecyclerRefreshIconItemCustomBinding) :
|
||||
ViewHolder(binding.root), IExposureProvider {
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,12 +6,11 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.visibleIf
|
||||
import com.gh.gamecenter.databinding.RecyclerNotificationColumnItemBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
|
||||
class NotificationColumnAdapter(
|
||||
context: Context,
|
||||
private val exposureInvoke: (Int, CustomPageData.Notify) -> Unit
|
||||
) :
|
||||
class NotificationColumnAdapter(context: Context, ) :
|
||||
CustomBaseChildAdapter<CustomPageData.Notify, NotificationColumnAdapter.NotificationColumChildViewHolder>(context) {
|
||||
|
||||
private var toBeDeletedItemIds = arrayListOf<String>()
|
||||
@ -51,13 +50,14 @@ class NotificationColumnAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: NotificationColumChildViewHolder, position: Int) {
|
||||
val item = getItem(position)
|
||||
|
||||
holder.exposureEvent = item.exposureEvent
|
||||
with(holder.binding) {
|
||||
ivIcon.displayGameIcon(item.image, null, goneIfEmpty = true, null)
|
||||
tvTitle.text = item.title
|
||||
tvDesc.text = item.addedContent
|
||||
ivClose.visibleIf(item.isClosable)
|
||||
}
|
||||
exposureInvoke(position, item)
|
||||
}
|
||||
|
||||
private fun getValidItem(position: Int): CustomPageData.Notify {
|
||||
@ -90,5 +90,13 @@ class NotificationColumnAdapter(
|
||||
|
||||
class NotificationColumChildViewHolder(
|
||||
val binding: RecyclerNotificationColumnItemBinding
|
||||
) : RecyclerView.ViewHolder(binding.root)
|
||||
) : RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,8 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.databinding.RecyclerRecommendCardItemBinding
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureProvider
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.home.custom.ui.RecommendCardUi
|
||||
|
||||
@ -23,7 +25,6 @@ class RecommendCardAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: RecommendCardChildViewHolder, position: Int) {
|
||||
val item = getItem(position)
|
||||
listener.onItemExposure(position, item)
|
||||
holder.bind(item, position)
|
||||
holder.itemView.setOnClickListener {
|
||||
listener.onItemClick(position, item)
|
||||
@ -31,9 +32,13 @@ class RecommendCardAdapter(
|
||||
}
|
||||
|
||||
class RecommendCardChildViewHolder(val binding: RecyclerRecommendCardItemBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
RecyclerView.ViewHolder(binding.root), IExposureProvider {
|
||||
|
||||
private var exposureEvent: ExposureEvent? = null
|
||||
|
||||
fun bind(item: CustomPageData.RecommendCard, position: Int) {
|
||||
exposureEvent = item.exposureEvent
|
||||
|
||||
binding.tvTitle.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(itemView.context))
|
||||
binding.tvOriginalPrice.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(itemView.context))
|
||||
|
||||
@ -87,5 +92,9 @@ class RecommendCardAdapter(
|
||||
hideOutOfBoundViewsIfNeed(views)
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? {
|
||||
return exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.gh.gamecenter.common.entity.PKEntity
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.feature.entity.FloatingWindowEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
|
||||
@ -566,6 +567,8 @@ class CustomPageData(
|
||||
community = _linkCommunity
|
||||
)
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
data class Guide(
|
||||
@SerializedName("text")
|
||||
private val _text: String? = null
|
||||
@ -633,6 +636,8 @@ class CustomPageData(
|
||||
text = linkText,
|
||||
community = _linkCommunity
|
||||
)
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
}
|
||||
|
||||
data class Announcement(
|
||||
@ -675,6 +680,8 @@ class CustomPageData(
|
||||
text = linkText,
|
||||
community = _linkCommunity
|
||||
)
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
}
|
||||
|
||||
data class LinkRecentlyPlayed(
|
||||
@ -755,6 +762,8 @@ class CustomPageData(
|
||||
community = _linkCommunity
|
||||
)
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
data class TextWithSymbol(
|
||||
@SerializedName("text")
|
||||
private val _text: String? = null,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.home.custom.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.PKEntity
|
||||
@ -31,9 +32,15 @@ class CustomPageRemoteDataSource(
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun loadCustomPageData(pageId: String, page: Int, forceLoad: Boolean = false): Single<CustomPageData> {
|
||||
fun loadCustomPageData(
|
||||
pageId: String,
|
||||
page: Int,
|
||||
forceLoad: Boolean = false,
|
||||
): Single<CustomPageData> {
|
||||
val isDefaultPage = pageId == mainWrapperRepository.defaultCustomPageId
|
||||
|
||||
return if (page == 1 &&
|
||||
pageId == mainWrapperRepository.defaultCustomPageId &&
|
||||
isDefaultPage &&
|
||||
mainWrapperRepository.customPageLiveData.value != null &&
|
||||
!forceLoad
|
||||
) {
|
||||
@ -41,7 +48,11 @@ class CustomPageRemoteDataSource(
|
||||
it.onSuccess(mainWrapperRepository.customPageLiveData.value!!)
|
||||
}
|
||||
} else {
|
||||
newApi.getCustomPageData(pageId, page)
|
||||
newApi.getCustomPageData(
|
||||
pageId,
|
||||
page,
|
||||
if (!isDefaultPage) AdHelper.getIdfaString() else ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -367,7 +367,7 @@ class CustomPageRepository private constructor(
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
)
|
||||
wGameSubjectCPMListUseCase.getWechatMiniGameCPMList(subject.id)
|
||||
wGameSubjectCPMListUseCase.getWechatMiniGameCPMList(subject.id, subject.size.limit, subject.onlyFee)
|
||||
pageInfo.positionIncrement()
|
||||
pageInfo.componentPositionIncrement()
|
||||
}
|
||||
@ -384,7 +384,7 @@ class CustomPageRepository private constructor(
|
||||
pageInfo.componentPosition
|
||||
)
|
||||
)
|
||||
dspSubjectUseCase.getDspGames(subject.columnType, subject.size.index)
|
||||
dspSubjectUseCase.getDspGames(subject.size.index)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<List<GameEntity>>() {
|
||||
@ -737,14 +737,14 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
|
||||
if (gameSubject != null && !gameSubject.data.isNullOrEmpty()) {
|
||||
// 替换游戏
|
||||
substituteGameIfNeeded(gameSubject)
|
||||
|
||||
// 记录已显示的游戏 id
|
||||
for (game in gameSubject.data!!) {
|
||||
displayingGameIdSet.add(game.id)
|
||||
}
|
||||
|
||||
// 替换游戏
|
||||
substituteGameIfNeeded(gameSubject)
|
||||
|
||||
when (gameSubject.type) {
|
||||
COMPONENTS_GAME_SUBJECT_TYPE_DOUBLE_CARD, COMPONENTS_SUBJECT_TYPE_DOUBLE_GAME_WELFARE_CARD, COMPONENTS_SUBJECT_TYPE_GAME_VERTICAL_IMAGE_TEXT -> {
|
||||
// 双列卡片 双列福利卡片 竖式图文列表
|
||||
@ -903,8 +903,8 @@ class CustomPageRepository private constructor(
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
|
||||
fun loadChangeSubjectWGameCPM(page: Int): Observable<MutableList<GameEntity>> =
|
||||
wGameSubjectCPMRemoteDataSource.getEditorRecommendCPMList(page, 10)// 微信小游戏CPM专题的“换一批”接口
|
||||
fun loadChangeSubjectWGameCPM(page: Int, minimumSize: Int, onlyFee: Boolean): Observable<MutableList<GameEntity>> =
|
||||
wGameSubjectCPMRemoteDataSource.getEditorRecommendCPMList(page = page, minimumSize = minimumSize, onlyFee = onlyFee)// 微信小游戏CPM专题的“换一批”接口
|
||||
.toObservable()
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
@ -1028,7 +1028,7 @@ class CustomPageRepository private constructor(
|
||||
MainWrapperRepository.getInstance()
|
||||
),
|
||||
CustomPageLocalDataSource(),
|
||||
WGameSubjectCPMRemoteDataSource()
|
||||
WGameSubjectCPMRemoteDataSource(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,8 @@ class GameSubjectCollectionTracker(private val pageLocation: PageLocation) {
|
||||
game?.name ?: "",
|
||||
link?.type ?: "",
|
||||
link?.link ?: "",
|
||||
link?.text ?: ""
|
||||
link?.text ?: "",
|
||||
adGroupId = game?.adGroupId ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,8 @@ class SubjectTracker(private val pageLocation: PageLocation) {
|
||||
"自定义页面",
|
||||
item.componentStyle,
|
||||
text,
|
||||
buttonType
|
||||
buttonType,
|
||||
adGroupId = game?.adGroupId ?: "",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ class CommonContentCollection12Ui(
|
||||
collection: CustomPageData.CommonContentCollection,
|
||||
leftPosition: Int
|
||||
) {
|
||||
|
||||
val data = collection.data
|
||||
|
||||
val isFirstLine = leftPosition == 0
|
||||
@ -44,13 +43,13 @@ class CommonContentCollection12Ui(
|
||||
listener.navigateToCommonCollectionDetailPage(collection)
|
||||
}
|
||||
|
||||
|
||||
val width = (DisplayUtils.getScreenWidth() - 16F.dip2px() * 2 - 8F.dip2px()) / 2
|
||||
val height = if (collection.layout == COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_VERTICAL_CARD) {
|
||||
width * 4 / 3
|
||||
} else {
|
||||
width / 2
|
||||
}
|
||||
|
||||
bindSubView(
|
||||
data[leftPosition],
|
||||
binding.leftView,
|
||||
@ -90,7 +89,6 @@ class CommonContentCollection12Ui(
|
||||
with(binding.root) {
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, _paddingBottom)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun bindSubView(
|
||||
|
||||
@ -62,10 +62,6 @@ class CommonContentHomeSLideListUi(
|
||||
layoutManager,
|
||||
false,
|
||||
object : CustomHomeSlideListAdapter.OnEventListener {
|
||||
override fun createExposureEvent(actualPosition: Int, game: GameEntity?): ExposureEvent? {
|
||||
return listener.createExposureEvent(actualPosition, game)
|
||||
}
|
||||
|
||||
override fun navigateToGameDetailPage(
|
||||
actualPosition: Int,
|
||||
game: GameEntity,
|
||||
@ -78,7 +74,6 @@ class CommonContentHomeSLideListUi(
|
||||
override fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?) {
|
||||
listener.navigateToLinkPage(link, text, exposureEvent)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -277,13 +272,10 @@ class CommonContentHomeSLideListUi(
|
||||
}
|
||||
|
||||
interface OnCommonHomeSlideListEventListener {
|
||||
|
||||
fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?)
|
||||
|
||||
fun navigateToGameDetailPage(position: Int, game: GameEntity, text: String, link: LinkEntity?)
|
||||
|
||||
fun updateImmersiveColor(color: Int)
|
||||
|
||||
fun createExposureEvent(childPosition: Int, game: GameEntity?): ExposureEvent?
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ import androidx.viewpager2.widget.ViewPager2
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.FixLinearLayoutManager
|
||||
import com.gh.gamecenter.common.view.ScrollEventListener
|
||||
@ -43,9 +44,11 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
private val useCase: CommonContentCollectionUseCase,
|
||||
private val lifecycleOwner: LifecycleOwner,
|
||||
val binding: HomeSlideWithCardsCustomBinding,
|
||||
private val listener: HomeSLideWithCardsEventListener
|
||||
private val refreshCount: Int,
|
||||
private val basicExposureSource: List<ExposureSource> ? = null,
|
||||
private val pageLevelString: String,
|
||||
private val listener: HomeSLideWithCardsEventListener,
|
||||
) {
|
||||
|
||||
private var collection: CustomPageData.CommonContentCollection? = null
|
||||
|
||||
private val context: Context
|
||||
@ -59,7 +62,6 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
PagerSnapHelper()
|
||||
}
|
||||
|
||||
|
||||
private val adapter by lazy {
|
||||
CustomHomeSlideListAdapter(
|
||||
context,
|
||||
@ -67,10 +69,6 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
layoutManager,
|
||||
true,
|
||||
object : CustomHomeSlideListAdapter.OnEventListener {
|
||||
override fun createExposureEvent(actualPosition: Int, game: GameEntity?): ExposureEvent? {
|
||||
return listener.createExposureEvent(actualPosition, game)
|
||||
}
|
||||
|
||||
override fun navigateToGameDetailPage(
|
||||
actualPosition: Int,
|
||||
game: GameEntity,
|
||||
@ -83,7 +81,6 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
override fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?) {
|
||||
listener.navigateToLinkPage(link, text, exposureEvent)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -115,13 +112,11 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
if (collection.slides.subSlide.isNotEmpty()) {
|
||||
bindCards(collection, collection.slides.subSlide)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun bindSlide(
|
||||
slideList: List<HomeSlide>
|
||||
) {
|
||||
|
||||
if (binding.recyclerView.adapter == null) {
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.adapter = adapter
|
||||
@ -227,14 +222,12 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
?: com.gh.gamecenter.common.R.color.ui_surface.toColor(binding.root.context)
|
||||
)
|
||||
|
||||
|
||||
binding.bannerIndicator.run {
|
||||
pageSize = adapter.getActualSize()
|
||||
notifyDataChanged()
|
||||
}
|
||||
|
||||
bannerController.start()
|
||||
|
||||
}
|
||||
|
||||
private fun bindCards(
|
||||
@ -337,8 +330,6 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
}
|
||||
|
||||
homeSubSlide.cardData.games.take(3).forEachIndexed { index, gameEntity ->
|
||||
listener.addGameExposureEvent(position, gameEntity, homeSubSlide.id)
|
||||
|
||||
when (index) {
|
||||
0 -> gameIconIv1.setGame(index, gameEntity)
|
||||
|
||||
@ -348,6 +339,30 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
}
|
||||
}
|
||||
|
||||
for ((index, game) in homeSubSlide.cardData.games.take(3).withIndex()) {
|
||||
game.pageLevelString = pageLevelString
|
||||
game.exposureEvent = ExposureEvent.createEventWithSourceConcat(
|
||||
gameEntity = game.apply {
|
||||
sequence = index
|
||||
outerSequence = refreshCount
|
||||
},
|
||||
basicSource = basicExposureSource ?: arrayListOf(),
|
||||
source = listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${data.name}+${data.layoutChinese}+${data.id}"
|
||||
),
|
||||
ExposureSource("右侧卡片", homeSubSlide.id)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
cardCv.setExposureEventList(
|
||||
homeSubSlide.cardData.games.mapNotNull { gameEntity ->
|
||||
gameEntity.exposureEvent
|
||||
}
|
||||
)
|
||||
|
||||
countTv.isVisible = homeSubSlide.cardData.gameTotal.game > 3
|
||||
countTv.typeface = Typeface.createFromAsset(countTv.context.assets, Constants.DIN_FONT_PATH)
|
||||
countTv.text = "+${homeSubSlide.cardData.gameTotal.game - 3}"
|
||||
@ -408,17 +423,10 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
connect(textContainer.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
|
||||
connect(textContainer.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM)
|
||||
}.applyTo(cardContainer)
|
||||
listener.addGameExposureEvent(
|
||||
position,
|
||||
GameEntity(sequence = position, outerSequence = useCase.refreshCount),
|
||||
homeSubSlide.id
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
cardCv.setOnClickListener {
|
||||
|
||||
com.gh.common.util.NewFlatLogUtils.logRightSideCardClick(homeSubSlide, useCase.refreshCount, "卡片")
|
||||
listener.navigateToLinkPageInSubSlide(
|
||||
GameEntity(sequence = position, outerSequence = useCase.refreshCount),
|
||||
@ -481,12 +489,6 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
interface HomeSLideWithCardsEventListener {
|
||||
fun updateImmersiveColor(color: Int)
|
||||
|
||||
fun createEventWithSourceConcat(game: GameEntity, subSlideId: String)
|
||||
|
||||
fun createExposureEvent(actualPosition: Int, game: GameEntity?): ExposureEvent?
|
||||
|
||||
fun addGameExposureEvent(position: Int, game: GameEntity, subSlideId: String)
|
||||
|
||||
fun navigateToGameDetailPage(childPosition: Int, gameEntity: GameEntity, text: String, link: LinkEntity?)
|
||||
|
||||
fun navigateToLinkPageInSubSlide(game: GameEntity, homeSubSlide: HomeSubSlide, text: String)
|
||||
|
||||
@ -40,9 +40,7 @@ class CommonContentHorizontalSlideListUi(
|
||||
override fun onChildItemClick(childPosition: Int, item: CommonCollectionContentEntity) {
|
||||
listener.onChildItemClick(childPosition, item)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
fun bind(data: CustomPageData.CommonContentCollection) {
|
||||
@ -99,7 +97,6 @@ class CommonContentHorizontalSlideListUi(
|
||||
}
|
||||
|
||||
interface OnHorizontalSlideListListener {
|
||||
|
||||
fun addExposureEvent(childPosition: Int, link: ExposureLinkEntity)
|
||||
|
||||
fun onChildItemClick(childPosition: Int, entity: CommonCollectionContentEntity)
|
||||
|
||||
@ -24,16 +24,13 @@ class CommonContentNavigationUi(
|
||||
|
||||
private val adapter by lazy {
|
||||
CustomGameNavigationAdapter(context, object : CustomGameNavigationAdapter.OnEventListener {
|
||||
|
||||
override fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?) {
|
||||
listener.navigateToLinkPage(link, text, exposureEvent)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun bind(navigationList: List<GameNavigationEntity>?, trackEventList: List<ExposureEvent>?) {
|
||||
|
||||
if (binding.rvNavigation.adapter == null) {
|
||||
binding.rvNavigation.layoutManager = layoutManager
|
||||
binding.rvNavigation.addItemDecoration(GridSpacingItemDecoration(4, 8f.dip2px(), false, 16f.dip2px()))
|
||||
@ -42,14 +39,11 @@ class CommonContentNavigationUi(
|
||||
}
|
||||
|
||||
if (!navigationList.isNullOrEmpty()) {
|
||||
|
||||
adapter.setData(navigationList, trackEventList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface OnNavigationListener {
|
||||
|
||||
fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?)
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,6 @@ class CommonContentRecommendUi(
|
||||
override fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?) {
|
||||
listener.navigateToLinkPage(link, text, exposureEvent)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -59,7 +58,6 @@ class CommonContentRecommendUi(
|
||||
}
|
||||
binding.recommendGv.adapter = adapter
|
||||
adapter.submitList(filteredList, spanCount, exposureList)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@ -54,11 +54,8 @@ class RecommendCardUi(
|
||||
}
|
||||
|
||||
interface OnRecommendCardEventListener {
|
||||
|
||||
fun onItemClick(childPosition: Int, card: CustomPageData.RecommendCard)
|
||||
|
||||
fun onItemExposure(childPosition: Int, card: CustomPageData.RecommendCard)
|
||||
|
||||
fun onAllClick()
|
||||
}
|
||||
}
|
||||
@ -4,20 +4,25 @@ import android.view.View
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.databinding.LayoutTitleCustomBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PageLocation
|
||||
import com.gh.gamecenter.feature.exposure.ExposureConstants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.IGameChangedNotifier
|
||||
import com.gh.gamecenter.home.custom.OnViewHolderAttachListener
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.CustomPageItemChildEventHelper
|
||||
import com.gh.gamecenter.home.custom.eventlistener.GameSubjectCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.eventlistener.SubjectEventHelper
|
||||
@ -102,6 +107,33 @@ abstract class BaseCustomViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
fun fillExposureAndReportAd(gameEntity: GameEntity, sequence: Int, item: CustomPageItem) {
|
||||
if (item is CustomSplitSubjectItem || item is CustomSplitSubjectItem) {
|
||||
gameEntity.isAdData = item.data.adIconActive
|
||||
}
|
||||
|
||||
val exposureSource = ArrayList<ExposureSource>().apply {
|
||||
addAll(pageConfigure.exposureSourceList)
|
||||
if (item is CustomSplitSubjectItem || item is CustomSplitSubjectItem) {
|
||||
addAll(item.exposureSource)
|
||||
}
|
||||
}
|
||||
|
||||
gameEntity.exposureEvent = createExposureEvent(
|
||||
game = gameEntity,
|
||||
source = exposureSource,
|
||||
base = arrayListOf(),
|
||||
childPosition = sequence,
|
||||
position = item.componentPosition,
|
||||
customPageTrackData = createTrackData(item)
|
||||
)
|
||||
|
||||
if (gameEntity.adGroupId.isNotEmpty() && !gameEntity.isAdRequestReported) {
|
||||
AdHelper.reportAdRequest(gameEntity)
|
||||
gameEntity.isAdRequestReported = true
|
||||
}
|
||||
}
|
||||
|
||||
private val _title = TitleData()
|
||||
|
||||
// 专题标题
|
||||
@ -320,7 +352,6 @@ abstract class BaseCustomViewHolder(
|
||||
lavRefresh.setAnimation(if (DarkModeUtils.isDarkModeOn(root.context)) "lottie/icon_title_change_dark.json" else "lottie/icon_title_change_light.json")
|
||||
lavRefresh.progress = 0F
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter.home.custom.viewholder
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.databinding.RecyclerContentLabelLaneCustomBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
@ -10,6 +11,7 @@ import com.gh.gamecenter.home.custom.adapter.ContentLabelLaneAdapter
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.CommonContentCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomCommonContentCollectionItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData.CommonContentCollection.ContentTag
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
|
||||
/**
|
||||
@ -25,59 +27,59 @@ class ContentLabelLaneViewHolder(
|
||||
}
|
||||
|
||||
private val adapter by lazy {
|
||||
ContentLabelLaneAdapter(itemView.context,
|
||||
{ index, contentTag ->
|
||||
childEventHelper.navigateToLinkPage(
|
||||
contentTag.link,
|
||||
"内容标签泳道",
|
||||
_item.exposureEventList.getOrNull(index)
|
||||
)
|
||||
},
|
||||
{ index, contentTag ->
|
||||
|
||||
val item = _item as CustomCommonContentCollectionItem
|
||||
val gameEntity = if (contentTag.linkType == "game") {
|
||||
GameEntity(id = contentTag.linkId, name = contentTag.linkText)
|
||||
} else {
|
||||
GameEntity()
|
||||
}
|
||||
_item.exposureEventList.add(
|
||||
createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = index
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${item.data.name}+${item.data.layoutChinese}+${item.data.id}"
|
||||
),
|
||||
ExposureSource(
|
||||
item.data.layoutChinese,
|
||||
"${contentTag.title}+${contentTag.id}"
|
||||
)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
index,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
)
|
||||
)
|
||||
|
||||
})
|
||||
ContentLabelLaneAdapter(itemView.context) { index, contentTag ->
|
||||
childEventHelper.navigateToLinkPage(
|
||||
contentTag.link,
|
||||
"内容标签泳道",
|
||||
contentTag.exposureEvent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomCommonContentCollectionItem) {
|
||||
item.exposureEventList.clear()
|
||||
val contentTags = item.data.contentTags
|
||||
if (binding.rvGames.adapter == null) {
|
||||
binding.rvGames.layoutManager = LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false)
|
||||
binding.rvGames.adapter = adapter
|
||||
}
|
||||
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
fillExposureInfo(item.data.contentTags)
|
||||
}
|
||||
adapter.submitList(contentTags)
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillExposureInfo(contentTags: List<ContentTag>) {
|
||||
for ((index, contentTag) in contentTags.withIndex()) {
|
||||
val item = _item as CustomCommonContentCollectionItem
|
||||
val gameEntity = if (contentTag.linkType == "game") {
|
||||
GameEntity(id = contentTag.linkId, name = contentTag.linkText)
|
||||
} else {
|
||||
GameEntity()
|
||||
}
|
||||
contentTag.exposureEvent = createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = index
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${item.data.name}+${item.data.layoutChinese}+${item.data.id}"
|
||||
),
|
||||
ExposureSource(
|
||||
item.data.layoutChinese,
|
||||
"${contentTag.title}+${contentTag.id}"
|
||||
)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
index,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ package com.gh.gamecenter.home.custom.viewholder
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.databinding.RecyclerAnnouncementBannerBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.home.custom.BannerInRecyclerController
|
||||
@ -31,44 +31,13 @@ class CustomAnnouncementBannerViewHolder(
|
||||
childEventHelper.navigateToLinkPage(
|
||||
announcement.link,
|
||||
"公告横幅",
|
||||
_item.exposureEventList.getOrNull(childPosition)
|
||||
announcement.exposureEvent
|
||||
)
|
||||
}
|
||||
|
||||
override fun getCurrentPosition(): Int {
|
||||
return binding.vpBanner.currentItem
|
||||
}
|
||||
|
||||
override fun exposure(childPosition: Int, announcement: CustomPageData.Announcement) {
|
||||
val item = _item as CustomCommonContentCollectionItem
|
||||
val gameEntity = if (announcement.linkType == "game") {
|
||||
GameEntity(id = announcement.linkId, name = announcement.linkText)
|
||||
} else {
|
||||
GameEntity()
|
||||
}
|
||||
_item.exposureEventList.add(
|
||||
createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = childPosition
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${item.data.name}+${item.data.layoutChinese}+${item.data.id}"
|
||||
),
|
||||
ExposureSource(
|
||||
item.data.layoutChinese
|
||||
)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
childPosition,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -78,7 +47,6 @@ class CustomAnnouncementBannerViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override val childEventHelper by lazy {
|
||||
CommonContentCollectionEventHelper(viewModel)
|
||||
}
|
||||
@ -89,12 +57,10 @@ class CustomAnnouncementBannerViewHolder(
|
||||
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
_item.exposureEventList.clear()
|
||||
if (item is CustomCommonContentCollectionItem) {
|
||||
if (binding.vpBanner.adapter == null) {
|
||||
binding.vpBanner.adapter = adapter
|
||||
binding.vpBanner.registerOnPageChangeCallback(object : OnPageChangeCallback() {
|
||||
|
||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
|
||||
binding.bannerIndicator.onPageScrolled(adapter.getDataPosition(position), positionOffset)
|
||||
}
|
||||
@ -105,8 +71,12 @@ class CustomAnnouncementBannerViewHolder(
|
||||
bannerInRecyclerController.start()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
fillExposureInfo(item.data.announcements)
|
||||
}
|
||||
|
||||
adapter.submitList(item.data.announcements)
|
||||
if (item.selectedPosition != 0) {
|
||||
binding.vpBanner.setCurrentItem(item.selectedPosition, false)
|
||||
@ -118,6 +88,31 @@ class CustomAnnouncementBannerViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillExposureInfo(dataList: List<CustomPageData.Announcement>) {
|
||||
for ((index, announcement) in dataList.withIndex()) {
|
||||
val item = _item as CustomCommonContentCollectionItem
|
||||
val gameEntity = if (announcement.linkType == "game") {
|
||||
GameEntity(id = announcement.linkId, name = announcement.linkText)
|
||||
} else {
|
||||
GameEntity()
|
||||
}
|
||||
announcement.exposureEvent = createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = index
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource("通用内容合集", "${item.data.name}+${item.data.layoutChinese}+${item.data.id}"),
|
||||
ExposureSource(item.data.layoutChinese)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
index,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewAttach(parent: RecyclerView?) {
|
||||
bannerInRecyclerController.onViewAttachedToWindow(parent)
|
||||
}
|
||||
|
||||
@ -1,27 +1,20 @@
|
||||
package com.gh.gamecenter.home.custom.viewholder
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.exposure.ExposureTraceUtils
|
||||
import com.gh.common.util.NewLogUtils
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.CommonCollection12ItemCustomBinding
|
||||
import com.gh.gamecenter.databinding.CommonCollectionItemBinding
|
||||
import com.gh.gamecenter.entity.CommonCollectionContentEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.exposure.IExposureListProvider
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.CommonContentCollectionEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_VERTICAL_CARD
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT
|
||||
import com.gh.gamecenter.home.custom.model.CustomSplitCommonContentCollectionItem
|
||||
import com.gh.gamecenter.home.custom.ui.CommonContentCollection12Ui
|
||||
|
||||
@ -32,8 +25,9 @@ import com.gh.gamecenter.home.custom.ui.CommonContentCollection12Ui
|
||||
class CustomCommonCollection12ViewHolder(
|
||||
viewModel: CustomPageViewModel,
|
||||
val binding: CommonCollection12ItemCustomBinding
|
||||
) :
|
||||
BaseCustomViewHolder(viewModel, binding.root) {
|
||||
) : BaseCustomViewHolder(viewModel, binding.root), IExposureListProvider {
|
||||
|
||||
private var exposureEventList = arrayListOf<ExposureEvent>()
|
||||
|
||||
override val childEventHelper by lazy(LazyThreadSafetyMode.NONE) {
|
||||
CommonContentCollectionEventHelper(viewModel)
|
||||
@ -69,7 +63,7 @@ class CustomCommonCollection12ViewHolder(
|
||||
"板块",
|
||||
"blockData?.name"
|
||||
)
|
||||
item.exposureEventList.getOrNull(childPosition)?.let {
|
||||
linkEntity.exposureEvent?.let {
|
||||
val clickEvent = ExposureEvent(
|
||||
payload = it.payload,
|
||||
source = it.source,
|
||||
@ -83,45 +77,45 @@ class CustomCommonCollection12ViewHolder(
|
||||
childEventHelper.navigateToLinkPage(
|
||||
linkEntity,
|
||||
"内容卡片",
|
||||
item.exposureEventList.getOrNull(childPosition)
|
||||
linkEntity.exposureEvent
|
||||
)
|
||||
}
|
||||
|
||||
override fun navigateToCommonCollectionDetailPage(collection: CustomPageData.CommonContentCollection) {
|
||||
childEventHelper.navigateToCommonCollectionDetailPage(_item.link)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomSplitCommonContentCollectionItem) {
|
||||
|
||||
item.exposureEventList.clear()
|
||||
|
||||
val data = item.data.data
|
||||
val leftPosition = item.leftPosition
|
||||
addExposureEvent(leftPosition, data[leftPosition])
|
||||
val firstExposureEvent = addExposureEvent(leftPosition, data[leftPosition])
|
||||
firstExposureEvent?.let {
|
||||
exposureEventList.add(0, firstExposureEvent)
|
||||
}
|
||||
|
||||
val rightPosition = item.leftPosition + 1
|
||||
if (rightPosition < data.size) {
|
||||
addExposureEvent(rightPosition, data[rightPosition])
|
||||
val secondExposureEvent = addExposureEvent(rightPosition, data[rightPosition])
|
||||
secondExposureEvent?.let {
|
||||
exposureEventList.add(1, secondExposureEvent)
|
||||
}
|
||||
}
|
||||
item.isFirstLine
|
||||
collection12Ui.bind(item.data, item.leftPosition)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun addExposureEvent(childPosition: Int, contentEntity: CommonCollectionContentEntity) {
|
||||
private fun addExposureEvent(childPosition: Int, contentEntity: CommonCollectionContentEntity): ExposureEvent? {
|
||||
(_item as? CustomSplitCommonContentCollectionItem)?.let { item ->
|
||||
val gameEntity = if (contentEntity.linkEntity.type == "game") {
|
||||
GameEntity(id = contentEntity.linkEntity.link, name = contentEntity.linkEntity.text)
|
||||
} else {
|
||||
GameEntity()
|
||||
}
|
||||
val event = createExposureEvent(
|
||||
return createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = childPosition
|
||||
it.outerSequence = item.position
|
||||
@ -136,58 +130,14 @@ class CustomCommonCollection12ViewHolder(
|
||||
childPosition,
|
||||
item.componentPosition,
|
||||
createTrackData(item)
|
||||
|
||||
).also { contentEntity.linkEntity.exposureEvent = it }
|
||||
item.exposureEventList.add(event)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun bindSubView(
|
||||
contentEntity: CommonCollectionContentEntity,
|
||||
subBinding: CommonCollectionItemBinding,
|
||||
layout: Int,
|
||||
width: Int,
|
||||
height: Int,
|
||||
position: Int,
|
||||
clickClosure: (position: Int, contentEntity: CommonCollectionContentEntity) -> Unit
|
||||
) {
|
||||
subBinding.run {
|
||||
ImageUtils.display(commonCollectionImage, contentEntity.image)
|
||||
maskView.goneIf(layout == COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT || (contentEntity.title.isEmpty() && contentEntity.addedContent1.isNullOrEmpty()))
|
||||
titleTv.goneIf(layout == COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT) {
|
||||
titleTv.text = contentEntity.title
|
||||
}
|
||||
desTv.goneIf(layout != COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_VERTICAL_CARD) {
|
||||
desTv.text = contentEntity.addedContent1
|
||||
}
|
||||
linkTitleTv.goneIf(layout != COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT) {
|
||||
linkTitleTv.text = contentEntity.title
|
||||
}
|
||||
linkDes1.goneIf(layout != COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT) {
|
||||
linkDes1.text = contentEntity.addedContent1
|
||||
linkDes1.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(root.context))
|
||||
}
|
||||
linkDes2.goneIf(layout != COMMON_CONTENT_COLLECTION_LAYOUT_VERTICAL_IMAGE_TEXT) {
|
||||
linkDes2.text = contentEntity.addedContent2
|
||||
linkDes2.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(root.context))
|
||||
}
|
||||
|
||||
val maskHeight = if (layout == COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_VERTICAL_CARD) {
|
||||
60f.dip2px()
|
||||
} else {
|
||||
38f.dip2px()
|
||||
}
|
||||
val maskParams = maskView.layoutParams as ConstraintLayout.LayoutParams
|
||||
maskParams.height = maskHeight
|
||||
maskView.layoutParams = maskParams
|
||||
|
||||
val imageParams = commonCollectionImage.layoutParams as ConstraintLayout.LayoutParams
|
||||
imageParams.width = width
|
||||
imageParams.height = height
|
||||
commonCollectionImage.layoutParams = imageParams
|
||||
|
||||
root.setOnClickListener { clickClosure.invoke(position, contentEntity) }
|
||||
}
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
return exposureEventList
|
||||
}
|
||||
|
||||
}
|
||||
@ -31,7 +31,6 @@ class CustomCommonCollectionViewHolder(
|
||||
val binding: CommonCollectionListCustomBinding,
|
||||
) : BaseCustomViewHolder(viewModel, binding.root) {
|
||||
|
||||
|
||||
override val childEventHelper by lazy(LazyThreadSafetyMode.NONE) {
|
||||
CommonContentCollectionEventHelper(viewModel)
|
||||
}
|
||||
@ -43,26 +42,23 @@ class CustomCommonCollectionViewHolder(
|
||||
(_item as? CustomCommonContentCollectionItem)?.let { item ->
|
||||
val gameEntity =
|
||||
if (link.type == "game") GameEntity(id = link.link, name = link.text) else GameEntity()
|
||||
_item.exposureEventList.add(
|
||||
createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = childPosition
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${item.data.name}+${item.data.layoutChinese}+${item.data.id}"
|
||||
)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
childPosition,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
).also { link.exposureEvent = it }
|
||||
)
|
||||
createExposureEvent(
|
||||
gameEntity.also {
|
||||
it.sequence = childPosition
|
||||
it.outerSequence = _item.position
|
||||
},
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"通用内容合集",
|
||||
"${item.data.name}+${item.data.layoutChinese}+${item.data.id}"
|
||||
)
|
||||
),
|
||||
pageConfigure.exposureSourceList,
|
||||
childPosition,
|
||||
_item.componentPosition,
|
||||
createTrackData(item)
|
||||
).also { link.exposureEvent = it }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onChildItemClick(childPosition: Int, entity: CommonCollectionContentEntity) {
|
||||
@ -108,30 +104,25 @@ class CustomCommonCollectionViewHolder(
|
||||
childEventHelper.navigateToLinkPage(
|
||||
linkEntity,
|
||||
"内容卡片",
|
||||
(_item as CustomCommonContentCollectionItem).exposureEventList.getOrNull(childPosition)
|
||||
linkEntity.exposureEvent
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun navigateToCommonCollectionDetailPage(data: CustomPageData.CommonContentCollection) {
|
||||
childEventHelper.navigateToCommonCollectionDetailPage(_item.link)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomCommonContentCollectionItem) {
|
||||
item.exposureEventList.clear()
|
||||
horizontalSlideUi.bind(item.data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun setTitle(
|
||||
data: CustomPageData.CommonContentCollection,
|
||||
layoutTitle: LayoutTitleCustomBinding,
|
||||
|
||||
@ -11,9 +11,9 @@ import com.gh.gamecenter.databinding.GameDoubleCardItemAlCustomBinding
|
||||
import com.gh.gamecenter.databinding.GameDoubleCardItemCustomBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.IExposureListProvider
|
||||
import com.gh.gamecenter.feature.game.GameItemViewHolder
|
||||
import com.gh.gamecenter.home.custom.CustomPageViewModel
|
||||
import com.gh.gamecenter.home.custom.createExposureEvent
|
||||
import com.gh.gamecenter.home.custom.eventlistener.SubjectEventHelper
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomSplitSubjectItem
|
||||
@ -25,10 +25,13 @@ import com.gh.gamecenter.home.custom.model.CustomSplitSubjectItem
|
||||
class CustomDoubleCardViewHolder(
|
||||
viewModel: CustomPageViewModel,
|
||||
val binding: GameDoubleCardItemAlCustomBinding
|
||||
) : BaseCustomViewHolder(viewModel, binding.root) {
|
||||
) : BaseCustomViewHolder(viewModel, binding.root), IExposureListProvider {
|
||||
|
||||
private val mPosterWidth = (DisplayUtils.getScreenWidth() - 40F.dip2px()) / 2
|
||||
|
||||
private var leftBoundedGameEntity: GameEntity? = null
|
||||
private var rightBoundedGameEntity: GameEntity? = null
|
||||
|
||||
override val childEventHelper by lazy(LazyThreadSafetyMode.NONE) {
|
||||
SubjectEventHelper(viewModel)
|
||||
}
|
||||
@ -36,10 +39,11 @@ class CustomDoubleCardViewHolder(
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomSplitSubjectItem) {
|
||||
|
||||
val gameList = item.data.data ?: return
|
||||
|
||||
fillExposureList(item)
|
||||
runOnIoThread(isLightWeightTask = true) {
|
||||
fillExposureInfoAndReportAd(item)
|
||||
}
|
||||
|
||||
setSplitSubjectTitle(binding.layoutTitle, item, childEventHelper)
|
||||
|
||||
@ -59,16 +63,16 @@ class CustomDoubleCardViewHolder(
|
||||
itemView.layoutParams = it
|
||||
}
|
||||
|
||||
|
||||
val leftPosition = item.startChildPosition
|
||||
|
||||
val rightPosition = leftPosition + 1
|
||||
|
||||
val hasLeft = gameList.size > leftPosition
|
||||
if (hasLeft) {
|
||||
leftBoundedGameEntity = gameList[leftPosition]
|
||||
bindSubView(
|
||||
item,
|
||||
gameList[leftPosition],
|
||||
leftBoundedGameEntity!!,
|
||||
binding.leftCardView,
|
||||
leftPosition
|
||||
)
|
||||
@ -76,15 +80,16 @@ class CustomDoubleCardViewHolder(
|
||||
|
||||
val hasRight = gameList.size > rightPosition
|
||||
if (hasRight) {
|
||||
rightBoundedGameEntity = gameList[rightPosition]
|
||||
binding.rightCardView.posterCardView.visibility = View.VISIBLE
|
||||
bindSubView(
|
||||
item,
|
||||
gameList[rightPosition],
|
||||
rightBoundedGameEntity!!,
|
||||
binding.rightCardView,
|
||||
rightPosition
|
||||
)
|
||||
|
||||
} else {
|
||||
rightBoundedGameEntity = null
|
||||
binding.rightCardView.posterCardView.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
@ -121,24 +126,27 @@ class CustomDoubleCardViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillExposureList(item: CustomSplitSubjectItem) {
|
||||
val eventList = arrayListOf<ExposureEvent>()
|
||||
runOnIoThread(true) {
|
||||
for (i in item.startChildPosition..item.endChildPosition) {
|
||||
val game = item.data.data?.getOrNull(i) ?: break
|
||||
val event = createExposureEvent(
|
||||
game,
|
||||
item.exposureSource,
|
||||
pageConfigure.exposureSourceList,
|
||||
i,
|
||||
item.componentPosition,
|
||||
createTrackData(item)
|
||||
)
|
||||
game.exposureEvent = event
|
||||
eventList.add(event)
|
||||
}
|
||||
private fun fillExposureInfoAndReportAd(item: CustomSplitSubjectItem) {
|
||||
for (i in item.startChildPosition..item.endChildPosition) {
|
||||
val game = item.data.data?.getOrNull(i) ?: break
|
||||
|
||||
fillExposureAndReportAd(game, i, item)
|
||||
}
|
||||
item.exposureEventList = eventList
|
||||
}
|
||||
|
||||
override fun provideExposureDataList(): List<ExposureEvent>? {
|
||||
val gameEntityList = arrayListOf<GameEntity?>().apply {
|
||||
leftBoundedGameEntity?.let { add(leftBoundedGameEntity) }
|
||||
rightBoundedGameEntity?.let { add(rightBoundedGameEntity) }
|
||||
}
|
||||
|
||||
for (gameEntity in gameEntityList) {
|
||||
gameEntity?.exposureEvent?.getFreshExposureEvent()
|
||||
}
|
||||
|
||||
return gameEntityList.mapNotNull { it?.exposureEvent }
|
||||
}
|
||||
|
||||
override fun provideExposureData(): ExposureEvent? = null
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user