크리에이터 채널 - 커뮤니티 영역 추가

This commit is contained in:
2023-12-22 19:48:05 +09:00
parent fbcdbf3b48
commit 5db097d67c
10 changed files with 357 additions and 6 deletions

View File

@@ -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<GetAudioContentListItem>,
@SerializedName("notice")
val notice: String,
@SerializedName("communityPostList")
val communityPostList: List<GetCommunityPostListResponse>,
@SerializedName("cheers")
val cheers: GetCheersResponse,
@SerializedName("activitySummary")

View File

@@ -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<ActivityUserProfileBinding>(
setupDonationView()
setupFanTalkView()
setupAudioContentListView()
setupCreatorCommunityView()
}
private fun hideKeyboard(onAfterExecute: () -> Unit) {
@@ -468,6 +472,11 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
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<ActivityUserProfileBinding>(
setLiveRoomList(it.liveRoomList)
setUserDonationRanking(it.userDonationRanking)
setActivitySummary(it.activitySummary)
setCommunityPostList(it.communityPostList)
}
}
@@ -668,6 +678,73 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
}
}
private fun setCommunityPostList(communityPostList: List<GetCommunityPostListResponse>) {
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) {

View File

@@ -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

View File

@@ -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<GetCommunityPostCommentListItem>
)
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,
)

View File

@@ -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?
)