응원글 - 수정 기능 추가
This commit is contained in:
@@ -390,13 +390,21 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||
)
|
||||
}
|
||||
},
|
||||
modifyReply = { cheersId, content, isActive ->
|
||||
modifyReply = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content
|
||||
)
|
||||
}
|
||||
},
|
||||
modifyCheers = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content,
|
||||
isActive = isActive
|
||||
)
|
||||
}
|
||||
},
|
||||
|
@@ -17,7 +17,8 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
class UserProfileCheersAdapter(
|
||||
private val userId: Long,
|
||||
private val enterReply: (Long, String) -> Unit,
|
||||
private val modifyReply: (Long, String?, Boolean?) -> Unit,
|
||||
private val modifyReply: (Long, String?) -> Unit,
|
||||
private val modifyCheers: (Long, String) -> Unit,
|
||||
private val onClickReport: (Long) -> Unit,
|
||||
private val onClickDelete: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<UserProfileCheersAdapter.ViewHolder>() {
|
||||
@@ -43,14 +44,33 @@ class UserProfileCheersAdapter(
|
||||
binding.tvNickname.text = cheers.nickname
|
||||
binding.tvDate.text = cheers.date
|
||||
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
cheersId = cheers.cheersId,
|
||||
memberId = cheers.memberId,
|
||||
creatorId = userId
|
||||
)
|
||||
if (
|
||||
cheers.memberId == SharedPreferenceManager.userId ||
|
||||
userId == SharedPreferenceManager.userId
|
||||
) {
|
||||
binding.etContentModify.setText(cheers.content)
|
||||
binding.ivMenu.visibility = View.VISIBLE
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
cheersId = cheers.cheersId,
|
||||
memberId = cheers.memberId,
|
||||
creatorId = userId,
|
||||
onClickModify = {
|
||||
binding.rlContentModify.visibility = View.VISIBLE
|
||||
binding.tvContent.visibility = View.GONE
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvModify.setOnClickListener {
|
||||
binding.rlContentModify.visibility = View.GONE
|
||||
binding.tvContent.visibility = View.VISIBLE
|
||||
modifyCheers(cheers.cheersId, binding.etContentModify.text.toString())
|
||||
}
|
||||
} else {
|
||||
binding.ivMenu.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (cheers.replyList.isNotEmpty()) {
|
||||
@@ -66,7 +86,7 @@ class UserProfileCheersAdapter(
|
||||
binding.rlCheerReply.visibility = View.VISIBLE
|
||||
binding.tvSend.setOnClickListener {
|
||||
val content = binding.etCheerReply.text.toString()
|
||||
modifyReply(reply.cheersId, content, null)
|
||||
modifyReply(reply.cheersId, content)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -114,15 +134,15 @@ class UserProfileCheersAdapter(
|
||||
v: View,
|
||||
cheersId: Long,
|
||||
memberId: Long,
|
||||
creatorId: Long
|
||||
creatorId: Long,
|
||||
onClickModify: () -> Unit
|
||||
) {
|
||||
val popup = PopupMenu(context, v)
|
||||
val inflater = popup.menuInflater
|
||||
|
||||
if (
|
||||
memberId == SharedPreferenceManager.userId ||
|
||||
creatorId == SharedPreferenceManager.userId
|
||||
) {
|
||||
if (memberId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.review_option_menu3, popup.menu)
|
||||
} else if (creatorId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.review_option_menu2, popup.menu)
|
||||
} else {
|
||||
inflater.inflate(R.menu.review_option_menu, popup.menu)
|
||||
@@ -134,6 +154,10 @@ class UserProfileCheersAdapter(
|
||||
onClickReport(cheersId)
|
||||
}
|
||||
|
||||
R.id.menu_review_modify -> {
|
||||
onClickModify()
|
||||
}
|
||||
|
||||
R.id.menu_review_delete -> {
|
||||
onClickDelete(cheersId)
|
||||
}
|
||||
|
@@ -80,13 +80,21 @@ class UserProfileFantalkAllViewActivity : BaseActivity<ActivityUserProfileFantal
|
||||
)
|
||||
}
|
||||
},
|
||||
modifyReply = { cheersId, content, isActive ->
|
||||
modifyReply = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content
|
||||
)
|
||||
}
|
||||
},
|
||||
modifyCheers = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content,
|
||||
isActive = isActive
|
||||
)
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user