-
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.
Merge pull request #94 from team-JMT/feat/register_review
�후기 등록 기능 구현
- Loading branch information
Showing
15 changed files
with
473 additions
and
150 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
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
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
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
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
14 changes: 14 additions & 0 deletions
14
domain/src/main/java/org/gdsc/domain/usecase/PostReviewUseCase.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,14 @@ | ||
package org.gdsc.domain.usecase | ||
|
||
import okhttp3.MultipartBody | ||
import org.gdsc.domain.repository.RestaurantRepository | ||
import javax.inject.Inject | ||
|
||
class PostReviewUseCase @Inject constructor( | ||
private val restaurantRepository: RestaurantRepository | ||
) { | ||
|
||
suspend operator fun invoke(restaurantId: Int, reviewContent: String, reviewImages: List<MultipartBody.Part>): Boolean { | ||
return restaurantRepository.postRestaurantReview(restaurantId, reviewContent, reviewImages) | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...ion/src/main/java/org/gdsc/presentation/view/mypage/adapter/PhotoWillBeUploadedAdapter.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,64 @@ | ||
package org.gdsc.presentation.view.mypage.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.core.net.toUri | ||
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.ItemPhotoWillBeUploadedBinding | ||
|
||
class PhotoWillBeUploadedAdapter( | ||
private val onDeleteButtonClicked: (String) -> Unit | ||
) : | ||
ListAdapter<String, PhotoWillBeUploadedAdapter.PhotoWillBeUploadedViewHolder>( | ||
diffUtil | ||
) { | ||
inner class PhotoWillBeUploadedViewHolder(private val binding: ItemPhotoWillBeUploadedBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(url: String) { | ||
|
||
Glide.with(binding.root) | ||
.load(url.toUri()) | ||
.into(binding.photoWillBeUploaded) | ||
|
||
binding.deleteButton.setOnClickListener { | ||
onDeleteButtonClicked(url) | ||
} | ||
} | ||
} | ||
|
||
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 | ||
): PhotoWillBeUploadedViewHolder { | ||
val inflater = LayoutInflater.from(parent.context) | ||
return PhotoWillBeUploadedViewHolder( | ||
ItemPhotoWillBeUploadedBinding.inflate( | ||
inflater, | ||
parent, | ||
false | ||
) | ||
) | ||
} | ||
|
||
override fun onBindViewHolder(holder: PhotoWillBeUploadedViewHolder, 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
Oops, something went wrong.