From 28388497b89dd00bc568b27c81ca060ad6becd17 Mon Sep 17 00:00:00 2001 From: klaus Date: Fri, 13 Jun 2025 16:52:40 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20-=20=EC=9C=A0=EB=A3=8C=20=EC=BB=A4?= =?UTF-8?q?=EB=AE=A4=EB=8B=88=ED=8B=B0=20=EA=B5=AC=EB=A7=A4=EC=8B=9C=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=20=EB=8C=93=EA=B8=80=20=EC=93=B0=EA=B8=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- .../co/vividnext/sodalive/common/Constants.kt | 1 + .../CreatorCommunityRepository.kt | 19 ++++--- .../all/CreatorCommunityAllActivity.kt | 27 ++++++++-- .../all/CreatorCommunityAllAdapter.kt | 30 ++++++++--- .../all/CreatorCommunityAllViewModel.kt | 8 ++- .../CreateCommunityPostCommentRequest.kt | 3 +- .../CreatorCommunityCommentFragment.kt | 6 ++- .../CreatorCommunityCommentListFragment.kt | 23 +++++++- .../CreatorCommunityCommentListViewModel.kt | 8 ++- .../res/layout/item_creator_community_all.xml | 52 +++++++++++++------ 11 files changed, 139 insertions(+), 42 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9a13ecf7..8568e647 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -35,8 +35,8 @@ android { applicationId "kr.co.vividnext.sodalive" minSdk 23 targetSdk 34 - versionCode 170 - versionName "1.37.3" + versionCode 171 + versionName "1.37.2" } buildTypes { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/common/Constants.kt b/app/src/main/java/kr/co/vividnext/sodalive/common/Constants.kt index 817bbeb1..5752ffb8 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/common/Constants.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/common/Constants.kt @@ -88,6 +88,7 @@ object Constants { const val EXTRA_COMMUNITY_POST_ID = "community_post_id" const val EXTRA_COMMUNITY_CREATOR_ID = "community_creator_id" const val EXTRA_COMMUNITY_POST_COMMENT = "community_post_comment_id" + const val EXTRA_COMMUNITY_EXIST_ORDERED = "community_exist_ordered" const val EXTRA_ALARM_ID = "alarm_id" const val EXTRA_ROULETTE_AVAILABLE_ACTIVE = "roulette_available_active" diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/CreatorCommunityRepository.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/CreatorCommunityRepository.kt index 26e2adf8..3a098531 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/CreatorCommunityRepository.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/CreatorCommunityRepository.kt @@ -51,12 +51,14 @@ class CreatorCommunityRepository(private val api: CreatorCommunityApi) { postId: Long, comment: String, parentId: Long? = null, + isSecret: Boolean = false, token: String ) = api.createCommunityPostComment( request = CreateCommunityPostCommentRequest( comment = comment, postId = postId, - parentId = parentId + parentId = parentId, + isSecret = isSecret ), authHeader = token ) @@ -66,13 +68,14 @@ class CreatorCommunityRepository(private val api: CreatorCommunityApi) { authHeader = token ) - fun getCommentReplyList(commentId: Long, page: Int, size: Int, token: String) = api.getCommentReplyList( - commentId = commentId, - page = page, - size = size, - timezone = TimeZone.getDefault().id, - authHeader = token - ) + fun getCommentReplyList(commentId: Long, page: Int, size: Int, token: String) = + api.getCommentReplyList( + commentId = commentId, + page = page, + size = size, + timezone = TimeZone.getDefault().id, + authHeader = token + ) fun createCommunityPost( audioFile: MultipartBody.Part?, diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllActivity.kt index 05fa6039..b70d44e6 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllActivity.kt @@ -4,7 +4,10 @@ import android.annotation.SuppressLint import android.content.Intent import android.graphics.Rect import android.os.Bundle +import android.os.Handler +import android.os.Looper import android.view.View +import android.view.inputmethod.InputMethodManager import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts import androidx.recyclerview.widget.LinearLayoutManager @@ -29,8 +32,10 @@ class CreatorCommunityAllActivity : BaseActivity + writeComment = { postId, parentId, comment, isSecret -> + hideKeyboard() viewModel.registerComment( comment, postId, - parentId + parentId, + isSecret ) }, - showCommentBottomSheetDialog = { + showCommentBottomSheetDialog = { postId, existOrdered -> val dialog = CreatorCommunityCommentFragment( creatorId = creatorId, - postId = it + postId = postId, + existOrdered = existOrdered ) dialog.show( supportFragmentManager, @@ -223,4 +233,13 @@ class CreatorCommunityAllActivity : BaseActivity Unit, - private val writeComment: (Long, Long?, String) -> Unit, - private val showCommentBottomSheetDialog: (Long) -> Unit, + private val writeComment: (Long, Long?, String, Boolean) -> Unit, + private val showCommentBottomSheetDialog: (Long, Boolean) -> Unit, private val onClickModify: (Long) -> Unit, private val onClickDelete: (Long) -> Unit, private val onClickReport: (Long) -> Unit, @@ -133,7 +133,8 @@ class CreatorCommunityAllAdapter( item.postId, item.commentCount, item.isCommentAvailable, - comment = item.firstComment + comment = item.firstComment, + existOrdered = item.existOrdered ) } @@ -154,7 +155,8 @@ class CreatorCommunityAllAdapter( postId: Long, commentCount: Int, isCommentAvailable: Boolean, - comment: GetCommunityPostCommentListItem? + comment: GetCommunityPostCommentListItem?, + existOrdered: Boolean ) { if (isCommentAvailable) { binding.llComment.visibility = View.VISIBLE @@ -172,8 +174,14 @@ class CreatorCommunityAllAdapter( binding.tvCommentText.text = comment.comment binding.tvCommentText.visibility = View.VISIBLE binding.rlInputComment.visibility = View.GONE + binding.tvSecret.visibility = View.GONE - binding.llComment.setOnClickListener { showCommentBottomSheetDialog(postId) } + binding.llComment.setOnClickListener { + showCommentBottomSheetDialog( + postId, + existOrdered + ) + } } else { binding.tvCommentText.visibility = View.GONE binding.rlInputComment.visibility = View.VISIBLE @@ -185,8 +193,18 @@ class CreatorCommunityAllAdapter( binding.ivCommentSend.setOnClickListener { val inputComment = binding.etComment.text.toString() + val isSecret = binding.tvSecret.isSelected binding.etComment.setText("") - writeComment(postId, null, inputComment) + writeComment(postId, null, inputComment, isSecret) + } + + if (existOrdered) { + binding.tvSecret.visibility = View.VISIBLE + binding.tvSecret.setOnClickListener { + binding.tvSecret.isSelected = !binding.tvSecret.isSelected + } + } else { + binding.tvSecret.visibility = View.GONE } binding.llComment.setOnClickListener {} diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllViewModel.kt index fe369406..a7bf5190 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/CreatorCommunityAllViewModel.kt @@ -144,7 +144,12 @@ class CreatorCommunityAllViewModel( } - fun registerComment(comment: String, postId: Long, parentId: Long? = null) { + fun registerComment( + comment: String, + postId: Long, + parentId: Long? = null, + isSecret: Boolean = false + ) { if (!_isLoading.value!!) { _isLoading.value = true } @@ -154,6 +159,7 @@ class CreatorCommunityAllViewModel( postId = postId, comment = comment, parentId = parentId, + isSecret = isSecret, token = "Bearer ${SharedPreferenceManager.token}" ) .subscribeOn(Schedulers.io()) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreateCommunityPostCommentRequest.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreateCommunityPostCommentRequest.kt index 7cab144d..c754c1fb 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreateCommunityPostCommentRequest.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreateCommunityPostCommentRequest.kt @@ -7,5 +7,6 @@ import com.google.gson.annotations.SerializedName data class CreateCommunityPostCommentRequest( @SerializedName("comment") val comment: String, @SerializedName("postId") val postId: Long, - @SerializedName("parentId") val parentId: Long? + @SerializedName("parentId") val parentId: Long?, + @SerializedName("isSecret") val isSecret: Boolean = false ) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentFragment.kt index 471cf40b..f4f8c1db 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentFragment.kt @@ -15,7 +15,8 @@ import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityP class CreatorCommunityCommentFragment( private val creatorId: Long, - private val postId: Long + private val postId: Long, + private val existOrdered: Boolean ) : BottomSheetDialogFragment() { private lateinit var binding: DialogAudioContentCommentBinding @@ -51,7 +52,8 @@ class CreatorCommunityCommentFragment( val commentListFragmentTag = "COMMENT_LIST_FRAGMENT" val commentListFragment = CreatorCommunityCommentListFragment.newInstance( creatorId = creatorId, - postId = postId + postId = postId, + existOrdered = existOrdered ) val fragmentTransaction = childFragmentManager.beginTransaction() fragmentTransaction.add(R.id.fl_container, commentListFragment, commentListFragmentTag) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentListFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentListFragment.kt index 1175407c..df4b007d 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentListFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/all/comment/CreatorCommunityCommentListFragment.kt @@ -35,6 +35,7 @@ class CreatorCommunityCommentListFragment : BaseFragment - + android:layout_height="wrap_content"> - + android:orientation="horizontal" + tools:ignore="RelativeOverlap"> + + + + + - + android:gravity="center" + android:text="비밀댓글" + android:textColor="@color/color_selected_secret" + android:textSize="12.5sp" + android:visibility="gone" + app:drawableStartCompat="@drawable/ic_select_square" /> + + android:visibility="gone">