diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2067739080..767e60c385 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -754,7 +754,7 @@ android:screenOrientation="portrait" /> diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index a55f843594..20d3099d37 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -37,6 +37,7 @@ import com.gh.gamecenter.core.runOnIoThread import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.discovery.DiscoveryActivity import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE +import com.gh.gamecenter.entity.GameCollectionListEntity import com.gh.gamecenter.entity.SubjectData import com.gh.gamecenter.entity.SubjectRecommendEntity import com.gh.gamecenter.entity.VideoLinkEntity @@ -58,6 +59,7 @@ import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActi import com.gh.gamecenter.game.upload.GameSubmissionActivity import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity +import com.gh.gamecenter.gamecollection.hotlist.GameCollectionListDetailActivity import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity import com.gh.gamecenter.gamedetail.GameDetailFragment import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity @@ -154,7 +156,8 @@ object DirectUtils { "bbs_video", "explore_column", "game_explore", - "column_test_v2" + "column_test_v2", + "game_list_collection" ) fun directToLinkPage( @@ -444,6 +447,14 @@ object DirectUtils { "qq_mini_game_column" -> directToQGameHome(context) + "game_list_collection" -> directToGameCollectionListDetail( + context, + linkEntity.link ?: "", + linkEntity.text ?: "", + linkEntity.explain, + entrance + ) + "" -> { // do nothing } @@ -2101,4 +2112,22 @@ object DirectUtils { .withInt(BaseActivity_TabLayout.PAGE_INDEX, defaultTabIndex) .navigation() } + + // 跳转游戏单合集详情 + @JvmStatic + fun directToGameCollectionListDetail( + context: Context, + collectionId: String, + collectionName: String, + explain: String, + entrance: String = "" + ) { + context.startActivity( + GameCollectionListDetailActivity.getIntent( + context, + GameCollectionListEntity(id = collectionId, name = collectionName, explain = explain), + entrance + ) + ) + } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt b/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt index 96dabe869d..54ccc0558a 100644 --- a/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt +++ b/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt @@ -2327,7 +2327,10 @@ object NewFlatLogUtils { blockId: String, collectionName: String, collectionId: String, - text: String + text: String, + linkType: String = "", + linkId: String = "", + linkText: String = "" ) { val json = json { KEY_EVENT to "game_list_collection_click" @@ -2337,6 +2340,9 @@ object NewFlatLogUtils { "game_list_collection_id" to collectionId "game_list_collection_name" to collectionName "text" to text + "link_type" to linkType + "link_id" to linkId + "link_text" to linkText parseAndPutMeta().invoke(this) } log(json) diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt index 81f0a00fa7..fb48bb1f97 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameHeadViewHolder.kt @@ -2,11 +2,11 @@ package com.gh.gamecenter.adapter.viewholder import android.view.View import android.view.ViewGroup +import com.gh.gamecenter.R import com.gh.gamecenter.common.base.BaseRecyclerViewHolder import com.gh.gamecenter.common.utils.dip2px -import com.gh.gamecenter.common.utils.toColor -import com.gh.gamecenter.R import com.gh.gamecenter.common.utils.goneIf +import com.gh.gamecenter.common.utils.toColor import com.gh.gamecenter.databinding.GameHeadItemBinding import com.gh.gamecenter.entity.SubjectEntity @@ -31,12 +31,11 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) : binding.arrowIv.visibility = View.GONE val text = if ("change" == subject.home) { "换一批" - } else if (subject.type == "game_list_collection" && subject.style?.contains("slide") == true) { - "游戏单广场" } else { when (subject.home) { "more" -> "更多" "hide" -> "" + "game_list_square" -> "游戏单广场" else -> "全部" } } diff --git a/app/src/main/java/com/gh/gamecenter/entity/GameCollectionPlayerCreationEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/GameCollectionPlayerCreationEntity.kt index 3e198d95cb..9ebfae8aeb 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/GameCollectionPlayerCreationEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/GameCollectionPlayerCreationEntity.kt @@ -13,10 +13,11 @@ data class GameCollectionPlayerCreationEntity( ) @Parcelize -data class GameCollectionHotListTab( +data class GameCollectionListEntity( @SerializedName("_id") val id: String = "", val name: String = "", + val explain: String = "", var position: Int = -1 ) : Parcelable diff --git a/app/src/main/java/com/gh/gamecenter/entity/HomeContent.kt b/app/src/main/java/com/gh/gamecenter/entity/HomeContent.kt index 4291792c99..5a2a1332a5 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/HomeContent.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/HomeContent.kt @@ -1,5 +1,6 @@ package com.gh.gamecenter.entity +import com.gh.gamecenter.common.entity.LinkEntity import com.gh.gamecenter.feature.entity.GameEntity import com.google.gson.annotations.SerializedName @@ -36,4 +37,8 @@ data class HomeContent( @SerializedName("ad_icon_active") val adIconActive: Boolean = false, var style: String = "", + var home: String = "", + @SerializedName("more_link") + var moreLink: LinkEntity? = null, + var explain: String = "", // 游戏单合集说明 ) \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/entity/SubjectEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/SubjectEntity.kt index 71dd7e8dc6..02b7c6462c 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/SubjectEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/SubjectEntity.kt @@ -99,7 +99,9 @@ data class SubjectEntity( var outerSequence: Int = -1, @SerializedName("is_qq_column") - var isQQColumn: Boolean = false + var isQQColumn: Boolean = false, + + var explain: String = "" // 游戏单合集说明 ) : Parcelable { @IgnoredOnParcel diff --git a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt index 8387e6b074..73cbd832ea 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameFragmentAdapter.kt @@ -1286,6 +1286,7 @@ class GameFragmentAdapter( val buttonType = when (column.home) { "change" -> "换一批" "more" -> "更多" + "game_list_square" -> "游戏单广场" else -> "全部" } val moreLink = column.moreLink @@ -1301,12 +1302,62 @@ class GameFragmentAdapter( } "more" -> { + if (column.type == "game_list_collection") { + NewFlatLogUtils.logGameListCollectionClick( + "版块内容列表", + mViewModel.blockData?.text ?: "", + mViewModel.blockData?.link ?: "", + column.name ?: "", + column.id ?: "", + "更多", + column.moreLink?.type ?: "", + column.moreLink?.link ?: "", + column.moreLink?.text ?: "" + ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "版块" + "block_name" to mViewModel.blockData?.text + "block_id" to mViewModel.blockData?.link + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "更多" + "link_type" to column.moreLink?.type + "link_id" to column.moreLink?.link + "link_text" to column.moreLink?.text + }) + } setPageSwitchData() column.moreLink?.let { link -> DirectUtils.directToLinkPage(it.context, link, "(板块)", "(游戏-专题:" + column.name + "-全部)") } } + "game_list_square" -> { + NewFlatLogUtils.logGameListCollectionClick( + "版块内容列表", + mViewModel.blockData?.name ?: "", + mViewModel.blockData?.link ?: "", + column.name ?: "", + column.id ?: "", + "游戏单广场" + ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "版块" + "block_name" to mViewModel.blockData?.text + "block_id" to mViewModel.blockData?.link + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "游戏单广场" + }) + DirectUtils.directToGameCollectionSquare( + mContext, + "版块内容列表", + mViewModel.blockData?.name ?: "", + collectionName = column.name ?: "", + collectionId = column.id ?: "" + ) + } + else -> { setPageSwitchData() when (column.type) { @@ -1378,28 +1429,12 @@ class GameFragmentAdapter( } "game_list_collection" -> { - NewFlatLogUtils.logGameListCollectionClick( - "版块内容列表", - mViewModel.blockData?.name ?: "", - mViewModel.blockData?.link ?: "", - column.name ?: "", - column.id ?: "", - "游戏单广场" - ) - SensorsBridge.trackEvent("GameListCollectionClick", json { - "location" to "版块" - "block_name" to mViewModel.blockData?.text - "block_id" to mViewModel.blockData?.link - "game_list_collection_name" to column.name - "game_list_collection_id" to column.id - "text" to "游戏单广场" - }) - DirectUtils.directToGameCollectionSquare( + DirectUtils.directToGameCollectionListDetail( mContext, - "版块内容列表", - mViewModel.blockData?.name ?: "", - collectionName = column.name ?: "", - collectionId = column.id ?: "" + column.id ?: "", + column.name ?: "", + column.explain, + "版块内容列表" ) } diff --git a/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt b/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt index eca653ad15..c9a74fae4f 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt @@ -1033,7 +1033,10 @@ class GameViewModel(application: Application, override var blockData: SubjectRec type = subjectEntity.type, name = subjectEntity.name, adIconActive = subjectEntity.adIconActive, - style = subjectEntity.style + style = subjectEntity.style, + home = subjectEntity.home ?: "", + moreLink = subjectEntity.moreLink, + explain = subjectEntity.explain ) mItemDataListCache.add(head) } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt index 32b854bbea..21cbb151cb 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListAdapter.kt @@ -2,6 +2,7 @@ package com.gh.gamecenter.gamecollection.hotlist import android.content.Context import android.graphics.Typeface +import android.view.View import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat @@ -23,56 +24,63 @@ import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.common.viewholder.FooterViewHolder import com.gh.gamecenter.core.utils.DisplayUtils import com.gh.gamecenter.databinding.ItemGameCollectionHotListBinding -import com.gh.gamecenter.entity.GameCollectionHotListTab -import com.gh.gamecenter.feature.entity.GameEntity +import com.gh.gamecenter.entity.GameCollectionListEntity import com.gh.gamecenter.feature.exposure.ExposureEvent import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData class GameCollectionHotListAdapter( context: Context, private val mPosition: Int, - private val mTabEntity: GameCollectionHotListTab? = null, + private val mGameCollectionListEntity: GameCollectionListEntity? = null, private val mViewModel: GameCollectionHotListViewModel, + private val mIsFromDetail: Boolean = false, private val mEntrance: String, private val mPath: String, private val mBasicExposureSource: List ) : ListAdapter(context), IExposable { private val mCoverWidth = (DisplayUtils.getScreenWidth() - 40F.dip2px()) / 2 override fun getItemViewType(position: Int): Int { - return if (position == itemCount - 1) ItemViewType.ITEM_FOOTER else ItemViewType.ITEM_BODY + return if (isShowHeaderItem() && position == 0) ItemViewType.ITEM_HEADER else if (position == itemCount - 1) ItemViewType.ITEM_FOOTER else ItemViewType.ITEM_BODY } + private fun isShowHeaderItem() = !mGameCollectionListEntity?.explain.isNullOrEmpty() + + private fun getHeaderItemCount() = if (mGameCollectionListEntity?.explain.isNullOrEmpty()) 0 else 1 + + private fun getRealPosition(position: Int) = position - getHeaderItemCount() + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return if (viewType == ItemViewType.ITEM_FOOTER) { - FooterViewHolder( - mLayoutInflater.inflate( - R.layout.refresh_footerview, - parent, - false + return when (viewType) { + ItemViewType.ITEM_FOOTER -> + FooterViewHolder( + mLayoutInflater.inflate( + R.layout.refresh_footerview, + parent, + false + ) ) + + ItemViewType.ITEM_HEADER -> GameCollectionPlayerCreationAdapter.GameCollectionPlayerCreationHeaderItemViewHolder( + parent.toBinding() ) - } else { - GameCollectionHotListItemViewHolder(parent.toBinding()) + + else -> GameCollectionHotListItemViewHolder(parent.toBinding()) } } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { - if (holder is GameCollectionHotListItemViewHolder) { - val itemData = mEntityList[position] - itemData.exposureEvent = ExposureEvent.createEventWithSourceConcat( - GameEntity().apply { - outerSequence = mTabEntity?.position - sequence = position - }, - mBasicExposureSource, - listOf( - ExposureSource( - "游戏单", - "${itemData.gameCollectionItem?.title} + ${itemData.gameCollectionItem?.id}" - ) - ) - ) + if (holder is GameCollectionPlayerCreationAdapter.GameCollectionPlayerCreationHeaderItemViewHolder) { + holder.binding.run { + root.setPadding(0, if (mIsFromDetail) 16F.dip2px() else 0, 0, 12F.dip2px()) + tipsIv.visibility = View.GONE + tipsTv.text = mGameCollectionListEntity?.explain + tipsTv.setTextColor(R.color.text_subtitleDesc.toColor(mContext)) + } + } + if (holder is GameCollectionHotListItemViewHolder) { + val realPosition = getRealPosition(position) + val itemData = mEntityList[realPosition] val entity = itemData.gameCollectionItem holder.binding.run { root.background = R.drawable.background_shape_white_radius_8.toDrawable(mContext) @@ -80,18 +88,18 @@ class GameCollectionHotListAdapter( userTv.setTextColor(R.color.text_subtitle.toColor(mContext)) gameCountTv.setTextColor(R.color.text_subtitleDesc.toColor(mContext)) - rankIv.goneIf(position > 2) { + rankIv.goneIf(realPosition > 2 || mIsFromDetail) { rankIv.setImageResource( - when (position) { + when (realPosition) { 0 -> R.drawable.icon_leaderboard_1 1 -> R.drawable.icon_leaderboard_2 else -> R.drawable.icon_leaderboard_3 } ) } - rankTv.goneIf(position < 3) { + rankTv.goneIf(realPosition < 3 || mIsFromDetail) { rankTv.typeface = Typeface.createFromAsset(mContext.assets, "fonts/d_din_bold_only_number.ttf") - rankTv.text = "${position + 1}" + rankTv.text = "${realPosition + 1}" } stampIv.goneIf(entity?.stamp.isNullOrEmpty()) stampIv.setBackgroundResource(if (entity?.stamp == "official") R.drawable.label_game_collection_official else R.drawable.label_game_collection_special_choice) @@ -103,23 +111,39 @@ class GameCollectionHotListAdapter( val gameIcons = arrayListOf(gameImage1, gameImage2, gameImage3) val games = entity?.games ?: arrayListOf() + val exposureEventList = arrayListOf() gameIcons.forEachIndexed { index, gameIcon -> gameIcon.goneIf(games.size < index + 1) { val gameEntity = games[index].toGameEntity() + val exposureEvent = ExposureEvent.createEventWithSourceConcat( + gameEntity.apply { + outerSequence = mGameCollectionListEntity?.position + sequence = realPosition + }, + mBasicExposureSource, + listOf( + ExposureSource( + "游戏单", + "${itemData.gameCollectionItem?.title} + ${itemData.gameCollectionItem?.id}" + ) + ) + ) + exposureEventList.add(exposureEvent) + gameIcon.displayGameIcon(gameEntity) gameIcon.setBorderColor(R.color.background_white) gameIcon.setOnClickListener { NewFlatLogUtils.logGameCollectionHotListClick( - mTabEntity?.name ?: "", - mTabEntity?.id ?: "", - mTabEntity?.name ?: "", + mGameCollectionListEntity?.name ?: "", + mGameCollectionListEntity?.id ?: "", + mGameCollectionListEntity?.name ?: "", "游戏" ) SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { "position" to mPosition - "tab_content" to mTabEntity?.name - "game_list_collection_name" to mTabEntity?.name - "game_list_collection_id" to mTabEntity?.id + "tab_content" to mGameCollectionListEntity?.name + "game_list_collection_name" to mGameCollectionListEntity?.name + "game_list_collection_id" to mGameCollectionListEntity?.id "text" to "游戏" "game_name" to gameEntity.name "game_id" to gameEntity.id @@ -128,11 +152,12 @@ class GameCollectionHotListAdapter( mContext, gameEntity.id, BaseActivity.mergeEntranceAndPath(mEntrance, mPath), - itemData.exposureEvent + exposureEvent ) } } } + itemData.exposureEventList = exposureEventList gameCountTv.goneIf(games.isEmpty()) titleTv.maxLines = if (games.isEmpty()) 2 else 1 titleTv.layoutParams = (titleTv.layoutParams as ConstraintLayout.LayoutParams).apply { @@ -142,16 +167,16 @@ class GameCollectionHotListAdapter( listOf(userIv, userTv).forEach { it.setOnClickListener { NewFlatLogUtils.logGameCollectionHotListClick( - mTabEntity?.name ?: "", - mTabEntity?.id ?: "", - mTabEntity?.name ?: "", + mGameCollectionListEntity?.name ?: "", + mGameCollectionListEntity?.id ?: "", + mGameCollectionListEntity?.name ?: "", "个人主页" ) SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { "position" to mPosition - "tab_content" to mTabEntity?.name - "game_list_collection_name" to mTabEntity?.name - "game_list_collection_id" to mTabEntity?.id + "tab_content" to mGameCollectionListEntity?.name + "game_list_collection_name" to mGameCollectionListEntity?.name + "game_list_collection_id" to mGameCollectionListEntity?.id "text" to "个人主页" "mongold_id" to entity?.user?.id }) @@ -160,16 +185,16 @@ class GameCollectionHotListAdapter( } root.setOnClickListener { NewFlatLogUtils.logGameCollectionHotListClick( - mTabEntity?.name ?: "", - mTabEntity?.id ?: "", - mTabEntity?.name ?: "", + mGameCollectionListEntity?.name ?: "", + mGameCollectionListEntity?.id ?: "", + mGameCollectionListEntity?.name ?: "", "游戏单" ) SensorsBridge.trackEvent("ViewGameCollectHotRankTabClick", json { "position" to mPosition - "tab_content" to mTabEntity?.name - "game_list_collection_name" to mTabEntity?.name - "game_list_collection_id" to mTabEntity?.id + "tab_content" to mGameCollectionListEntity?.name + "game_list_collection_name" to mGameCollectionListEntity?.name + "game_list_collection_id" to mGameCollectionListEntity?.id "text" to "游戏单" "game_collect_title" to entity?.title "game_collect_id" to entity?.id @@ -179,7 +204,16 @@ class GameCollectionHotListAdapter( entity?.id ?: "", mEntrance, mPath, - itemData.exposureEvent + ExposureEvent.createEventWithSourceConcat( + null, + mBasicExposureSource, + listOf( + ExposureSource( + "游戏单", + "${itemData.gameCollectionItem?.title} + ${itemData.gameCollectionItem?.id}" + ) + ) + ) ) } } @@ -195,14 +229,23 @@ class GameCollectionHotListAdapter( } } - override fun getItemCount(): Int = if (mEntityList.isNotEmpty()) mEntityList.size + 1 else 0 + override fun getItemCount(): Int = + if (mEntityList.isNotEmpty()) mEntityList.size + FOOTER_ITEM_COUNT + getHeaderItemCount() else 0 override fun getEventByPosition(pos: Int): ExposureEvent? { - return mEntityList[pos].exposureEvent + return if (getRealPosition(pos) in 0 until mEntityList.size) { + mEntityList[pos].exposureEvent + } else { + null + } } override fun getEventListByPosition(pos: Int): List? { - return mEntityList[pos].exposureEventList + return if (getRealPosition(pos) in 0 until mEntityList.size) { + mEntityList[pos].exposureEventList + } else { + null + } } override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { @@ -211,7 +254,7 @@ class GameCollectionHotListAdapter( if (layoutManager is GridLayoutManager) { layoutManager.spanSizeLookup = object : SpanSizeLookup() { override fun getSpanSize(position: Int): Int { - if (getItemViewType(position) == ItemViewType.ITEM_FOOTER) { + if (getItemViewType(position) == ItemViewType.ITEM_FOOTER || getItemViewType(position) == ItemViewType.ITEM_HEADER) { return layoutManager.spanCount } return 1 diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt index 8a046f301b..f2667e7340 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListFragment.kt @@ -17,7 +17,7 @@ import com.gh.gamecenter.common.utils.viewModelProvider import com.gh.gamecenter.common.view.FixGridLayoutManager import com.gh.gamecenter.common.view.GridSpacingItemDecoration import com.gh.gamecenter.core.utils.TimeElapsedHelper -import com.gh.gamecenter.entity.GameCollectionHotListTab +import com.gh.gamecenter.entity.GameCollectionListEntity import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData class GameCollectionHotListFragment : ListFragment() { @@ -25,9 +25,9 @@ class GameCollectionHotListFragment : ListFragment= 3) { NewFlatLogUtils.logGameCollectionHotListTabView( mElapsedHelper.elapsedTime, - mTabEntity?.name ?: "", - mTabEntity?.id ?: "", - mTabEntity?.name ?: "" + mGameCollectionListEntity?.name ?: "", + mGameCollectionListEntity?.id ?: "", + mGameCollectionListEntity?.name ?: "" ) SensorsBridge.trackEvent("ViewGameCollectHotRankTab", json { "stay_length" to mElapsedHelper.elapsedTime "position" to mPosition - "tab_content" to mTabEntity?.name - "game_list_collection_name" to mTabEntity?.name - "game_list_collection_id" to mTabEntity?.id + "tab_content" to mGameCollectionListEntity?.name + "game_list_collection_name" to mGameCollectionListEntity?.name + "game_list_collection_id" to mGameCollectionListEntity?.id }) } } @@ -103,17 +117,15 @@ class GameCollectionHotListFragment : ListFragment?) { - if (ts != null) { - if (mIsLoadDone) { - super.onChanged(ts) - } - mIsLoadDone = true + if (ts != null && mCanShowList) { + super.onChanged(ts) } } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperFragment.kt index ce29e0f087..90529ba15d 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperFragment.kt @@ -18,7 +18,7 @@ import com.gh.gamecenter.common.json.json import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.utils.DisplayUtils import com.gh.gamecenter.databinding.FragmentGameCollectionHotListWrapperBinding -import com.gh.gamecenter.entity.GameCollectionHotListTab +import com.gh.gamecenter.entity.GameCollectionListEntity import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator import kotlin.math.abs @@ -28,7 +28,7 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { private lateinit var mBinding: FragmentGameCollectionHotListWrapperBinding private lateinit var mViewModel: GameCollectionHotListWrapperViewModel - private val mTabEntityList = arrayListOf() + private val mTabEntityList = arrayListOf() private var mAdapter: FragmentStateAdapter? = null @@ -55,7 +55,7 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { mViewModel.hotListTabListLiveData.observe(this) { if (it != null) { mTabEntityList.clear() - mTabEntityList.add(GameCollectionHotListTab(name = PLAYER_CREATION_TAB_NAME, position = 0)) + mTabEntityList.add(GameCollectionListEntity(name = PLAYER_CREATION_TAB_NAME, position = 0)) mTabEntityList.addAll(it) initViewPager() @@ -76,6 +76,8 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { override fun initRealView() { super.initRealView() + DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && mIsCollapsed) + changeToolbarStyle(mIsCollapsed) mBinding.run { ViewCompat.setOnApplyWindowInsetsListener(appbar) { _, insets -> (toolbar.layoutParams as ViewGroup.MarginLayoutParams).topMargin = @@ -88,21 +90,15 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { collapsingToolbar.scrimVisibleHeightTrigger = collapsingTrigger collapsingToolbar.scrimShownAction = { - mIsCollapsed = it - DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && it) - changeToolbarStyle(it) + if (mIsCollapsed != it) { + mIsCollapsed = it + DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && it) + changeToolbarStyle(it) + } } appbar.addOnOffsetChangedListener { _, verticalOffset -> val absOffset = abs(verticalOffset) - val invisibleOffset = DisplayUtils.dip2px(30F) - - if (absOffset <= invisibleOffset) { - titleTv.alpha = 1 - (absOffset.toFloat() / invisibleOffset) - } else { - titleTv.alpha = 0F - } - val currentFragment = childFragmentManager.findFragmentByTag("f${mBinding.viewPager.currentItem}") if (currentFragment is GameCollectionPlayerCreationFragment) { currentFragment.setListRefreshEnable(absOffset <= 2) @@ -216,7 +212,7 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { } else { GameCollectionHotListFragment().with( bundleOf( - EntranceConsts.KEY_TAB to tabEntity, + GameCollectionListEntity::class.java.simpleName to tabEntity, EntranceConsts.KEY_POSITION to position, EntranceConsts.KEY_ENTRANCE to mEntrance, EntranceConsts.KEY_PATH to "游戏单热榜" @@ -234,6 +230,7 @@ class GameCollectionHotListWrapperFragment : LazyFragment() { override fun onDarkModeChanged() { super.onDarkModeChanged() DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && mIsCollapsed) + changeToolbarStyle(mIsCollapsed) for (i in 0 until mBinding.tabLayout.tabCount) { val tab = mBinding.tabLayout.getTabAt(i) if (tab != null) { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperViewModel.kt index b7e781c5a1..2ae7e0f1c8 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionHotListWrapperViewModel.kt @@ -3,18 +3,16 @@ package com.gh.gamecenter.gamecollection.hotlist import android.app.Application import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.MutableLiveData -import com.gh.gamecenter.common.entity.LinkEntity import com.gh.gamecenter.common.retrofit.Response import com.gh.gamecenter.common.utils.observableToMain -import com.gh.gamecenter.entity.GameCollectionHotListTab -import com.gh.gamecenter.entity.GameCollectionPlayerCreationEntity +import com.gh.gamecenter.entity.GameCollectionListEntity import com.gh.gamecenter.retrofit.RetrofitManager import retrofit2.HttpException class GameCollectionHotListWrapperViewModel(application: Application) : AndroidViewModel(application) { private val mApi = RetrofitManager.getInstance().api - val hotListTabListLiveData = MutableLiveData?>() + val hotListTabListLiveData = MutableLiveData?>() init { getGameCollectionHotListTab() @@ -23,11 +21,11 @@ class GameCollectionHotListWrapperViewModel(application: Application) : AndroidV fun getGameCollectionHotListTab() { mApi.gameCollectionHotListTab .compose(observableToMain()) - .subscribe(object : Response>() { - override fun onResponse(response: List?) { + .subscribe(object : Response>() { + override fun onResponse(response: List?) { super.onResponse(response) response?.let { - val hotListTabList = ArrayList() + val hotListTabList = ArrayList() it.forEachIndexed { index, entity -> hotListTabList.add(entity.apply { position = index + 1 diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionListDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionListDetailActivity.kt new file mode 100644 index 0000000000..f020668198 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/hotlist/GameCollectionListDetailActivity.kt @@ -0,0 +1,36 @@ +package com.gh.gamecenter.gamecollection.hotlist + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import com.gh.gamecenter.common.base.activity.ToolBarActivity +import com.gh.gamecenter.common.constant.EntranceConsts +import com.gh.gamecenter.common.utils.updateStatusBarColor +import com.gh.gamecenter.entity.GameCollectionListEntity + +class GameCollectionListDetailActivity : ToolBarActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + updateStatusBarColor() + } + + override fun onDarkModeChanged() { + super.onDarkModeChanged() + updateStatusBarColor() + } + + companion object { + fun getIntent(context: Context, entity: GameCollectionListEntity, entrance: String): Intent { + val bundle = Bundle() + bundle.putParcelable(GameCollectionListEntity::class.java.simpleName, entity) + bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance) + bundle.putString(EntranceConsts.KEY_PATH, "游戏单合集详情") + return getTargetIntent( + context, + GameCollectionListDetailActivity::class.java, + GameCollectionHotListFragment::class.java, + bundle + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt index d63fd07f46..13286977f6 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareAdapter.kt @@ -47,7 +47,7 @@ import java.lang.ref.WeakReference class GameCollectionSquareAdapter( context: Context, - private val isHome: Boolean = false, + private val mIsHome: Boolean = false, private val mFragment: GameCollectionSquareFragment, private val mViewModel: GameCollectionSquareViewModel, private var mBasicExposureSource: List, @@ -65,7 +65,7 @@ class GameCollectionSquareAdapter( } // 避免首页游戏单广场刷新列表后出现异常跳转位置 - if (isHome && mEntityList.size == 2 && updateData.size > mEntityList.size) { + if (mIsHome && mEntityList.size == 2 && updateData.size > mEntityList.size) { mEntityList = ArrayList(updateData) notifyItemRangeInserted(2, updateData.size - 1) return @@ -82,21 +82,21 @@ class GameCollectionSquareAdapter( } fun setAmwayList(amwayList: List) { - if (isHome && mEntityList.isNotEmpty() && mEntityList[0].amwayListItem.isNullOrEmpty()) { + if (mIsHome && mEntityList.isNotEmpty() && mEntityList[0].amwayListItem.isNullOrEmpty()) { mEntityList[0].amwayListItem = amwayList notifyItemChanged(0) } } fun setBannerList(bannerList: List) { - if (isHome && mEntityList.isNotEmpty() && mEntityList[0].carouselListItem.isNullOrEmpty()) { + if (mIsHome && mEntityList.isNotEmpty() && mEntityList[0].carouselListItem.isNullOrEmpty()) { mEntityList[0].carouselListItem = bannerList notifyItemChanged(0) } } fun setHotListTabName(tabName: String) { - if (isHome && mEntityList.isNotEmpty() && mEntityList[0].hotListTabName.isEmpty()) { + if (mIsHome && mEntityList.isNotEmpty() && mEntityList[0].hotListTabName.isEmpty()) { mEntityList[0].hotListTabName = tabName notifyItemChanged(0) } @@ -125,7 +125,7 @@ class GameCollectionSquareAdapter( override fun getItemViewType(position: Int): Int { - if (isHome) { + if (mIsHome) { if (position == 0) return ItemViewType.ITEM_HEADER if (position == 1) return ITEM_FILTER if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER @@ -191,7 +191,7 @@ class GameCollectionSquareAdapter( } itemData.exposureEventList = exposureEventList itemData.gameCollectionItem?.let { - holder.bindGameCollection(mViewModel, it, itemData, isHome, ArrayList(mBasicExposureSource).apply { + holder.bindGameCollection(mViewModel, it, itemData, ArrayList(mBasicExposureSource).apply { addAll(exposureSource) }) } @@ -209,7 +209,7 @@ class GameCollectionSquareAdapter( } override fun getItemCount() = - if (mEntityList.isNullOrEmpty()) 0 else if (isHome && mEntityList.size == 2) mEntityList.size else mEntityList.size + 1 + if (mEntityList.isNullOrEmpty()) 0 else if (mIsHome && mEntityList.size == 2) mEntityList.size else mEntityList.size + 1 class GameCollectionHeaderItemViewHolder(val binding: ItemGameCollectionHeaderBinding) : RecyclerView.ViewHolder(binding.root) { @@ -431,7 +431,6 @@ class GameCollectionSquareAdapter( viewModel: GameCollectionSquareViewModel, gamesCollectionEntity: GamesCollectionEntity, itemData: GameCollectionListItemData, - isHome: Boolean, exposureSource: List ) { binding.run { @@ -557,7 +556,7 @@ class GameCollectionSquareAdapter( GameCollectionDetailActivity.getIntent( context, gamesCollectionEntity.id, - isFromSquare = !isHome, + isFromSquare = true, exposureSourceList = ArrayList(exposureSource) ) ) diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt index e55f0c19d9..2cf881006f 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt @@ -132,8 +132,8 @@ class GameCollectionSquareViewModel(application: Application) : private fun getGameCollectionHotListTab() { mApi.gameCollectionHotListTab .compose(observableToMain()) - .subscribe(object : Response>() { - override fun onResponse(response: List?) { + .subscribe(object : Response>() { + override fun onResponse(response: List?) { super.onResponse(response) response?.firstOrNull()?.let { hotListFirstTab.postValue(it.name) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescAdapter.kt index de59e30b13..797b72343d 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescAdapter.kt @@ -771,20 +771,6 @@ class DescAdapter( rightMargin = 0 } containerWrapper.setPadding(0, itemData.paddingTop, 0, itemData.paddingBottom) - val exposureEventList = arrayListOf() - recommendGameList.forEachIndexed { index, entity -> - val event = ExposureEvent.createEvent( - gameEntity = GameEntity().apply { - sequence = index - }, - source = listOf( - ExposureSource("游戏详情", "$mGameName+$mGameId"), - ExposureSource("游戏单", "${entity.title}+${entity.id}") - ) - ) - exposureEventList.add(event) - ExposureManager.log(event) - } layoutManager = LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false) if (adapter == null) { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameCollectionAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameCollectionAdapter.kt index ca8f8c7e58..2f906fa641 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameCollectionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/GameCollectionAdapter.kt @@ -2,16 +2,19 @@ package com.gh.gamecenter.gamedetail.desc import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import com.gh.common.exposure.ExposureManager import com.gh.common.filter.RegionSettingHelper import com.gh.common.util.DirectUtils +import com.gh.gamecenter.GameDetailActivity import com.gh.gamecenter.R import com.gh.gamecenter.common.base.GlobalActivityManager +import com.gh.gamecenter.common.base.activity.BaseActivity +import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.databinding.GamedetailItemGameCollectionBinding import com.gh.gamecenter.entity.GameDetailRecommendGameEntity -import com.gh.gamecenter.feature.exposure.ExposureEvent -import com.gh.gamecenter.common.exposure.ExposureSource import com.gh.gamecenter.feature.entity.GameEntity +import com.gh.gamecenter.feature.exposure.ExposureEvent class GameCollectionAdapter( private val mRecommendGameList: ArrayList, @@ -45,8 +48,27 @@ class GameCollectionAdapter( val games = RegionSettingHelper.filterSimpleGame(entity.games) gameIcons.forEachIndexed { index, gameIcon -> gameIcon.goneIf(games.size < index + 1) { - gameIcon.displayGameIcon(games[index].toGameEntity()) + val gameEntity = games[index].toGameEntity() + val event = ExposureEvent.createEvent( + gameEntity = gameEntity.apply { + sequence = position + }, + source = listOf( + ExposureSource("游戏详情", "$mGameName+$mGameId"), + ExposureSource("游戏单", "${entity.title}+${entity.id}") + ) + ) + ExposureManager.log(event) + gameIcon.displayGameIcon(gameEntity) gameIcon.setBorderColor(R.color.background_white) + gameIcon.setOnClickListener { + GameDetailActivity.startGameDetailActivity( + root.context, + games[index].id ?: "", + BaseActivity.mergeEntranceAndPath(mEntrance, "游戏详情"), + event + ) + } } } gameCountTv.text = "+${entity.count.game - games.size}" diff --git a/app/src/main/java/com/gh/gamecenter/home/HomeViewModel.kt b/app/src/main/java/com/gh/gamecenter/home/HomeViewModel.kt index a4d0ab3e5e..d4d54e88b4 100644 --- a/app/src/main/java/com/gh/gamecenter/home/HomeViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/home/HomeViewModel.kt @@ -933,7 +933,10 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { type = linkType, name = homeContent.linkText, adIconActive = adIconActive, - style = homeContent.style + style = homeContent.style, + home = homeContent.home, + moreLink = homeContent.moreLink, + explain = homeContent.explain ) mSnapshotItemList.add(LegacyHomeSubjectTransformer.getBlankSpacingItem(HomeItemData()) as HomeItemData) mSnapshotItemList.add(head) diff --git a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt index 97db3907c6..295d3b8a7c 100644 --- a/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt +++ b/app/src/main/java/com/gh/gamecenter/home/LegacyHomeFragmentAdapterAssistant.kt @@ -694,6 +694,7 @@ class LegacyHomeFragmentAdapterAssistant( val buttonType = when (column.home) { "change" -> "换一批" "more" -> "更多" + "game_list_square" -> "游戏单广场" else -> "全部" } val moreLink = column.moreLink @@ -709,9 +710,53 @@ class LegacyHomeFragmentAdapterAssistant( (mAdapter as HomeFragmentAdapter).viewModel.changeSubjectGame(column.id!!) } } else if ("more" == column.home) { + if (column.type == "game_list_collection") { + NewFlatLogUtils.logGameListCollectionClick( + "首页内容列表", + "", + "", + column.name ?: "", + column.id ?: "", + "更多", + column.moreLink?.type ?: "", + column.moreLink?.link ?: "", + column.moreLink?.text ?: "" + ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "首页" + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "更多" + "link_type" to column.moreLink?.type + "link_id" to column.moreLink?.link + "link_text" to column.moreLink?.text + }) + } column.moreLink?.let { link -> DirectUtils.directToLinkPage(it.context, link, "(首页)", "(游戏-专题:" + column.name + "-全部)") } + } else if ("game_list_square" == column.home) { + NewFlatLogUtils.logGameListCollectionClick( + "首页内容列表", + "", + "", + column.name ?: "", + column.id ?: "", + "游戏单广场" + ) + SensorsBridge.trackEvent("GameListCollectionClick", json { + "location" to "首页" + "game_list_collection_name" to column.name + "game_list_collection_id" to column.id + "text" to "游戏单广场" + }) + DirectUtils.directToGameCollectionSquare( + mContext, + "首页内容列表", + column.name ?: "", + collectionId = column.id ?: "", + collectionName = column.name ?: "" + ) } else { setPageSwitchData() if (column.type == "column_collection") { @@ -768,26 +813,12 @@ class LegacyHomeFragmentAdapterAssistant( text = "全部" ) } else if (column.type == "game_list_collection") { - NewFlatLogUtils.logGameListCollectionClick( - "首页内容列表", - "", - "", - column.name ?: "", - column.id ?: "", - "游戏单广场" - ) - SensorsBridge.trackEvent("GameListCollectionClick", json { - "location" to "首页" - "game_list_collection_name" to column.name - "game_list_collection_id" to column.id - "text" to "游戏单广场" - }) - DirectUtils.directToGameCollectionSquare( + DirectUtils.directToGameCollectionListDetail( mContext, - "首页内容列表", + column.id ?: "", column.name ?: "", - collectionId = column.id ?: "", - collectionName = column.name ?: "" + column.explain, + "首页内容列表" ) } else if (column.type == "column_test_v2") { //跳转到新游开测页面 diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java index 9c9791201d..0771bf691e 100644 --- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java +++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java @@ -19,11 +19,8 @@ import com.gh.gamecenter.entity.BlockEntity; import com.gh.gamecenter.entity.CarouselEntity; import com.gh.gamecenter.entity.CatalogEntity; import com.gh.gamecenter.entity.CategoryEntity; -import com.gh.gamecenter.feature.entity.CommentEntity; -import com.gh.gamecenter.feature.entity.CommentnumEntity; import com.gh.gamecenter.entity.CommonCollectionContentEntity; import com.gh.gamecenter.entity.CommonCollectionEntity; -import com.gh.gamecenter.feature.entity.ConcernEntity; import com.gh.gamecenter.entity.DefaultAvatar; import com.gh.gamecenter.entity.DeviceDialogEntity; import com.gh.gamecenter.entity.DialogEntity; @@ -37,7 +34,7 @@ import com.gh.gamecenter.entity.ForumDetailEntity; import com.gh.gamecenter.entity.ForumEntity; import com.gh.gamecenter.entity.ForumUnreadEntity; import com.gh.gamecenter.entity.GameCollectionCoverEntity; -import com.gh.gamecenter.entity.GameCollectionHotListTab; +import com.gh.gamecenter.entity.GameCollectionListEntity; import com.gh.gamecenter.entity.GameCollectionPlayerCreationEntity; import com.gh.gamecenter.entity.GameCollectionTagEntity; import com.gh.gamecenter.entity.GameColumnCollection; @@ -55,10 +52,6 @@ import com.gh.gamecenter.entity.HomeItemTestV2Entity; import com.gh.gamecenter.entity.ImageInfoEntity; import com.gh.gamecenter.entity.InterestedGameEntity; import com.gh.gamecenter.entity.LibaoDetailEntity; -import com.gh.gamecenter.feature.entity.LibaoEntity; -import com.gh.gamecenter.feature.entity.LibaoStatusEntity; -import com.gh.gamecenter.feature.entity.MessageUnreadCount; -import com.gh.gamecenter.feature.entity.MessageUnreadEntity; import com.gh.gamecenter.entity.MyVideoEntity; import com.gh.gamecenter.entity.NewApiSettingsEntity; import com.gh.gamecenter.entity.NewSettingsEntity; @@ -93,7 +86,6 @@ import com.gh.gamecenter.entity.VideoDataOverViewEntity; import com.gh.gamecenter.entity.VideoDraftEntity; import com.gh.gamecenter.entity.VideoEntity; import com.gh.gamecenter.entity.VideoTagEntity; -import com.gh.gamecenter.feature.entity.ViewsEntity; import com.gh.gamecenter.entity.VoteEntity; import com.gh.gamecenter.feature.entity.AnswerEntity; import com.gh.gamecenter.feature.entity.ApkEntity; @@ -102,8 +94,15 @@ import com.gh.gamecenter.feature.entity.ArticleEntity; import com.gh.gamecenter.feature.entity.AuthDialogEntity; import com.gh.gamecenter.feature.entity.AvatarBorderEntity; import com.gh.gamecenter.feature.entity.BackgroundImageEntity; +import com.gh.gamecenter.feature.entity.CommentEntity; +import com.gh.gamecenter.feature.entity.CommentnumEntity; +import com.gh.gamecenter.feature.entity.ConcernEntity; import com.gh.gamecenter.feature.entity.ForumVideoEntity; import com.gh.gamecenter.feature.entity.GameEntity; +import com.gh.gamecenter.feature.entity.LibaoEntity; +import com.gh.gamecenter.feature.entity.LibaoStatusEntity; +import com.gh.gamecenter.feature.entity.MessageUnreadCount; +import com.gh.gamecenter.feature.entity.MessageUnreadEntity; import com.gh.gamecenter.feature.entity.NewsEntity; import com.gh.gamecenter.feature.entity.PersonalEntity; import com.gh.gamecenter.feature.entity.QuestionDraftEntity; @@ -111,11 +110,11 @@ import com.gh.gamecenter.feature.entity.Questions; import com.gh.gamecenter.feature.entity.ServerCalendarEntity; import com.gh.gamecenter.feature.entity.SettingsEntity; import com.gh.gamecenter.feature.entity.SimulatorEntity; +import com.gh.gamecenter.feature.entity.ViewsEntity; import com.gh.gamecenter.gamedetail.entity.BigEvent; import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity; import com.gh.gamecenter.login.entity.UserInfoEntity; import com.gh.gamecenter.personalhome.rating.MyRating; -import com.gh.gamecenter.qa.entity.TopCommunityCategory; import com.gh.gamecenter.qa.entity.AnswerDetailEntity; import com.gh.gamecenter.qa.entity.AnswerDraftEntity; import com.gh.gamecenter.qa.entity.ArticleDetailEntity; @@ -124,6 +123,7 @@ import com.gh.gamecenter.qa.entity.EditorInsertDefaultEntity; import com.gh.gamecenter.qa.entity.InviteEntity; import com.gh.gamecenter.qa.entity.QuestionsDetailEntity; import com.gh.gamecenter.qa.entity.QuestionsIndexEntity; +import com.gh.gamecenter.qa.entity.TopCommunityCategory; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -3112,7 +3112,7 @@ public interface ApiService { * 游戏单热榜-游戏单榜单tab */ @GET("game_lists/collections/hot_list/tab") - Observable> getGameCollectionHotListTab(); + Observable> getGameCollectionHotListTab(); /** * 游戏单热榜-玩家创作榜 diff --git a/app/src/main/res/layout/fragment_game_collection_hot_list_wrapper.xml b/app/src/main/res/layout/fragment_game_collection_hot_list_wrapper.xml index a5d09a0d74..de7f6b6815 100644 --- a/app/src/main/res/layout/fragment_game_collection_hot_list_wrapper.xml +++ b/app/src/main/res/layout/fragment_game_collection_hot_list_wrapper.xml @@ -1,7 +1,6 @@ @@ -80,7 +79,7 @@ android:gravity="center" android:singleLine="true" android:text="游戏单热榜" - android:textColor="@color/white" + android:textColor="@color/text_black" android:textSize="15sp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/item_game_collection_player_creation_header.xml b/app/src/main/res/layout/item_game_collection_player_creation_header.xml index 9f91a33397..14963f0617 100644 --- a/app/src/main/res/layout/item_game_collection_player_creation_header.xml +++ b/app/src/main/res/layout/item_game_collection_player_creation_header.xml @@ -7,6 +7,7 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" + android:paddingBottom="4dp" android:gravity="center_vertical" android:orientation="horizontal"> diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java index 6734a442e6..3fdf417a33 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java @@ -292,7 +292,6 @@ public class EntranceConsts { public static final String KEY_SCROLL_TO_TRENDS = "trends"; public static final String KEY_BBS_SECTION_ID = "bbs_section_id"; public static final String KEY_EDIT_HISTORY = "edit_history"; - public static final String KEY_TAB = "tab"; public static final String KEY_SHOW_SEARCH_TOOLBAR = "show_search_toolbar"; public static final String KEY_URL_LIST = "urls"; public static final String KEY_CURRENT = "current"; diff --git a/module_common/src/main/java/com/gh/gamecenter/common/entity/LinkEntity.kt b/module_common/src/main/java/com/gh/gamecenter/common/entity/LinkEntity.kt index 6e5b3f8590..5a6b970885 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/entity/LinkEntity.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/entity/LinkEntity.kt @@ -37,6 +37,7 @@ open class LinkEntity( var style: String = "", @SerializedName("game_id") var gameId: String = "", + var explain: String = "", // 游戏单合集说明 //本地字段 (埋点用) var blockId: String = "", diff --git a/module_common/src/main/java/com/gh/gamecenter/common/utils/Extensions.kt b/module_common/src/main/java/com/gh/gamecenter/common/utils/Extensions.kt index 9ebf80e656..cce97bb952 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/utils/Extensions.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/utils/Extensions.kt @@ -67,13 +67,12 @@ import okhttp3.MediaType import okhttp3.RequestBody import org.json.JSONArray import org.json.JSONObject -import java.lang.reflect.ParameterizedType import java.io.* +import java.lang.reflect.ParameterizedType import java.net.URI import java.util.* import java.util.concurrent.TimeUnit import java.util.regex.Pattern -import kotlin.collections.ArrayList import kotlin.math.abs @@ -1408,7 +1407,10 @@ fun WebView.setTransparentBackground() { /** * 深色模式切换更新状态栏底色 */ -fun Activity.updateStatusBarColor(@ColorRes nightColor: Int, @ColorRes dayColor: Int) { +fun Activity.updateStatusBarColor( + @ColorRes nightColor: Int = R.color.background_white, + @ColorRes dayColor: Int = R.color.background_white +) { DisplayUtils.setStatusBarColor( this, if (DarkModeUtils.isDarkModeOn(this)) nightColor else dayColor diff --git a/module_common/src/main/java/com/gh/gamecenter/common/view/GridSpacingItemDecoration.kt b/module_common/src/main/java/com/gh/gamecenter/common/view/GridSpacingItemDecoration.kt index 08463c52cf..f035796fc7 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/view/GridSpacingItemDecoration.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/view/GridSpacingItemDecoration.kt @@ -13,14 +13,17 @@ class GridSpacingItemDecoration( ) : RecyclerView.ItemDecoration() { private var mTopDecoration = 0 + private var mHeaderItemCount = 0 constructor( spanCount: Int, spacing: Int, includeEdge: Boolean, - topDecoration: Int + topDecoration: Int, + headerItemCount: Int = 0 ) : this(spanCount, spacing, includeEdge) { this.mTopDecoration = topDecoration + this.mHeaderItemCount = headerItemCount } override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { @@ -28,11 +31,19 @@ class GridSpacingItemDecoration( val isStaggeredGridLayout = parent.layoutManager is StaggeredGridLayoutManager val position = if (!isStaggeredGridLayout) { - parent.getChildAdapterPosition(view) + if (parent.getChildAdapterPosition(view) < mHeaderItemCount) { + return + } else { + parent.getChildAdapterPosition(view) - mHeaderItemCount + } } else { val params = view.layoutParams as (StaggeredGridLayoutManager.LayoutParams) // 当前位置 - params.spanIndex + if (params.spanIndex < mHeaderItemCount) { + return + } else { + params.spanIndex - mHeaderItemCount + } } val column = position % mSpanCount