크리에이터 채널 - 콘텐츠 영역 추가
This commit is contained in:
		| @@ -11,8 +11,8 @@ data class GetCreatorProfileResponse( | ||||
|     val similarCreatorList: List<SimilarCreatorResponse>, | ||||
|     @SerializedName("liveRoomList") | ||||
|     val liveRoomList: List<LiveRoomResponse>, | ||||
|     @SerializedName("audioContentList") | ||||
|     val audioContentList: List<GetAudioContentListItem>, | ||||
|     @SerializedName("contentList") | ||||
|     val contentList: List<GetAudioContentListItem>, | ||||
|     @SerializedName("notice") | ||||
|     val notice: String, | ||||
|     @SerializedName("cheers") | ||||
|   | ||||
| @@ -23,6 +23,10 @@ import androidx.recyclerview.widget.RecyclerView | ||||
| import coil.load | ||||
| import coil.transform.CircleCropTransformation | ||||
| import kr.co.vividnext.sodalive.R | ||||
| import kr.co.vividnext.sodalive.audio_content.AudioContentActivity | ||||
| import kr.co.vividnext.sodalive.audio_content.AudioContentAdapter | ||||
| import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity | ||||
| import kr.co.vividnext.sodalive.audio_content.upload.AudioContentUploadActivity | ||||
| import kr.co.vividnext.sodalive.base.BaseActivity | ||||
| import kr.co.vividnext.sodalive.common.Constants | ||||
| import kr.co.vividnext.sodalive.common.LoadingDialog | ||||
| @@ -56,6 +60,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|     private lateinit var imm: InputMethodManager | ||||
|     private lateinit var loadingDialog: LoadingDialog | ||||
|     private lateinit var liveAdapter: UserProfileLiveAdapter | ||||
|     private lateinit var audioContentAdapter: AudioContentAdapter | ||||
|     private lateinit var donationAdapter: UserProfileDonationAdapter | ||||
|     private lateinit var similarCreatorAdapter: UserProfileSimilarCreatorAdapter | ||||
|     private lateinit var cheersAdapter: UserProfileCheersAdapter | ||||
| @@ -118,6 +123,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|         setupDonationView() | ||||
|         setupSimilarCreatorView() | ||||
|         setupFanTalkView() | ||||
|         setupAudioContentListView() | ||||
|     } | ||||
|  | ||||
|     private fun hideKeyboard(onAfterExecute: () -> Unit) { | ||||
| @@ -432,6 +438,52 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|         rvCheers.adapter = cheersAdapter | ||||
|     } | ||||
|  | ||||
|     private fun setupAudioContentListView() { | ||||
|         binding.layoutUserProfileAudioContent.tvAll.setOnClickListener { | ||||
|             val intent = Intent(applicationContext, AudioContentActivity::class.java) | ||||
|             intent.putExtra(Constants.EXTRA_USER_ID, userId) | ||||
|             startActivity(intent) | ||||
|         } | ||||
|  | ||||
|         val recyclerView = binding.layoutUserProfileAudioContent.rvAudioContent | ||||
|         audioContentAdapter = AudioContentAdapter { | ||||
|             val intent = Intent(applicationContext, AudioContentDetailActivity::class.java) | ||||
|                 .apply { | ||||
|                     putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, it) | ||||
|                 } | ||||
|             startActivity(intent) | ||||
|         } | ||||
|  | ||||
|         recyclerView.layoutManager = LinearLayoutManager( | ||||
|             applicationContext, | ||||
|             LinearLayoutManager.VERTICAL, | ||||
|             false | ||||
|         ) | ||||
|  | ||||
|         recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() { | ||||
|             override fun getItemOffsets( | ||||
|                 outRect: Rect, | ||||
|                 view: View, | ||||
|                 parent: RecyclerView, | ||||
|                 state: RecyclerView.State | ||||
|             ) { | ||||
|                 super.getItemOffsets(outRect, view, parent, state) | ||||
|  | ||||
|                 when (parent.getChildAdapterPosition(view)) { | ||||
|                     audioContentAdapter.itemCount - 1 -> { | ||||
|                         outRect.bottom = 0 | ||||
|                     } | ||||
|  | ||||
|                     else -> { | ||||
|                         outRect.bottom = 13.3f.dpToPx().toInt() | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         }) | ||||
|  | ||||
|         recyclerView.adapter = audioContentAdapter | ||||
|     } | ||||
|  | ||||
|     private fun showCheersReportPopup(cheersId: Long) { | ||||
|         val dialog = CheersReportDialog(this, layoutInflater) { | ||||
|             if (it.isBlank()) { | ||||
| @@ -477,6 +529,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|             setCheers(it.cheers) | ||||
|             setCreatorProfile(it.creator) | ||||
|             setCreatorNotice(it.notice, it.creator.creatorId) | ||||
|             setAudioContentList(it.contentList) | ||||
|             setLiveRoomList(it.liveRoomList) | ||||
|             setSimilarCreatorList(it.similarCreatorList) | ||||
|             setUserDonationRanking(it.userDonationRanking) | ||||
| @@ -625,6 +678,36 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @SuppressLint("NotifyDataSetChanged") | ||||
|     private fun setAudioContentList(audioContentList: List<GetAudioContentListItem>) { | ||||
|         binding.layoutUserProfileAudioContent.root.visibility = | ||||
|             if (userId == SharedPreferenceManager.userId || audioContentList.isNotEmpty()) { | ||||
|                 View.VISIBLE | ||||
|             } else { | ||||
|                 View.GONE | ||||
|             } | ||||
|  | ||||
|         if (userId == SharedPreferenceManager.userId) { | ||||
|             binding.layoutUserProfileAudioContent.tvTitle.text = "내 콘텐츠" | ||||
|             binding.layoutUserProfileAudioContent.tvNewContent.setOnClickListener { | ||||
|                 startActivity( | ||||
|                     Intent( | ||||
|                         applicationContext, | ||||
|                         AudioContentUploadActivity::class.java | ||||
|                     ) | ||||
|                 ) | ||||
|             } | ||||
|             binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.VISIBLE | ||||
|         } else { | ||||
|             binding.layoutUserProfileAudioContent.tvTitle.text = "콘텐츠" | ||||
|             binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.GONE | ||||
|         } | ||||
|  | ||||
|         audioContentAdapter.items.clear() | ||||
|         audioContentAdapter.items.addAll(audioContentList) | ||||
|         audioContentAdapter.notifyDataSetChanged() | ||||
|     } | ||||
|  | ||||
|     @SuppressLint("NotifyDataSetChanged") | ||||
|     private fun setLiveRoomList(liveRoomList: List<LiveRoomResponse>) { | ||||
|         if (liveRoomList.isEmpty()) { | ||||
|   | ||||
| @@ -237,6 +237,15 @@ | ||||
|                     android:visibility="gone" /> | ||||
|             </RelativeLayout> | ||||
|  | ||||
|             <include | ||||
|                 android:id="@+id/layout_user_profile_audio_content" | ||||
|                 layout="@layout/layout_user_profile_audio_content" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginHorizontal="13.3dp" | ||||
|                 android:layout_marginTop="46.7dp" | ||||
|                 android:visibility="gone" /> | ||||
|  | ||||
|             <include | ||||
|                 android:id="@+id/layout_user_profile_live" | ||||
|                 layout="@layout/layout_user_profile_live" | ||||
|   | ||||
| @@ -0,0 +1,58 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:orientation="vertical"> | ||||
|  | ||||
|     <RelativeLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content"> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/tv_title" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignParentStart="true" | ||||
|             android:fontFamily="@font/gmarket_sans_bold" | ||||
|             android:text="콘텐츠" | ||||
|             android:textColor="@color/color_eeeeee" | ||||
|             android:textSize="16.7sp" /> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/tv_all" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignParentEnd="true" | ||||
|             android:fontFamily="@font/gmarket_sans_light" | ||||
|             android:gravity="center" | ||||
|             android:text="전체보기" | ||||
|             android:textColor="@color/color_bbbbbb" | ||||
|             android:textSize="11.3sp" /> | ||||
|     </RelativeLayout> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/tv_new_content" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="21.3dp" | ||||
|         android:background="@drawable/bg_round_corner_4_7_9970ff" | ||||
|         android:fontFamily="@font/gmarket_sans_bold" | ||||
|         android:gravity="center" | ||||
|         android:paddingVertical="17dp" | ||||
|         android:text="새로운 콘텐츠 등록하기" | ||||
|         android:textColor="@color/white" | ||||
|         android:textSize="14.7sp" | ||||
|         android:visibility="gone" /> | ||||
|  | ||||
|     <androidx.recyclerview.widget.RecyclerView | ||||
|         android:id="@+id/rv_audio_content" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:clipToPadding="false" | ||||
|         android:paddingVertical="20dp" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toBottomOf="@+id/tv_new_content" /> | ||||
|  | ||||
| </LinearLayout> | ||||
		Reference in New Issue
	
	Block a user