-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
122 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
presentation/src/main/java/org/gdsc/presentation/view/mypage/adapter/ReviewImageAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.gdsc.presentation.view.mypage.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.DiffUtil | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import org.gdsc.presentation.databinding.ItemReviewImageBinding | ||
|
||
class ReviewImageAdapter() : | ||
ListAdapter<String, ReviewImageAdapter.ReviewImageViewHolder>( | ||
diffUtil | ||
) { | ||
inner class ReviewImageViewHolder(private val binding: ItemReviewImageBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(url: String) { | ||
|
||
Glide.with(binding.root) | ||
.load(url) | ||
.into(binding.image) | ||
} | ||
} | ||
|
||
companion object { | ||
val diffUtil = object : DiffUtil.ItemCallback<String>() { | ||
override fun areItemsTheSame(oldItem: String, newItem: String): Boolean { | ||
return oldItem == newItem | ||
} | ||
|
||
override fun areContentsTheSame(oldItem: String, newItem: String): Boolean { | ||
return oldItem == newItem | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder( | ||
parent: ViewGroup, | ||
viewType: Int | ||
): ReviewImageViewHolder { | ||
val inflater = LayoutInflater.from(parent.context) | ||
return ReviewImageViewHolder( | ||
ItemReviewImageBinding.inflate( | ||
inflater, | ||
parent, | ||
false | ||
) | ||
) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ReviewImageViewHolder, position: Int) { | ||
holder.apply { | ||
bind(getItem(position)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
66 changes: 37 additions & 29 deletions
66
presentation/src/main/res/layout/item_review_restaurant.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |