응원글 - 수정 기능 추가
This commit is contained in:
parent
b6359f9b8d
commit
e13eb3c404
|
@ -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 {
|
hideKeyboard {
|
||||||
viewModel.modifyCheers(
|
viewModel.modifyCheers(
|
||||||
cheersId = cheersId,
|
cheersId = cheersId,
|
||||||
creatorId = userId,
|
creatorId = userId,
|
||||||
cheersContent = content,
|
cheersContent = content,
|
||||||
isActive = isActive
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,8 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
class UserProfileCheersAdapter(
|
class UserProfileCheersAdapter(
|
||||||
private val userId: Long,
|
private val userId: Long,
|
||||||
private val enterReply: (Long, String) -> Unit,
|
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 onClickReport: (Long) -> Unit,
|
||||||
private val onClickDelete: (Long) -> Unit
|
private val onClickDelete: (Long) -> Unit
|
||||||
) : RecyclerView.Adapter<UserProfileCheersAdapter.ViewHolder>() {
|
) : RecyclerView.Adapter<UserProfileCheersAdapter.ViewHolder>() {
|
||||||
|
@ -43,16 +44,35 @@ class UserProfileCheersAdapter(
|
||||||
binding.tvNickname.text = cheers.nickname
|
binding.tvNickname.text = cheers.nickname
|
||||||
binding.tvDate.text = cheers.date
|
binding.tvDate.text = cheers.date
|
||||||
|
|
||||||
|
if (
|
||||||
|
cheers.memberId == SharedPreferenceManager.userId ||
|
||||||
|
userId == SharedPreferenceManager.userId
|
||||||
|
) {
|
||||||
|
binding.etContentModify.setText(cheers.content)
|
||||||
|
binding.ivMenu.visibility = View.VISIBLE
|
||||||
binding.ivMenu.setOnClickListener {
|
binding.ivMenu.setOnClickListener {
|
||||||
showOptionMenu(
|
showOptionMenu(
|
||||||
context,
|
context,
|
||||||
binding.ivMenu,
|
binding.ivMenu,
|
||||||
cheersId = cheers.cheersId,
|
cheersId = cheers.cheersId,
|
||||||
memberId = cheers.memberId,
|
memberId = cheers.memberId,
|
||||||
creatorId = userId
|
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()) {
|
if (cheers.replyList.isNotEmpty()) {
|
||||||
binding.tvWriteReply.visibility = View.GONE
|
binding.tvWriteReply.visibility = View.GONE
|
||||||
binding.llCheerReply.visibility = View.VISIBLE
|
binding.llCheerReply.visibility = View.VISIBLE
|
||||||
|
@ -66,7 +86,7 @@ class UserProfileCheersAdapter(
|
||||||
binding.rlCheerReply.visibility = View.VISIBLE
|
binding.rlCheerReply.visibility = View.VISIBLE
|
||||||
binding.tvSend.setOnClickListener {
|
binding.tvSend.setOnClickListener {
|
||||||
val content = binding.etCheerReply.text.toString()
|
val content = binding.etCheerReply.text.toString()
|
||||||
modifyReply(reply.cheersId, content, null)
|
modifyReply(reply.cheersId, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,15 +134,15 @@ class UserProfileCheersAdapter(
|
||||||
v: View,
|
v: View,
|
||||||
cheersId: Long,
|
cheersId: Long,
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
creatorId: Long
|
creatorId: Long,
|
||||||
|
onClickModify: () -> Unit
|
||||||
) {
|
) {
|
||||||
val popup = PopupMenu(context, v)
|
val popup = PopupMenu(context, v)
|
||||||
val inflater = popup.menuInflater
|
val inflater = popup.menuInflater
|
||||||
|
|
||||||
if (
|
if (memberId == SharedPreferenceManager.userId) {
|
||||||
memberId == SharedPreferenceManager.userId ||
|
inflater.inflate(R.menu.review_option_menu3, popup.menu)
|
||||||
creatorId == SharedPreferenceManager.userId
|
} else if (creatorId == SharedPreferenceManager.userId) {
|
||||||
) {
|
|
||||||
inflater.inflate(R.menu.review_option_menu2, popup.menu)
|
inflater.inflate(R.menu.review_option_menu2, popup.menu)
|
||||||
} else {
|
} else {
|
||||||
inflater.inflate(R.menu.review_option_menu, popup.menu)
|
inflater.inflate(R.menu.review_option_menu, popup.menu)
|
||||||
|
@ -134,6 +154,10 @@ class UserProfileCheersAdapter(
|
||||||
onClickReport(cheersId)
|
onClickReport(cheersId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.menu_review_modify -> {
|
||||||
|
onClickModify()
|
||||||
|
}
|
||||||
|
|
||||||
R.id.menu_review_delete -> {
|
R.id.menu_review_delete -> {
|
||||||
onClickDelete(cheersId)
|
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 {
|
hideKeyboard {
|
||||||
viewModel.modifyCheers(
|
viewModel.modifyCheers(
|
||||||
cheersId = cheersId,
|
cheersId = cheersId,
|
||||||
creatorId = userId,
|
creatorId = userId,
|
||||||
cheersContent = content,
|
cheersContent = content,
|
||||||
isActive = isActive
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -52,19 +52,64 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_profile" />
|
app:layout_constraintTop_toTopOf="@+id/iv_profile" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fl_content"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_profile"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_date">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_content"
|
android:id="@+id/tv_content"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="6.7dp"
|
android:layout_marginStart="6.7dp"
|
||||||
android:fontFamily="@font/gmarket_sans_medium"
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
android:textColor="@color/color_777777"
|
android:textColor="@color/color_777777"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/iv_profile"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_date"
|
|
||||||
tools:text="내용 읽어보니까 결혼해도 될것 같은데요. 원래 서로 맞춰가며 사는거죠! 응원합니다." />
|
tools:text="내용 읽어보니까 결혼해도 될것 같은데요. 원래 서로 맞춰가며 사는거죠! 응원합니다." />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rl_content_modify"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_content_modify"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginEnd="13.3dp"
|
||||||
|
android:layout_toStartOf="@+id/tv_modify"
|
||||||
|
android:background="@drawable/bg_round_corner_10_339970ff_9970ff"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="text"
|
||||||
|
android:paddingHorizontal="13.3dp"
|
||||||
|
android:paddingVertical="13dp"
|
||||||
|
android:textColor="@color/color_eeeeee"
|
||||||
|
android:textColorHint="@color/color_eeeeee"
|
||||||
|
android:textCursorDrawable="@drawable/edit_text_cursor"
|
||||||
|
android:textSize="13.3sp"
|
||||||
|
android:theme="@style/EditTextStyle"
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_modify"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:background="@drawable/bg_round_corner_6_7_9970ff"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:text="수정"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/fl_reply"
|
android:id="@+id/fl_reply"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -72,7 +117,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/iv_profile"
|
app:layout_constraintStart_toEndOf="@+id/iv_profile"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_content">
|
app:layout_constraintTop_toBottomOf="@+id/fl_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_cheer_reply"
|
android:id="@+id/ll_cheer_reply"
|
||||||
|
@ -89,6 +134,7 @@
|
||||||
android:background="@drawable/bg_round_corner_16_7_4c9970ff"
|
android:background="@drawable/bg_round_corner_16_7_4c9970ff"
|
||||||
android:fontFamily="@font/gmarket_sans_medium"
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
android:paddingHorizontal="13.3dp"
|
android:paddingHorizontal="13.3dp"
|
||||||
|
android:paddingVertical="6.7dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
tools:text="항상 응원해주셔서 감사합니다." />
|
tools:text="항상 응원해주셔서 감사합니다." />
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_review_modify"
|
||||||
|
android:title="수정"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_review_delete"
|
||||||
|
android:title="삭제"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
Loading…
Reference in New Issue