fix:修复交友页UI问题

This commit is contained in:
Max
2023-12-28 18:46:20 +08:00
parent a129fb405e
commit d0d2418dbf
5 changed files with 33 additions and 6 deletions

View File

@@ -17,7 +17,20 @@ class HomeFriendsGameTabAdapter :
var selectGameId: Long? = null
private var selectPosition: Int? = null
override fun convertPayloads(
helper: BaseViewHolder,
item: HomeGameTab,
payloads: MutableList<Any>
) {
super.convertPayloads(helper, item, payloads)
convertState(helper, item)
}
override fun convert(helper: BaseViewHolder, item: HomeGameTab) {
convertState(helper, item)
}
private fun convertState(helper: BaseViewHolder, item: HomeGameTab) {
if (helper.absoluteAdapterPosition == selectPosition) {
helper.getView<ImageView>(R.id.iv_cover).load(item.onClick, defaultRes = null)
} else {
@@ -32,20 +45,20 @@ class HomeFriendsGameTabAdapter :
this.selectGameId = null
this.selectPosition = null
if (oldPosition != null) {
notifyItemChanged(oldPosition)
notifyItemChanged(oldPosition, true)
}
} else if (position == selectPosition) {
this.selectGameId = null
this.selectPosition = null
notifyItemChanged(position)
notifyItemChanged(position, true)
} else {
val oldPosition = this.selectPosition
this.selectGameId = item.gameId
this.selectPosition = position
if (oldPosition != null) {
notifyItemChanged(oldPosition)
notifyItemChanged(oldPosition, true)
}
notifyItemChanged(position)
notifyItemChanged(position, true)
}
}
}

View File

@@ -82,6 +82,7 @@ class HomeFriendsUserAdapter :
roomInfoView.isVisible = false
} else {
roomInfoView.isVisible = true
roomInfoView.isSelected = true
helper.setText(R.id.tv_room_title, item.roomTitle)
roomInfoView.singleClick {
if (!item.isLock && item.inRoomUid > 0) {

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="@dimen/dp_12"
android:bottomRightRadius="@dimen/dp_12"
android:topLeftRadius="0px"
android:topRightRadius="@dimen/dp_12" />
<solid android:color="@color/white" />
</shape>

View File

@@ -11,9 +11,10 @@
android:id="@+id/iv_cover"
android:layout_width="0dp"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:scaleType="fitCenter"
app:layout_constraintDimensionRatio="86:69"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/default_cover" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -76,7 +76,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_marginTop="-38dp"
android:background="@drawable/shape_white_12dp_round"
android:background="@drawable/home_bg_friends_bottom_info"
app:layout_constraintTop_toBottomOf="@id/iv_avatar" />
<LinearLayout