fix:【畅玩助手】畅玩-最近在玩模块、双开按钮异常 https://jira.shanqu.cc/browse/CWZS-138

This commit is contained in:
叶子维
2023-12-13 09:34:04 +08:00
parent ae0f4c948b
commit 8e255b1803
5 changed files with 24 additions and 9 deletions

View File

@ -325,6 +325,7 @@ open class GameFragment : LazyFragment() {
mListAdapter.notifyChildItem(gameAndPosition.position, busFour.packageName)
}
}
(mViewModel as GameViewModel).refreshRecentVGameIfNeeded()
}
@Subscribe(threadMode = ThreadMode.MAIN)
@ -332,6 +333,7 @@ open class GameFragment : LazyFragment() {
if (::mListAdapter.isInitialized && "Refresh" == reuse.type) {
mListAdapter.notifyDataSetChanged()
}
(mViewModel as GameViewModel).refreshRecentVGameIfNeeded()
}
@Subscribe(threadMode = ThreadMode.MAIN)

View File

@ -87,6 +87,7 @@ import com.gh.gamecenter.home.video.ScrollCalculatorHelper
import com.gh.gamecenter.qgame.QGameHorizontalSlideListViewHolder
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
import com.gh.gamecenter.subject.SubjectActivity
import com.gh.vspace.HomeRecentVGameAdapter
import com.gh.vspace.HomeRecentVGameViewHolder
import com.gh.vspace.VHelper
import com.lightgame.adapter.BaseRecyclerAdapter
@ -1754,6 +1755,7 @@ class GameFragmentAdapter(
|| getItemViewType(gameAndPosition.position) == ItemViewType.HORIZONTAL_SLIDE_VIDEO
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_BIG_SLIDE
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH
|| getItemViewType(gameAndPosition.position) == ItemViewType.RECENT_V_GAME
) {
val view = mLayoutManager?.findViewByPosition(gameAndPosition.position)
val recyclerView = view?.findViewById<RecyclerView>(R.id.recycler_view)
@ -1765,6 +1767,7 @@ class GameFragmentAdapter(
is HomeHorizontalSlideVideoAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionSlideAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionRefreshAdapter -> adapter.notifyItemByDownload(download)
is HomeRecentVGameAdapter -> adapter.notifyItemByDownload(download)
}
} else {
notifyItemChanged(gameAndPosition.position)
@ -1907,6 +1910,12 @@ class GameFragmentAdapter(
continue
}
val recentVGame = mItemDataList[position].recentVGame
if (recentVGame != null) {
positionList.add(GameAndPosition(null, position))
continue
}
val image = mItemDataList[position].image
if (image != null) positionList.add(GameAndPosition(image, position))
}

View File

@ -91,7 +91,11 @@ class HomeRecentVGameAdapter(context: Context) : DiffUtilAdapter<VGameItemData>(
notifyDataSetChanged()
} else {
for (position in mDataList.indices) {
if (downloadEntity.name == mDataList[position].downloadEntity.name) {
val oldDownloadEntity = mDataList[position].downloadEntity
if (downloadEntity.name == oldDownloadEntity.name) {
// 防止覆盖游戏最后打开的时间为0
if (VHelper.getLastPlayedTime(oldDownloadEntity) != 0L && VHelper.getLastPlayedTime(downloadEntity) == 0L)
return
mDataList[position].downloadEntity = downloadEntity
notifyItemChanged(position)
}

View File

@ -1705,17 +1705,17 @@ object VHelper {
val sortedEntityList = arrayListOf<VGameItemData>()
val distinctIdSet = hashSetOf<String>()
// 将下载任务的实体放进待排序列表里
for (rawDownloadEntity in rawDownloadEntityList) {
distinctIdSet.add(rawDownloadEntity.gameId)
rawEntityList.add(rawDownloadEntity)
}
// 将已安装任务的实体放进待排序列表里
for (rawInstalledEntity in rawInstalledEntityList) {
if (distinctIdSet.contains(rawInstalledEntity.downloadEntity.gameId)) {
distinctIdSet.add(rawInstalledEntity.downloadEntity.gameId)
rawEntityList.add(rawInstalledEntity.downloadEntity)
}
// 将下载任务的实体放进待排序列表里
for (rawDownloadEntity in rawDownloadEntityList) {
if (distinctIdSet.contains(rawDownloadEntity.gameId)) {
continue
}
rawEntityList.add(rawInstalledEntity.downloadEntity)
rawEntityList.add(rawDownloadEntity)
}
distinctIdSet.clear()