diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt index 5e4733a..2f8de82 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt @@ -1,6 +1,7 @@ package kr.co.vividnext.sodalive.explorer.profile import com.google.gson.annotations.SerializedName +import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityPostListResponse data class GetCreatorProfileResponse( @SerializedName("creator") @@ -13,6 +14,8 @@ data class GetCreatorProfileResponse( val contentList: List, @SerializedName("notice") val notice: String, + @SerializedName("communityPostList") + val communityPostList: List, @SerializedName("cheers") val cheers: GetCheersResponse, @SerializedName("activitySummary") diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt index 34cd05e..8771025 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt @@ -1,7 +1,6 @@ package kr.co.vividnext.sodalive.explorer.profile import android.annotation.SuppressLint -import android.app.Activity import android.app.AlertDialog import android.app.Service import android.content.Context @@ -11,17 +10,18 @@ import android.net.Uri import android.os.Bundle import android.os.Handler import android.os.Looper +import android.view.LayoutInflater import android.view.View import android.view.inputmethod.InputMethodManager import android.webkit.URLUtil +import android.widget.LinearLayout import android.widget.Toast -import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.widget.PopupMenu import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import coil.load import coil.transform.CircleCropTransformation +import coil.transform.RoundedCornersTransformation import kr.co.vividnext.sodalive.R import kr.co.vividnext.sodalive.audio_content.AudioContentActivity import kr.co.vividnext.sodalive.audio_content.AudioContentAdapter @@ -33,12 +33,15 @@ import kr.co.vividnext.sodalive.common.Constants import kr.co.vividnext.sodalive.common.LoadingDialog import kr.co.vividnext.sodalive.common.SharedPreferenceManager import kr.co.vividnext.sodalive.databinding.ActivityUserProfileBinding +import kr.co.vividnext.sodalive.databinding.ItemCreatorCommunityBinding import kr.co.vividnext.sodalive.explorer.profile.cheers.UserProfileCheersAdapter +import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityPostListResponse import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAdapter import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAllViewActivity import kr.co.vividnext.sodalive.explorer.profile.fantalk.UserProfileFantalkAllViewActivity import kr.co.vividnext.sodalive.explorer.profile.follow.UserFollowerListActivity import kr.co.vividnext.sodalive.extensions.dpToPx +import kr.co.vividnext.sodalive.extensions.loadUrl import kr.co.vividnext.sodalive.extensions.moneyFormat import kr.co.vividnext.sodalive.live.LiveViewModel import kr.co.vividnext.sodalive.live.reservation.complete.LiveReservationCompleteActivity @@ -110,6 +113,7 @@ class UserProfileActivity : BaseActivity( setupDonationView() setupFanTalkView() setupAudioContentListView() + setupCreatorCommunityView() } private fun hideKeyboard(onAfterExecute: () -> Unit) { @@ -468,6 +472,11 @@ class UserProfileActivity : BaseActivity( dialog.show(screenWidth) } + private fun setupCreatorCommunityView() { + binding.layoutCreatorCommunityPost.ivWrite.setOnClickListener { } + binding.layoutCreatorCommunityPost.llAll.setOnClickListener { } + } + private fun bindData() { liveViewModel.toastLiveData.observe(this) { it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() } @@ -500,6 +509,7 @@ class UserProfileActivity : BaseActivity( setLiveRoomList(it.liveRoomList) setUserDonationRanking(it.userDonationRanking) setActivitySummary(it.activitySummary) + setCommunityPostList(it.communityPostList) } } @@ -668,6 +678,73 @@ class UserProfileActivity : BaseActivity( } } + private fun setCommunityPostList(communityPostList: List) { + if (communityPostList.isEmpty()) { + if (userId == SharedPreferenceManager.userId) { + binding.layoutCreatorCommunityPost.root.visibility = View.VISIBLE + binding.layoutCreatorCommunityPost.llNoPost.visibility = View.VISIBLE + } else { + binding.layoutCreatorCommunityPost.root.visibility = View.GONE + } + + binding.layoutCreatorCommunityPost.hsvPost.visibility = View.GONE + } else { + binding.layoutCreatorCommunityPost.root.visibility = View.VISIBLE + binding.layoutCreatorCommunityPost.llNoPost.visibility = View.GONE + binding.layoutCreatorCommunityPost.hsvPost.visibility = View.VISIBLE + + if (userId == SharedPreferenceManager.userId) { + binding.layoutCreatorCommunityPost.ivWrite.visibility = View.VISIBLE + } else { + binding.layoutCreatorCommunityPost.ivWrite.visibility = View.GONE + } + + communityPostList.forEachIndexed { index, item -> + val layout = ItemCreatorCommunityBinding.inflate( + LayoutInflater.from(this@UserProfileActivity), + binding.layoutCreatorCommunityPost.llContainer, + false + ) + + setCommunityPost(layout, item, index) + } + } + } + + private fun setCommunityPost( + layout: ItemCreatorCommunityBinding, + item: GetCommunityPostListResponse, + index: Int + ) { + layout.ivCreatorProfile.loadUrl(item.creatorProfileUrl) { + crossfade(true) + placeholder(R.drawable.ic_place_holder) + transformations(CircleCropTransformation()) + } + layout.tvCreatorNickname.text = item.creatorNickname + layout.tvDate.text = item.date + + layout.tvContent.text = item.content + layout.ivPostImage.loadUrl(item.imageUrl) { + crossfade(true) + placeholder(R.drawable.ic_place_holder) + transformations(RoundedCornersTransformation(4.7f.dpToPx())) + } + + layout.tvLikeCount.text = "${item.likeCount}" + layout.tvCommentCount.text = "${item.commentCount}" + + layout.root.setOnClickListener { } + + if (index > 0) { + val lp = layout.root.layoutParams as LinearLayout.LayoutParams + lp.marginStart = 13.3f.dpToPx().toInt() + layout.root.layoutParams = lp + } + + binding.layoutCreatorCommunityPost.llContainer.addView(layout.root) + } + private fun reservationRoom(roomId: Long) { liveViewModel.getRoomDetail(roomId) { if (it.manager.id == SharedPreferenceManager.userId) { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt index 070037a..a7518e9 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt @@ -16,6 +16,7 @@ import kr.co.vividnext.sodalive.base.BaseViewModel import kr.co.vividnext.sodalive.common.SharedPreferenceManager import kr.co.vividnext.sodalive.explorer.ExplorerRepository import kr.co.vividnext.sodalive.explorer.profile.cheers.PutModifyCheersRequest +import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityPostListResponse import kr.co.vividnext.sodalive.report.ReportRepository import kr.co.vividnext.sodalive.report.ReportRequest import kr.co.vividnext.sodalive.report.ReportType diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostCommentListResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostCommentListResponse.kt new file mode 100644 index 0000000..9e36e35 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostCommentListResponse.kt @@ -0,0 +1,18 @@ +package kr.co.vividnext.sodalive.explorer.profile.creator_community + +import com.google.gson.annotations.SerializedName + +data class GetCommunityPostCommentListResponse( + @SerializedName("totalCount") val totalCount: Int, + @SerializedName("items") val items: List +) + +data class GetCommunityPostCommentListItem( + @SerializedName("id") val id: Long, + @SerializedName("writerId") val writerId: Long, + @SerializedName("nickname") val nickname: String, + @SerializedName("profileUrl") val profileUrl: String, + @SerializedName("comment") val comment: String, + @SerializedName("date") val date: String, + @SerializedName("replyCount") val replyCount: Int, +) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostListResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostListResponse.kt new file mode 100644 index 0000000..e8d05c0 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/creator_community/GetCommunityPostListResponse.kt @@ -0,0 +1,19 @@ +package kr.co.vividnext.sodalive.explorer.profile.creator_community + +import com.google.gson.annotations.SerializedName + +data class GetCommunityPostListResponse( + @SerializedName("postId") val postId: Long, + @SerializedName("creatorId") val creatorId: Long, + @SerializedName("creatorNickname") val creatorNickname: String, + @SerializedName("creatorProfileUrl") val creatorProfileUrl: String, + @SerializedName("imageUrl") val imageUrl: String?, + @SerializedName("content") val content: String, + @SerializedName("date") val date: String, + @SerializedName("isCommentAvailable") val isCommentAvailable: Boolean, + @SerializedName("isAdult") val isAdult: Boolean, + @SerializedName("isLike") val isLike: Boolean, + @SerializedName("likeCount") val likeCount: Int, + @SerializedName("commentCount") val commentCount: Int, + @SerializedName("firstComment") val firstComment: GetCommunityPostCommentListItem? +) diff --git a/app/src/main/res/drawable/bg_round_corner_10_3_222222.xml b/app/src/main/res/drawable/bg_round_corner_10_3_222222.xml new file mode 100644 index 0000000..ac240b0 --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_10_3_222222.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/drawable/bg_round_corner_13_3_333333_555555.xml b/app/src/main/res/drawable/bg_round_corner_13_3_333333_555555.xml new file mode 100644 index 0000000..901cf8d --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_13_3_333333_555555.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_user_profile.xml b/app/src/main/res/layout/activity_user_profile.xml index 8773e22..b49f36b 100644 --- a/app/src/main/res/layout/activity_user_profile.xml +++ b/app/src/main/res/layout/activity_user_profile.xml @@ -203,10 +203,13 @@ - + android:layout_height="wrap_content" + android:layout_marginHorizontal="13.3dp" + android:layout_marginTop="26.7dp" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/layout_creator_community_post.xml b/app/src/main/res/layout/layout_creator_community_post.xml new file mode 100644 index 0000000..6a85c61 --- /dev/null +++ b/app/src/main/res/layout/layout_creator_community_post.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +