This commit is contained in:
juntao
2020-12-29 15:59:15 +08:00
parent ba3a06da43
commit dd4bf98f28
9 changed files with 26 additions and 18 deletions

View File

@ -8,7 +8,6 @@ import com.gh.common.util.toObject
import com.gh.gamecenter.entity.ApkEntity
import com.gh.gamecenter.entity.GameEntity
import com.halo.assistant.HaloApp
import java.util.*
object ExposureUtils {
@ -25,7 +24,8 @@ object ExposureUtils {
} else {
entity.id
}
gameEntity.gameVersion = entity.getApk().elementAtOrNull(0)?.version ?: gameEntity.gameVersion
gameEntity.gameVersion = entity.getApk().elementAtOrNull(0)?.version
?: gameEntity.gameVersion
gameEntity.platform = platform
gameEntity.downloadType = downloadType.toString()
val exposureEvent = ExposureEvent.createEvent(gameEntity = gameEntity,
@ -90,6 +90,15 @@ object ExposureUtils {
}
}
@JvmStatic
fun updateExposureSequence(gameList: List<GameEntity>?) {
gameList?.let {
for ((index, game) in it.withIndex()) {
game.sequence = index
}
}
}
enum class DownloadType {
DOWNLOAD,

View File

@ -94,8 +94,6 @@ class NewCatalogListAdapter(context: Context,
GameViewUtils.setLabelList(mContext, holder.binding.labelList, gameEntity.tagStyle)
gameEntity.sequence = position
val sortType = mViewModel.sortType.value
val sortSize = mViewModel.sortSize.text
val toolbarTitle = mViewModel.title
@ -105,7 +103,6 @@ class NewCatalogListAdapter(context: Context,
exposureSources.add(mBaseExposureSource)
exposureSources.add(ExposureSource(toolbarTitle))
exposureSources.add(ExposureSource("二级分类详情", "$selectedCatalogName+$sortType+$sortSize"))
gameEntity.sequence = position
val event = ExposureEvent.createEvent(gameEntity, exposureSources, null, ExposureType.EXPOSURE)
mExposureEventSparseArray.put(position, event)

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.catalog
import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.gh.common.exposure.ExposureUtils
import com.gh.common.util.UrlFilterUtils
import com.gh.common.view.CatalogFilterView
import com.gh.gamecenter.baselist.ListViewModel
@ -35,7 +36,10 @@ class NewCatalogListViewModel(application: Application) : ListViewModel<GameEnti
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
mResultLiveData.addSource(mListLiveData) {
ExposureUtils.updateExposureSequence(it)
mResultLiveData.postValue(it)
}
}
fun updateSortConfig(sortSize: SubjectSettingEntity.Size? = null,

View File

@ -89,8 +89,6 @@ class NewCategoryListAdapter(context: Context,
val padTop = if (position == 0) 16F.dip2px() else 8F.dip2px()
holder.itemView.setPadding(16F.dip2px(), padTop, 16F.dip2px(), 8F.dip2px())
gameEntity.sequence = position
val sortType = if ("download:-1" == mViewModel.getSortType()) "最热" else "最新"
val toolbarTitle = mViewModel.title
val categoryTitle = mViewModel.categoryTitle
@ -99,7 +97,6 @@ class NewCategoryListAdapter(context: Context,
val exposureSources = ArrayList<ExposureSource>()
exposureSources.add(ExposureSource(categoryTitle, selectedCategoryName))
exposureSources.add(ExposureSource("二级分类", "$selectedCategoryName+$sortType"))
gameEntity.sequence = position
val event = ExposureEvent.createEvent(gameEntity, exposureSources, null, ExposureType.EXPOSURE)
mExposureEventSparseArray.put(position, event)

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.category
import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.gh.common.exposure.ExposureUtils
import com.gh.common.util.UrlFilterUtils
import com.gh.common.view.ConfigFilterView
import com.gh.gamecenter.baselist.ListViewModel
@ -36,7 +37,10 @@ class NewCategoryListViewModel(application: Application)
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
mResultLiveData.addSource(mListLiveData) {
ExposureUtils.updateExposureSequence(it)
mResultLiveData.postValue(it)
}
}
fun changeSelectedCategory(category: CategoryEntity) {

View File

@ -14,7 +14,7 @@ data class CommentEntity(@SerializedName("_id")
@SerializedName("parent_user")
var parentUser: CommentParentEntity? = null,
var content: String? = null,
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_VOTE, SyncFieldConstants.ARTICLE_COMMENT_VOTE_COUNT])
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_VOTE_COUNT])
var vote: Int = 0,
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_REPLY_COUNT])
var reply: Int = 0,

View File

@ -390,7 +390,6 @@ public class GameServersContentAdapter extends BaseRecyclerAdapter implements IE
sb.append("今日开测");
} else if ("after".equals(mDay)) {
sb.append("后续开测");
sb.append(mType);
} else if ("tomorrow".equals(mDay)) {
sb.append("明日开测");
} else {

View File

@ -3,6 +3,7 @@ package com.gh.gamecenter.subject
import android.app.Application
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.gh.common.exposure.ExposureUtils
import com.gh.gamecenter.baselist.ListViewModel
import com.gh.gamecenter.baselist.LoadStatus
import com.gh.gamecenter.baselist.LoadType
@ -35,9 +36,7 @@ class SubjectListViewModel(application: Application,
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) {
for ((index, game) in it.withIndex()) {
game.sequence = index
}
ExposureUtils.updateExposureSequence(it)
mResultLiveData.postValue(it)
}
}

View File

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureUtils
import com.gh.common.util.UrlFilterUtils
import com.gh.common.view.ConfigFilterView
import com.gh.gamecenter.baselist.ListViewModel
@ -42,9 +43,7 @@ class TagsListViewModel(application: Application) : ListViewModel<GameEntity, Ga
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) {
for ((index, game) in it.withIndex()) {
game.sequence = index
}
ExposureUtils.updateExposureSequence(it)
mResultLiveData.postValue(it)
}
}