diff --git a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantReviewAdapter.kt b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantReviewAdapter.kt index 7d8008e0..4af56f22 100644 --- a/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantReviewAdapter.kt +++ b/presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/RestaurantReviewAdapter.kt @@ -1,6 +1,7 @@ package org.gdsc.presentation.view.mypage.adapter import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter @@ -26,6 +27,14 @@ class RestaurantReviewAdapter( tvNickname.text = item.userName tvContent.text = item.reviewContent + + if (item.reviewImages.isEmpty()) { + rvReviewImages.visibility = View.GONE + } else { + rvReviewImages.adapter = ReviewImageAdapter().apply { + submitList(item.reviewImages) + } + } } } } diff --git a/presentation/src/main/res/layout/item_review_image.xml b/presentation/src/main/res/layout/item_review_image.xml new file mode 100644 index 00000000..e7cdabab --- /dev/null +++ b/presentation/src/main/res/layout/item_review_image.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingEnd="2dp" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <org.gdsc.presentation.view.custom.FlexibleCornerImageView + android:id="@+id/image" + android:layout_width="48dp" + android:layout_height="48dp" + app:all_corner_radius="4dp" + android:scaleType="centerCrop" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/presentation/src/main/res/layout/item_review_restaurant.xml b/presentation/src/main/res/layout/item_review_restaurant.xml index 737b4180..71e34eba 100644 --- a/presentation/src/main/res/layout/item_review_restaurant.xml +++ b/presentation/src/main/res/layout/item_review_restaurant.xml @@ -1,69 +1,77 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" android:background="@drawable/bg_rounded_border_12_grey200" - android:padding="16dp" - android:layout_marginTop="16dp"> + android:padding="16dp"> <ImageView android:id="@+id/iv_profile" android:layout_width="20dp" android:layout_height="20dp" + android:src="@drawable/mock_profile" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - android:src="@drawable/mock_profile"/> + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tv_nickname" + style="@style/text_medium_medium" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintStart_toEndOf="@id/iv_profile" - app:layout_constraintTop_toTopOf="parent" android:layout_marginStart="6dp" - style="@style/text_medium_medium" android:textColor="@color/grey900" - tools:text="권나무방구뿡뿡"/> + app:layout_constraintStart_toEndOf="@id/iv_profile" + app:layout_constraintTop_toTopOf="parent" + tools:text="권나무방구뿡뿡" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rv_review_images" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:orientation="horizontal" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_nickname" + tools:layout_height="48dp" /> <TextView android:id="@+id/tv_content" + style="@style/text_medium_medium" android:layout_width="0dp" android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/iv_profile" android:layout_marginTop="6dp" - style="@style/text_medium_medium" android:textColor="@color/grey900" - tools:text="와 정말 맛있더군요 여기 안가면 바보입니다 하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하"/> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/rv_review_images" + tools:text="와 정말 맛있더군요 여기 안가면 바보입니다 하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하하" /> <TextView + style="@style/text_small_medium" android:layout_width="0dp" android:layout_height="wrap_content" - app:layout_constraintEnd_toStartOf="@id/iv_thumb_up" - app:layout_constraintTop_toBottomOf="@id/tv_content" - app:layout_constraintBottom_toBottomOf="parent" - android:text="리뷰가 도움이 됐어요" - android:layout_marginEnd="4dp" android:layout_marginTop="8dp" - style="@style/text_small_medium" + android:layout_marginEnd="4dp" + android:text="리뷰가 도움이 됐어요" android:textColor="@color/grey500" - /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/iv_thumb_up" + app:layout_constraintTop_toBottomOf="@id/tv_content" /> <ImageView android:id="@+id/iv_thumb_up" - android:src="@drawable/ic_thumb_up" android:layout_width="16dp" android:layout_height="16dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_content" android:layout_marginTop="8dp" - /> - - + android:src="@drawable/ic_thumb_up" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_content" /> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file