|
|
|
@@ -51,6 +51,7 @@ import kr.co.vividnext.sodalive.live.room.dialog.LiveCancelDialog
|
|
|
|
|
import kr.co.vividnext.sodalive.live.room.dialog.LivePaymentDialog
|
|
|
|
|
import kr.co.vividnext.sodalive.live.room.dialog.LiveRoomPasswordDialog
|
|
|
|
|
import kr.co.vividnext.sodalive.live.room.update.LiveRoomEditActivity
|
|
|
|
|
import kr.co.vividnext.sodalive.main.MainActivity
|
|
|
|
|
import kr.co.vividnext.sodalive.message.MessageActivity
|
|
|
|
|
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
|
|
|
|
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
|
|
|
@@ -105,11 +106,15 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
setupCommunityPost()
|
|
|
|
|
|
|
|
|
|
binding.llReviewLive.setOnClickListener {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), AudioContentAllByThemeActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_THEME_ID, 7L)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), AudioContentAllByThemeActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_THEME_ID, 7L)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message = "라이브를 불러오고 있습니다."
|
|
|
|
@@ -155,8 +160,20 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
private fun setupRecommendLive() {
|
|
|
|
|
binding.layoutRecommendLive.ivMessage.visibility = if (
|
|
|
|
|
SharedPreferenceManager.token.isNotBlank()
|
|
|
|
|
) {
|
|
|
|
|
View.VISIBLE
|
|
|
|
|
} else {
|
|
|
|
|
View.GONE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
binding.layoutRecommendLive.ivMessage.setOnClickListener {
|
|
|
|
|
startActivity(Intent(requireContext(), MessageActivity::class.java))
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(Intent(requireContext(), MessageActivity::class.java))
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val layoutParams = binding
|
|
|
|
@@ -176,11 +193,15 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
|
|
|
|
|
binding.layoutRecommendLive.pager.apply {
|
|
|
|
|
adapter = RecommendLiveAdapter(requireContext(), pagerWidth.roundToInt(), pagerHeight) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), UserProfileActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_USER_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), UserProfileActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_USER_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
} as BaseBannerAdapter<Any>
|
|
|
|
|
|
|
|
|
|
setLifecycleRegistry(lifecycle)
|
|
|
|
@@ -215,14 +236,22 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
private fun setupRecommendChannel() {
|
|
|
|
|
liveRecommendChannelAdapter = LiveRecommendChannelAdapter(
|
|
|
|
|
onClick = {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), UserProfileActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_USER_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), UserProfileActivity::class.java).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_USER_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onClickMore = {
|
|
|
|
|
startActivity(Intent(requireContext(), FollowingCreatorActivity::class.java))
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(Intent(requireContext(), FollowingCreatorActivity::class.java))
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -264,8 +293,16 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
binding.layoutRecommendChannel.rvRecommendChannel.adapter = liveRecommendChannelAdapter
|
|
|
|
|
binding.layoutRecommendChannel.ivSwitch.setOnClickListener {
|
|
|
|
|
viewModel.toggleIsFollowedCreatorLive()
|
|
|
|
|
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.VISIBLE
|
|
|
|
|
binding.layoutRecommendChannel.ivSwitch.visibility = View.VISIBLE
|
|
|
|
|
binding.layoutRecommendChannel.ivSwitch.setOnClickListener {
|
|
|
|
|
viewModel.toggleIsFollowedCreatorLive()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.GONE
|
|
|
|
|
binding.layoutRecommendChannel.ivSwitch.visibility = View.GONE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
viewModel.recommendChannelLiveData.observe(viewLifecycleOwner) {
|
|
|
|
@@ -297,7 +334,11 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
.layoutLiveNow
|
|
|
|
|
.tvAllView
|
|
|
|
|
.setOnClickListener {
|
|
|
|
|
startActivity(Intent(requireContext(), LiveNowAllActivity::class.java))
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(Intent(requireContext(), LiveNowAllActivity::class.java))
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
binding
|
|
|
|
@@ -389,20 +430,24 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
.rvSudaReservation
|
|
|
|
|
|
|
|
|
|
liveReservationAdapter = LiveReservationAdapter(isMain = true) {
|
|
|
|
|
val detailFragment = LiveRoomDetailFragment(
|
|
|
|
|
it.roomId,
|
|
|
|
|
onClickParticipant = {},
|
|
|
|
|
onClickReservation = { reservationRoom(it.roomId) },
|
|
|
|
|
onClickModify = { roomDetailResponse -> modifyLive(roomDetailResponse) },
|
|
|
|
|
onClickStart = { startLive(it.roomId) },
|
|
|
|
|
onClickCancel = { cancelLive(it.roomId) }
|
|
|
|
|
)
|
|
|
|
|
if (detailFragment.isAdded) return@LiveReservationAdapter
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
val detailFragment = LiveRoomDetailFragment(
|
|
|
|
|
it.roomId,
|
|
|
|
|
onClickParticipant = {},
|
|
|
|
|
onClickReservation = { reservationRoom(it.roomId) },
|
|
|
|
|
onClickModify = { roomDetailResponse -> modifyLive(roomDetailResponse) },
|
|
|
|
|
onClickStart = { startLive(it.roomId) },
|
|
|
|
|
onClickCancel = { cancelLive(it.roomId) }
|
|
|
|
|
)
|
|
|
|
|
if (detailFragment.isAdded) return@LiveReservationAdapter
|
|
|
|
|
|
|
|
|
|
detailFragment.show(
|
|
|
|
|
requireActivity().supportFragmentManager,
|
|
|
|
|
detailFragment.tag
|
|
|
|
|
)
|
|
|
|
|
detailFragment.show(
|
|
|
|
|
requireActivity().supportFragmentManager,
|
|
|
|
|
detailFragment.tag
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recyclerView.layoutManager = LinearLayoutManager(
|
|
|
|
@@ -465,9 +510,16 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
binding.layoutLiveReservation.tvAllView.setOnClickListener {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(requireContext(), LiveReservationAllActivity::class.java)
|
|
|
|
|
)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(
|
|
|
|
|
requireContext(),
|
|
|
|
|
LiveReservationAllActivity::class.java
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -480,17 +532,21 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
|
|
|
|
|
binding.eventBannerSlider.apply {
|
|
|
|
|
adapter = EventBannerAdapter(requireContext()) {
|
|
|
|
|
if (it.detailImageUrl != null) {
|
|
|
|
|
val intent = Intent(requireActivity(), EventDetailActivity::class.java)
|
|
|
|
|
intent.putExtra(Constants.EXTRA_EVENT, it)
|
|
|
|
|
startActivity(intent)
|
|
|
|
|
} else if (!it.link.isNullOrBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(
|
|
|
|
|
Intent.ACTION_VIEW,
|
|
|
|
|
Uri.parse(it.link)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
if (it.detailImageUrl != null) {
|
|
|
|
|
val intent = Intent(requireActivity(), EventDetailActivity::class.java)
|
|
|
|
|
intent.putExtra(Constants.EXTRA_EVENT, it)
|
|
|
|
|
startActivity(intent)
|
|
|
|
|
} else if (!it.link.isNullOrBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(
|
|
|
|
|
Intent.ACTION_VIEW,
|
|
|
|
|
Uri.parse(it.link)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
} as BaseBannerAdapter<Any>
|
|
|
|
|
setLifecycleRegistry(lifecycle)
|
|
|
|
@@ -558,25 +614,29 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
creatorCommunityAdapter = CreatorCommunityAdapter {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(
|
|
|
|
|
requireActivity(),
|
|
|
|
|
CreatorCommunityAllActivity::class.java
|
|
|
|
|
).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
|
|
|
startActivity(
|
|
|
|
|
Intent(
|
|
|
|
|
requireActivity(),
|
|
|
|
|
CreatorCommunityAllActivity::class.java
|
|
|
|
|
).apply {
|
|
|
|
|
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, it)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
(requireActivity() as MainActivity).showLoginActivity()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
binding.rvCommunityPost.adapter = creatorCommunityAdapter
|
|
|
|
|
recyclerView.adapter = creatorCommunityAdapter
|
|
|
|
|
|
|
|
|
|
viewModel.communityPostItemLiveData.observe(viewLifecycleOwner) {
|
|
|
|
|
if (it.isNotEmpty()) {
|
|
|
|
|
binding.rvCommunityPost.visibility = View.VISIBLE
|
|
|
|
|
recyclerView.visibility = View.VISIBLE
|
|
|
|
|
creatorCommunityAdapter.items.clear()
|
|
|
|
|
creatorCommunityAdapter.items.addAll(it)
|
|
|
|
|
creatorCommunityAdapter.notifyDataSetChanged()
|
|
|
|
|
} else {
|
|
|
|
|
binding.rvCommunityPost.visibility = View.GONE
|
|
|
|
|
recyclerView.visibility = View.GONE
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|