【光环助手V5.5.0】游戏单-个人主页(细节完善)https://git.ghzs.com/pm/halo-app-issues/-/issues/1591

This commit is contained in:
lyr
2021-11-29 16:11:34 +08:00
parent 798503cf26
commit 1ca9472eee
5 changed files with 42 additions and 27 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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,

View File

@ -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
))
}
}

View File

@ -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" />
<ImageView
goneIf="@{entity.display != `self_only`}"
tools:visibility="gone"
android:visibility="gone"
android:id="@+id/myselfTag"
android:layout_width="89dp"
android:layout_height="22dp"