完成光环前端优化汇总(12月)(1,2,4,6) https://git.ghzs.com/pm/halo-app-issues/-/issues/1098

This commit is contained in:
juntao
2020-12-22 11:02:50 +08:00
parent 1b8dc6eba0
commit fc907a398f
7 changed files with 24 additions and 8 deletions

View File

@ -138,7 +138,7 @@ object ExposureManager {
return log
}
internal class FixedSizeLinkedHashSet<T>(var maxSize: Int) : LinkedHashSet<T>() {
class FixedSizeLinkedHashSet<T>(var maxSize: Int) : LinkedHashSet<T>() {
override fun add(element: T): Boolean {
if (size == maxSize) {
pop()

View File

@ -12,6 +12,8 @@ import java.util.*
object ExposureUtils {
private val mDownloadCompleteTraceEventIdSet = ExposureManager.FixedSizeLinkedHashSet<String>(3)
@JvmStatic
fun logADownloadExposureEvent(entity: GameEntity,
platform: String?,
@ -45,6 +47,14 @@ object ExposureUtils {
gameEntity.platform = platform
gameEntity.downloadCompleteType = downloadType.toString()
val traceEvent = trace?.toObject<ExposureEvent>()
// 避免生成 trace 相同的下载完成事件,根据日志看下载完成的同一秒有可能生成两条
if (mDownloadCompleteTraceEventIdSet.contains(traceEvent?.id)) {
return
}
traceEvent?.payload?.gameId?.let { mDownloadCompleteTraceEventIdSet.add(it) }
val exposureEvent = ExposureEvent.createEvent(gameEntity = gameEntity,
source = traceEvent?.source ?: ArrayList(),
eTrace = ExposureTraceUtils.appendTrace(traceEvent),

View File

@ -252,12 +252,15 @@ data class GameEntity(
@IgnoredOnParcel
var exposureEvent: ExposureEvent? = null
@IgnoredOnParcel
var shouldShowNameSuffix = true // 专题级开关,只要这个开关为 false实体有 suffix 也不显示
@IgnoredOnParcel
var name: String?
get() = if (shouldUseMirrorInfo()) {
mirrorData?.mName?.removeSuffix(".") + mirrorData?.nameSuffix
mirrorData?.mName?.removeSuffix(".") + if (shouldShowNameSuffix) mirrorData?.nameSuffix ?: "" else ""
} else {
mName?.removeSuffix(".") + nameSuffix
mName?.removeSuffix(".") + if (shouldShowNameSuffix) nameSuffix else ""
}
set(value) {
mName = value

View File

@ -847,9 +847,9 @@ class GameDetailFragment : NormalFragment() {
// GdtHelper.logAction(ActionType.SHARE, GdtHelper.CONTENT_TYPE, "GAME", GdtHelper.CONTENT_ID, mGameEntity!!.id)
val url = if (isPublishEnv()) {
"http://m.ghzs666.com/game/" + it.shareCode
"http://m.ghzs666.com/game/" + mGameEntity?.id
} else {
"https://static-web.ghzs.com/gamestats-dev/index.html#/game/" + it.shareCode
"https://static-web.ghzs.com/gamestats-dev/index.html#/game/" + mGameEntity?.id
}
if (activity is BaseActivity) {

View File

@ -334,11 +334,13 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
homeContent.linkColumn?.data = RegionSettingHelper.filterGame(homeContent.linkColumn?.data)
// 替换已安装的游戏
homeContent.linkColumn?.let { subjectEntity ->
subjectEntity.data?.let { data ->
// 这个 for 循环主要功能是用来标识替换已安装的游戏
for (game in data) {
mSubjectGameIdList.add(game.id)
// 应用专题是否显示游戏名后缀的配置
game.shouldShowNameSuffix = subjectEntity.showSuffix
}
subjectEntity.relatedColumnId?.let {

View File

@ -98,7 +98,7 @@ class SubjectAdapter(context: Context,
val gameEntity = mEntityList[position]
holder.binding.game = gameEntity
holder.binding.briefStyle = subjectData.briefStyle
holder.binding.isShowSuffix = subjectData.showSuffix
holder.binding.isShowSuffix = true // 专题详情均显示游戏后缀 https://git.ghzs.com/pm/halo-app-issues/-/issues/1098 (3)
holder.initServerType(gameEntity)
holder.binding.executePendingBindings()

View File

@ -57,7 +57,7 @@
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent" />
<com.facebook.drawee.view.SimpleDraweeView
<com.gh.common.view.WrapContentDraweeView
android:id="@+id/linkImageIv"
goneIf="@{TextUtils.isEmpty(customColumn.nameLink.image)}"
imageUrl="@{customColumn.nameLink.image}"
@ -74,6 +74,7 @@
app:placeholderImageScaleType="fitXY"
app:roundedCornerRadius="5dp"
app:viewAspectRatio="2"
tools:viewAspectRatio="2"
tools:layout_width="match_parent"
tools:visibility="visible" />