DoggyZhang 1 месяц назад
Родитель
Сommit
02769c0dbd

+ 5 - 1
module/playmate/src/main/java/com/adealink/weparty/playmate/comment/CommentDialog.kt

@@ -98,7 +98,11 @@ class CommentDialog : BottomDialogFragment(R.layout.dialog_comment_list) {
                     title = APP_R.string.commonui_list_empty
                 )
             } else {
-                adapter.submitList(list.map { PlaymateDetailCommentItemData(it) })
+                adapter.submitList(
+                    list.mapIndexed { index, data ->
+                        PlaymateDetailCommentItemData(data, index < list.size - 1)
+                    }
+                )
                 binding.rvComment.show()
                 binding.vErrorView.gone()
             }

+ 3 - 0
module/playmate/src/main/java/com/adealink/weparty/playmate/detail/adapter/PlaymateDetailCommentTitleViewBinder.kt

@@ -22,6 +22,9 @@ class PlaymateDetailCommentTitleViewBinder(
         holder.binding.tvEvaluate.text = formatStar(item.star)
         holder.binding.tvCommentCount.text =
             getCompatString(R.string.playmate_detail_comment_count, item.commentCount.toString())
+        holder.binding.ivMore.onClick {
+            onMoreClick.invoke()
+        }
         holder.binding.tvMore.onClick {
             onMoreClick.invoke()
         }

+ 2 - 0
module/playmate/src/main/java/com/adealink/weparty/playmate/detail/adapter/PlaymateDetailCommentViewBinder.kt

@@ -103,6 +103,8 @@ class PlaymateDetailCommentViewBinder() :
                 commentText.maxLines = Int.MAX_VALUE
                 item.isExpand = true
             }
+
+            binding.vBottomDivicer.show(item.showBottomDivider)
         }
 
         private fun goProfile(context: Context?, uid: String) {

+ 3 - 1
module/playmate/src/main/java/com/adealink/weparty/playmate/detail/data/PlaymateDetailData.kt

@@ -44,7 +44,9 @@ data class PlaymateCommentLabel(
 
 //评价
 data class PlaymateDetailCommentItemData(
-    val data: PlaymateCommentData
+    val data: PlaymateCommentData,
+
+    val showBottomDivider: Boolean
 ) : BasePlaymateDetailItem() {
     var isExpand = false
 }

+ 12 - 8
module/playmate/src/main/java/com/adealink/weparty/playmate/detail/viewmodel/PlaymateDetailViewModel.kt

@@ -29,7 +29,7 @@ class PlaymateDetailViewModel : BaseViewModel(), IPlaymateDetailViewModel {
     private var playmateName: String? = null
 
     private var detailRes: PlaymateDetailData? = null
-    private var commonList: List<PlaymateCommentData>? = null
+    private var commentList: List<PlaymateCommentData>? = null
 
     fun setPlaymate(id: String?, name: String?) {
         this.playmateID = id
@@ -66,7 +66,7 @@ class PlaymateDetailViewModel : BaseViewModel(), IPlaymateDetailViewModel {
                         detailRltLD.send(Rlt.Success(data))
                     }
                     notifyDetailItemListChanged()
-//                    loadPlaymateComment()
+                    loadPlaymateComment()
                 }
             }
         }
@@ -75,7 +75,7 @@ class PlaymateDetailViewModel : BaseViewModel(), IPlaymateDetailViewModel {
     private suspend fun loadPlaymateComment() {
         val playmateId = playmateID
         if (playmateId.isNullOrEmpty()) {
-            commonList = null
+            commentList = null
             notifyDetailItemListChanged()
             return
         }
@@ -88,11 +88,11 @@ class PlaymateDetailViewModel : BaseViewModel(), IPlaymateDetailViewModel {
         when (rlt) {
             is Rlt.Failed -> {
                 Log.e(TAG_PLAYMATE_DETAIL, "loadPlaymateComment fail, for $rlt")
-                commonList = null
+                commentList = null
             }
 
             is Rlt.Success -> {
-                commonList = rlt.data.data?.list
+                commentList = rlt.data.data?.list
                 notifyDetailItemListChanged()
             }
         }
@@ -127,10 +127,14 @@ class PlaymateDetailViewModel : BaseViewModel(), IPlaymateDetailViewModel {
         }
 
         //评价
-        val commentItems = commonList?.map {
-            PlaymateDetailCommentItemData(it)
+        val commentList = commentList ?: emptyList()
+        val commentItems = mutableListOf<PlaymateDetailCommentItemData>()
+        for ((index, data) in commentList.withIndex()) {
+            commentItems.add(
+                PlaymateDetailCommentItemData(data, index < commentList.size - 1)
+            )
         }
-        if (!commentItems.isNullOrEmpty()) {
+        if (commentItems.isNotEmpty()) {
             itemList.add(
                 PlaymateDetailCommentTitleItemData(
                     data.star,

+ 1 - 1
module/playmate/src/main/res/layout/dialog_comment_list.xml

@@ -43,7 +43,6 @@
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:layout_marginHorizontal="16dp"
-        android:layout_marginTop="10dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
@@ -51,6 +50,7 @@
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/rv_comment"
+            style="@style/CommonVerticalFade"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             tools:listitem="@layout/item_playmate_detail_comment" />

+ 1 - 0
module/playmate/src/main/res/layout/item_playmate_detail_comment.xml

@@ -101,6 +101,7 @@
         tools:visibility="visible" />
 
     <View
+        android:id="@+id/v_bottom_divicer"
         android:layout_width="0dp"
         android:layout_height="1dp"
         android:layout_marginTop="18dp"

+ 12 - 2
module/playmate/src/main/res/layout/item_playmate_detail_comment_title.xml

@@ -57,14 +57,24 @@
     <androidx.appcompat.widget.AppCompatTextView
         android:id="@+id/tv_more"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_height="0dp"
         android:layout_marginStart="20dp"
+        android:gravity="center"
         android:includeFontPadding="false"
+        android:text="@string/common_more"
         android:textColor="@color/color_FF1D2129"
         android:textSize="12sp"
         app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/iv_more"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_more"
+        android:layout_width="12dp"
+        android:layout_height="12dp"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        tools:text="更多 >" />
+        app:srcCompat="@drawable/common_go_ic" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>