From 1ca9472eee64688df2ef96bf5994aa9fda81e309 Mon Sep 17 00:00:00 2001 From: lyr <15622190878@163.com> Date: Mon, 29 Nov 2021 16:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=85=89=E7=8E=AF=E5=8A=A9=E6=89=8BV5?= =?UTF-8?q?.5.0=E3=80=91=E6=B8=B8=E6=88=8F=E5=8D=95-=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=EF=BC=88=E7=BB=86=E8=8A=82=E5=AE=8C=E5=96=84?= =?UTF-8?q?=EF=BC=89https://git.ghzs.com/pm/halo-app-issues/-/issues/1591?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection/GamesCollectionAdapter.kt | 45 ++++++++++++------- .../gh/gamecenter/entity/PersonalEntity.kt | 2 + .../personalhome/UserHomeFragment.kt | 2 +- .../home/game/UserGameFragment.kt | 15 ++++--- .../main/res/layout/game_collection_item.xml | 5 +-- 5 files changed, 42 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt index c85694c3e1..6b613f72a7 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/GamesCollectionAdapter.kt @@ -20,6 +20,7 @@ import com.gh.gamecenter.R import com.gh.gamecenter.adapter.viewholder.FooterViewHolder import com.gh.gamecenter.adapter.viewholder.GameCollectionItemViewHolder import com.gh.gamecenter.baselist.ListAdapter +import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER import com.gh.gamecenter.entity.GamesCollectionEntity import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity @@ -76,24 +77,34 @@ class GamesCollectionAdapter( } } - if (mViewModel.mIsInsertGameCollection) { - when (mViewModel.type) { - GamesCollectionFragment.TYPE_COLLECT -> { - userIcon.visibility = View.VISIBLE - userName.visibility = View.VISIBLE - timeTv.visibility = View.GONE - } - - GamesCollectionFragment.TYPE_USER -> { - userIcon.visibility = View.GONE - userName.visibility = View.GONE - timeTv.visibility = View.VISIBLE - } + when { + mViewModel.mIsInsertGameCollection -> { + userIcon.visibility = View.VISIBLE + userName.visibility = View.VISIBLE + timeTv.visibility = View.GONE + myselfTag.visibility = View.GONE + } + + mViewModel.type == TYPE_USER && itemEntity.display == "self_only" -> { + userIcon.visibility = View.GONE + userName.visibility = View.GONE + timeTv.visibility = View.GONE + myselfTag.visibility = View.VISIBLE + } + + mViewModel.type == TYPE_USER && itemEntity.display != "self_only"-> { + userIcon.visibility = View.GONE + userName.visibility = View.GONE + timeTv.visibility = View.VISIBLE + myselfTag.visibility = View.GONE + } + + else -> { + userIcon.visibility = View.VISIBLE + userName.visibility = View.VISIBLE + timeTv.visibility = View.GONE + myselfTag.visibility = View.GONE } - } else { - userIcon.visibility = View.VISIBLE - userName.visibility = View.VISIBLE - timeTv.visibility = View.GONE } moreIv.setOnClickListener { diff --git a/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt index 95755b0233..bc6cc27ee8 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt @@ -40,6 +40,8 @@ data class PersonalEntity( @SerializedName("game_comment") val gameComment: Int = 0, val video: Int = 0, + @SerializedName("game_list") + val gameList: Int = 0, @SerializedName("today_visit") val todayVisit: Int? = 0) : Parcelable { diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt b/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt index b3da17d5bf..0549a8ef36 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt @@ -345,7 +345,7 @@ class UserHomeFragment : NormalFragment() { val tag = "android:switcher:${mHomeBinding?.viewpager?.id}:" val gameFragment = childFragmentManager.findFragmentByTag("${tag}0") - ?: UserGameFragment.getInstance(mUserHomeViewModel.userId, count.gameComment) + ?: UserGameFragment.getInstance(mUserHomeViewModel.userId, count) val qaFragment = childFragmentManager.findFragmentByTag("${tag}1") ?: UserHistoryFragment.getInstance( mUserHomeViewModel.userId, diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserGameFragment.kt b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserGameFragment.kt index 98a090f821..2bdfdfbebb 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserGameFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/home/game/UserGameFragment.kt @@ -14,6 +14,7 @@ import com.gh.common.util.EntranceUtils.* import com.gh.gamecenter.R import com.gh.gamecenter.collection.GamesCollectionFragment import com.gh.gamecenter.databinding.FragmentUserGameBinding +import com.gh.gamecenter.entity.PersonalEntity import com.gh.gamecenter.normal.NormalFragment class UserGameFragment: NormalFragment() { @@ -25,7 +26,7 @@ class UserGameFragment: NormalFragment() { private var mCommentFragment: UserCommentHistoryFragment? = null private var mUserId: String = "" private var mFilter: String = "全部" - private var mCommentCount = 0 + private var mCount = PersonalEntity.Count() private var mCurrentType = TYPE_GAME_COLLECTION override fun getLayoutId() = 0 @@ -35,7 +36,7 @@ class UserGameFragment: NormalFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) mUserId = arguments?.getString(KEY_USER_ID, "") ?: "" - mCommentCount = arguments?.getInt(KEY_COMMENT_COUNT, 0) ?: 0 + mCount = arguments?.getParcelable(COUNT) ?: PersonalEntity.Count() mViewModel = viewModelProvider(UserGameViewModel.Factory(mUserId)) changeType(TYPE_GAME_COLLECTION) } @@ -48,7 +49,8 @@ class UserGameFragment: NormalFragment() { } mBinding?.run { - commentType.text = "评论 $mCommentCount" + gameCollectionType.text = "游戏单 ${mCount.gameList}" + commentType.text = "评论 ${mCount.gameComment}" val typePairList = arrayListOf( Pair(TYPE_GAME_COLLECTION, gameCollectionType), @@ -187,12 +189,13 @@ class UserGameFragment: NormalFragment() { private const val TYPE_GAME_COLLECTION = 100 private const val TYPE_PLAYED_GAME = 101 private const val TYPE_COMMENT = 102 + const val COUNT = "count" - fun getInstance(userId: String, commentCount: Int): UserGameFragment { + fun getInstance(userId: String, count: PersonalEntity.Count): UserGameFragment { return UserGameFragment().apply { with(bundleOf( - KEY_USER_ID to userId, - KEY_COMMENT_COUNT to commentCount + KEY_USER_ID to userId, + COUNT to count )) } } diff --git a/app/src/main/res/layout/game_collection_item.xml b/app/src/main/res/layout/game_collection_item.xml index 2775743f98..78eade974c 100644 --- a/app/src/main/res/layout/game_collection_item.xml +++ b/app/src/main/res/layout/game_collection_item.xml @@ -163,7 +163,7 @@ android:includeFontPadding="false" android:textColor="@color/white" android:textSize="10sp" - android:text="@{TimeUtils.getFormatTime(entity.time.create, `MM - dd`)}" + android:text="@{TimeUtils.getFormatTime(entity.time.update, `MM - dd`)}" tools:text="09 - 02" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> @@ -194,8 +194,7 @@ app:layout_constraintBottom_toBottomOf="@+id/userIcon" />