From 0c7c7946c62bb83c11f6b62b3fe343df95c6990d Mon Sep 17 00:00:00 2001 From: klaus Date: Wed, 16 Jul 2025 22:07:07 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A9=94=EC=9D=B8=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=20-=20=EC=83=88=EB=A1=9C=EC=9A=B4=20UI=EC=9D=98=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EA=B3=A8=EA=B2=A9=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/SharedPreferenceManager.kt | 6 - .../vividnext/sodalive/live/LiveFragment.kt | 190 ++++++------------ .../vividnext/sodalive/live/LiveViewModel.kt | 53 +---- .../LiveRecommendChannelAdapter.kt | 10 +- .../drawable/bg_round_corner_16_263238.xml | 5 + app/src/main/res/layout/fragment_live.xml | 138 ++++++++----- .../res/layout/item_recommend_channel.xml | 10 +- app/src/main/res/layout/layout_live_now.xml | 46 ++--- .../layout/layout_live_recommend_channel.xml | 68 +------ .../res/layout/layout_live_reservation.xml | 42 ++-- .../main/res/layout/layout_recommend_live.xml | 42 +--- 11 files changed, 219 insertions(+), 391 deletions(-) create mode 100644 app/src/main/res/drawable/bg_round_corner_16_263238.xml diff --git a/app/src/main/java/kr/co/vividnext/sodalive/common/SharedPreferenceManager.kt b/app/src/main/java/kr/co/vividnext/sodalive/common/SharedPreferenceManager.kt index 4eadf334..5ee58978 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/common/SharedPreferenceManager.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/common/SharedPreferenceManager.kt @@ -141,12 +141,6 @@ object SharedPreferenceManager { sharedPreferences[Constants.PREF_PUSH_TOKEN] = value } - var isFollowedCreatorLive: Boolean - get() = sharedPreferences[Constants.PREF_IS_FOLLOWED_CREATOR_LIVE, false] - set(value) { - sharedPreferences[Constants.PREF_IS_FOLLOWED_CREATOR_LIVE] = value - } - var isContentPlayLoop: Boolean get() = sharedPreferences[Constants.PREF_IS_CONTENT_PLAY_LOOP, false] set(value) { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/LiveFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/LiveFragment.kt index 4ec2c9ab..54a088bd 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/LiveFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/LiveFragment.kt @@ -5,7 +5,6 @@ import android.app.Activity import android.content.Intent import android.content.SharedPreferences import android.graphics.Rect -import android.net.Uri import android.os.Bundle import android.os.Handler import android.os.Looper @@ -23,7 +22,6 @@ import com.zhpan.indicator.enums.IndicatorSlideMode import com.zhpan.indicator.enums.IndicatorStyle import kr.co.vividnext.sodalive.R import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService -import kr.co.vividnext.sodalive.audio_content.all.by_theme.AudioContentAllByThemeActivity import kr.co.vividnext.sodalive.audio_content.player.AudioContentPlayerService import kr.co.vividnext.sodalive.base.BaseFragment import kr.co.vividnext.sodalive.common.Constants @@ -36,7 +34,6 @@ import kr.co.vividnext.sodalive.explorer.profile.creator_community.all.CreatorCo import kr.co.vividnext.sodalive.extensions.dpToPx import kr.co.vividnext.sodalive.extensions.moneyFormat import kr.co.vividnext.sodalive.following.FollowingCreatorActivity -import kr.co.vividnext.sodalive.live.event_banner.EventBannerAdapter import kr.co.vividnext.sodalive.live.now.LiveNowAdapter import kr.co.vividnext.sodalive.live.now.all.LiveNowAllActivity import kr.co.vividnext.sodalive.live.recommend.RecommendLiveAdapter @@ -54,7 +51,8 @@ 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.mypage.can.charge.CanChargeActivity +import kr.co.vividnext.sodalive.search.SearchActivity import kr.co.vividnext.sodalive.settings.notification.MemberRole import org.koin.android.ext.android.inject import java.text.SimpleDateFormat @@ -121,24 +119,6 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl SharedPreferenceManager.registerOnSharedPreferenceChangeListener(preferenceChangeListener) setupView() - setupRecommendLive() - setupRecommendChannel() - setupLiveNow() - setupLiveReservation() - setupEvent() - setupCommunityPost() - - binding.llReviewLive.setOnClickListener { - if (SharedPreferenceManager.token.isNotBlank()) { - startActivity( - Intent(requireContext(), AudioContentAllByThemeActivity::class.java).apply { - putExtra(Constants.EXTRA_THEME_ID, 7L) - } - ) - } else { - (requireActivity() as MainActivity).showLoginActivity() - } - } message = "라이브를 불러오고 있습니다." viewModel.getSummary() @@ -175,6 +155,48 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl val intent = Intent(requireContext(), LiveRoomCreateActivity::class.java) activityResultLauncher.launch(intent) } + + setupToolbar() + setupLiveNow() + setupCommunityPost() + setupRecommendLive() + setupRecommendChannel() + setupLiveReservation() + } + + private fun setupToolbar() { + if (SharedPreferenceManager.token.isNotBlank()) { + binding.llShortIcon.visibility = View.VISIBLE + + binding.ivSearch.setOnClickListener { + startActivity( + Intent( + requireContext(), + SearchActivity::class.java + ) + ) + } + + binding.ivCharge.setOnClickListener { + startActivity( + Intent( + requireContext(), + CanChargeActivity::class.java + ) + ) + } + + binding.ivMessage.setOnClickListener { + startActivity( + Intent( + requireContext(), + MessageActivity::class.java + ) + ) + } + } else { + binding.llShortIcon.visibility = View.GONE + } } private fun refreshSummary() { @@ -188,22 +210,6 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl @SuppressLint("NotifyDataSetChanged") private fun setupRecommendLive() { - binding.layoutRecommendLive.ivMessage.visibility = if ( - SharedPreferenceManager.token.isNotBlank() - ) { - View.VISIBLE - } else { - View.GONE - } - - binding.layoutRecommendLive.ivMessage.setOnClickListener { - if (SharedPreferenceManager.token.isNotBlank()) { - startActivity(Intent(requireContext(), MessageActivity::class.java)) - } else { - (requireActivity() as MainActivity).showLoginActivity() - } - } - val layoutParams = binding .layoutRecommendLive .pager @@ -255,6 +261,12 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl if (it.isNotEmpty()) { binding.layoutRecommendLive.root.visibility = View.VISIBLE binding.layoutRecommendLive.pager.refreshData(it) + + if (it.size > 1) { + binding.layoutRecommendLive.indicator2.visibility = View.VISIBLE + } else { + binding.layoutRecommendLive.indicator2.visibility = View.GONE + } } else { binding.layoutRecommendLive.root.visibility = View.GONE } @@ -304,17 +316,17 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl when (parent.getChildAdapterPosition(view)) { 0 -> { outRect.left = 0.dpToPx().toInt() - outRect.right = 8.3f.dpToPx().toInt() + outRect.right = 8f.dpToPx().toInt() } liveRecommendChannelAdapter.itemCount - 1 -> { - outRect.left = 8.3f.dpToPx().toInt() + outRect.left = 8f.dpToPx().toInt() outRect.right = 0.dpToPx().toInt() } else -> { - outRect.left = 8.3f.dpToPx().toInt() - outRect.right = 8.3f.dpToPx().toInt() + outRect.left = 8f.dpToPx().toInt() + outRect.right = 8f.dpToPx().toInt() } } } @@ -323,36 +335,16 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl binding.layoutRecommendChannel.rvRecommendChannel.adapter = liveRecommendChannelAdapter if (SharedPreferenceManager.token.isNotBlank()) { - binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.VISIBLE - binding.layoutRecommendChannel.ivSwitch.visibility = View.VISIBLE - binding.layoutRecommendChannel.ivSwitch.setOnClickListener { - viewModel.toggleIsFollowedCreatorLive() + viewModel.recommendChannelLiveData.observe(viewLifecycleOwner) { + if (it.isNotEmpty()) { + binding.layoutRecommendChannel.root.visibility = View.VISIBLE + liveRecommendChannelAdapter.addItems(it) + } else { + binding.layoutRecommendChannel.root.visibility = View.GONE + } } } else { - binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.GONE - binding.layoutRecommendChannel.ivSwitch.visibility = View.GONE - } - - viewModel.recommendChannelLiveData.observe(viewLifecycleOwner) { - binding.layoutRecommendChannel.root.visibility = View.VISIBLE - liveRecommendChannelAdapter.addItems(it) - binding.layoutRecommendChannel.rvRecommendChannel.requestLayout() - binding.layoutRecommendChannel.root.requestLayout() - } - - viewModel.isFollowedCreatorLive.observe(viewLifecycleOwner) { - liveRecommendChannelAdapter.isFollowedCreatorLive = it - liveRecommendChannelAdapter.clear() - - if (it) { - binding.layoutRecommendChannel.ivSwitch.setImageResource(R.drawable.btn_toggle_on_big) - binding.layoutRecommendChannel.llTitle2.visibility = View.VISIBLE - binding.layoutRecommendChannel.llTitle1.visibility = View.GONE - } else { - binding.layoutRecommendChannel.ivSwitch.setImageResource(R.drawable.btn_toggle_off_big) - binding.layoutRecommendChannel.llTitle1.visibility = View.VISIBLE - binding.layoutRecommendChannel.llTitle2.visibility = View.GONE - } + binding.layoutRecommendChannel.root.visibility = View.GONE } } @@ -376,7 +368,7 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl val recyclerView = binding .layoutLiveNow - .rvSudaNow + .rvLiveNow liveNowAdapter = LiveNowAdapter { if (SharedPreferenceManager.token.isNotBlank()) { @@ -459,7 +451,7 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl private fun setupLiveReservation() { val recyclerView = binding .layoutLiveReservation - .rvSudaReservation + .rvLiveReservation liveReservationAdapter = LiveReservationAdapter(isMain = true) { if (SharedPreferenceManager.token.isNotBlank()) { @@ -555,58 +547,6 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl } } - @SuppressLint("NotifyDataSetChanged") - private fun setupEvent() { - val imageSliderLp = binding.eventBannerSlider.layoutParams - imageSliderLp.width = screenWidth - imageSliderLp.height = (screenWidth * 300) / 1000 - binding.eventBannerSlider.layoutParams = imageSliderLp - - binding.eventBannerSlider.apply { - adapter = EventBannerAdapter(requireContext()) { - 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 - setLifecycleRegistry(lifecycle) - setScrollDuration(800) - }.create() - - binding.eventBannerSlider - .setIndicatorView(binding.indicator) - .setIndicatorStyle(IndicatorStyle.ROUND_RECT) - .setIndicatorSlideMode(IndicatorSlideMode.SMOOTH) - .setIndicatorVisibility(View.GONE) - .setIndicatorSliderColor( - ContextCompat.getColor(requireContext(), R.color.color_909090), - ContextCompat.getColor(requireContext(), R.color.color_3bb9f1) - ) - .setIndicatorSliderWidth(4f.dpToPx().toInt(), 10f.dpToPx().toInt()) - .setIndicatorHeight(4f.dpToPx().toInt()) - - viewModel.eventLiveData.observe(viewLifecycleOwner) { - if (it.isNotEmpty()) { - binding.eventBannerSlider.visibility = View.VISIBLE - binding.eventBannerSlider.refreshData(it) - } else { - binding.eventBannerSlider.visibility = View.GONE - } - } - } - @SuppressLint("NotifyDataSetChanged") private fun setupCommunityPost() { val recyclerView = binding.rvCommunityPost @@ -664,11 +604,13 @@ class LiveFragment : BaseFragment(FragmentLiveBinding::infl viewModel.communityPostItemLiveData.observe(viewLifecycleOwner) { if (it.isNotEmpty()) { recyclerView.visibility = View.VISIBLE + binding.tvCommunityPost.visibility = View.VISIBLE creatorCommunityAdapter.items.clear() creatorCommunityAdapter.items.addAll(it) creatorCommunityAdapter.notifyDataSetChanged() } else { recyclerView.visibility = View.GONE + binding.tvCommunityPost.visibility = View.GONE } } } diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/LiveViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/LiveViewModel.kt index d37af2a5..4e2c6849 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/LiveViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/LiveViewModel.kt @@ -41,12 +41,6 @@ class LiveViewModel( val recommendLiveData: LiveData> get() = _recommendLiveData - private val _isFollowedCreatorLive = MutableLiveData( - SharedPreferenceManager.isFollowedCreatorLive - ) - val isFollowedCreatorLive: LiveData - get() = _isFollowedCreatorLive - private val _recommendChannelLiveData = MutableLiveData>() val recommendChannelLiveData: LiveData> get() = _recommendChannelLiveData @@ -71,17 +65,6 @@ class LiveViewModel( var isLast = false private val pageSize = 10 - fun toggleIsFollowedCreatorLive() { - val isOn = !_isFollowedCreatorLive.value!! - SharedPreferenceManager.isFollowedCreatorLive = isOn - _isFollowedCreatorLive.value = isOn - if (_isFollowedCreatorLive.value!!) { - getFollowedChannelList() - } else { - getRecommendChannelList() - } - } - private fun getFollowedChannelList() { compositeDisposable.add( liveRecommendRepository.getFollowingChannelList( @@ -112,36 +95,6 @@ class LiveViewModel( ) } - private fun getRecommendChannelList() { - compositeDisposable.add( - liveRecommendRepository.getRecommendChannelList( - token = "Bearer ${SharedPreferenceManager.token}" - ) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe( - { - if (it.success && it.data != null) { - _recommendChannelLiveData.postValue(it.data!!) - } else { - if (it.message != null) { - _toastLiveData.postValue(it.message) - } else { - _toastLiveData.postValue( - "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요." - ) - } - } - }, - { - _isLoading.value = false - it.message?.let { message -> Logger.e(message) } - _toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.") - } - ) - ) - } - private fun getLatestPostListFromCreatorsYouFollow() { compositeDisposable.add( creatorCommunityRepository.getLatestPostListFromCreatorsYouFollow( @@ -174,13 +127,9 @@ class LiveViewModel( fun getSummary() { if (!_isLoading.value!!) { - if (_isFollowedCreatorLive.value!!) { - getFollowedChannelList() - } else { - getRecommendChannelList() - } if (SharedPreferenceManager.token.isNotBlank()) { + getFollowedChannelList() getLatestPostListFromCreatorsYouFollow() } diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/recommend_channel/LiveRecommendChannelAdapter.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/recommend_channel/LiveRecommendChannelAdapter.kt index 7d117a06..0a617551 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/recommend_channel/LiveRecommendChannelAdapter.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/recommend_channel/LiveRecommendChannelAdapter.kt @@ -17,8 +17,6 @@ class LiveRecommendChannelAdapter( private val onClickMore: () -> Unit, ) : RecyclerView.Adapter() { - var isFollowedCreatorLive = false - private val items = mutableListOf() class FooterViewHolder( @@ -112,13 +110,7 @@ class LiveRecommendChannelAdapter( } } - override fun getItemCount(): Int { - return if (isFollowedCreatorLive) { - items.size + 1 - } else { - items.size - } - } + override fun getItemCount() = items.size + 1 override fun getItemViewType(position: Int): Int { return if (position == items.size) { diff --git a/app/src/main/res/drawable/bg_round_corner_16_263238.xml b/app/src/main/res/drawable/bg_round_corner_16_263238.xml new file mode 100644 index 00000000..068784ba --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_16_263238.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/layout/fragment_live.xml b/app/src/main/res/layout/fragment_live.xml index cb8474e4..3d449d56 100644 --- a/app/src/main/res/layout/fragment_live.xml +++ b/app/src/main/res/layout/fragment_live.xml @@ -4,86 +4,114 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + + + + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/main_toolbar"> - - - - - - - - - + android:orientation="vertical" + android:paddingVertical="24dp"> + android:layout_marginBottom="48dp" /> - - - + android:layout_marginHorizontal="24dp" + android:layout_marginBottom="14dp" + android:fontFamily="@font/pretendard_bold" + android:text="커뮤니티" + android:textColor="@color/color_3bb9f1" + android:textSize="26sp" /> + + + + + android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/item_recommend_channel.xml b/app/src/main/res/layout/item_recommend_channel.xml index 3b67fc3c..7622c8a3 100644 --- a/app/src/main/res/layout/item_recommend_channel.xml +++ b/app/src/main/res/layout/item_recommend_channel.xml @@ -29,7 +29,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:background="@drawable/bg_round_corner_6_7_3bb9f1" - android:fontFamily="@font/gmarket_sans_bold" + android:fontFamily="@font/pretendard_bold" android:paddingHorizontal="5.7dp" android:paddingVertical="2.7dp" android:text="LIVE" @@ -42,12 +42,12 @@ android:id="@+id/tv_recommend_channel_nickname" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="11.3dp" + android:layout_marginTop="12dp" android:ellipsize="end" - android:fontFamily="@font/gmarket_sans_medium" + android:fontFamily="@font/pretendard_regular" android:lines="1" - android:textColor="@color/color_bbbbbb" - android:textSize="11.3sp" + android:textColor="@color/white" + android:textSize="14sp" tools:text="검은사신" /> diff --git a/app/src/main/res/layout/layout_live_now.xml b/app/src/main/res/layout/layout_live_now.xml index 38ef863b..e50ca089 100644 --- a/app/src/main/res/layout/layout_live_now.xml +++ b/app/src/main/res/layout/layout_live_now.xml @@ -8,7 +8,7 @@ + android:paddingHorizontal="24dp"> + android:textColor="@color/color_3bb9f1" + android:textSize="26sp" /> + android:textColor="@color/white" + android:textSize="26sp" /> + android:textColor="#78909C" + android:textSize="14sp" /> @@ -86,8 +86,8 @@ android:id="@+id/ll_refresh" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="13.3dp" - android:layout_marginHorizontal="13.3dp" + android:layout_marginHorizontal="24dp" + android:layout_marginTop="16dp" android:background="@drawable/bg_round_corner_26_7_transparent_909090" android:gravity="center" android:paddingVertical="11dp"> @@ -102,7 +102,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" - android:fontFamily="@font/gmarket_sans_medium" + android:fontFamily="@font/pretendard_regular" android:text="새로고침" android:textSize="14.7sp" /> diff --git a/app/src/main/res/layout/layout_live_recommend_channel.xml b/app/src/main/res/layout/layout_live_recommend_channel.xml index 871a6392..d41b16c2 100644 --- a/app/src/main/res/layout/layout_live_recommend_channel.xml +++ b/app/src/main/res/layout/layout_live_recommend_channel.xml @@ -6,84 +6,38 @@ + android:layout_height="wrap_content" + android:paddingHorizontal="24dp"> - - - - - - - + android:textColor="@color/color_3bb9f1" + android:textSize="26sp" /> + android:textColor="@color/white" + android:textSize="26sp" /> - - - - + android:layout_marginTop="16dp" + android:clipToPadding="false" + android:paddingHorizontal="24dp" /> diff --git a/app/src/main/res/layout/layout_live_reservation.xml b/app/src/main/res/layout/layout_live_reservation.xml index 923dfe07..f1b5ca4d 100644 --- a/app/src/main/res/layout/layout_live_reservation.xml +++ b/app/src/main/res/layout/layout_live_reservation.xml @@ -8,7 +8,7 @@ + android:layout_marginHorizontal="24dp"> + android:fontFamily="@font/pretendard_bold" + android:text="라이브 " + android:textColor="@color/color_3bb9f1" + android:textSize="26sp" /> + android:textColor="@color/white" + android:textSize="26sp" /> + android:textColor="#78909C" + android:textSize="14sp" /> diff --git a/app/src/main/res/layout/layout_recommend_live.xml b/app/src/main/res/layout/layout_recommend_live.xml index 117b6935..149646e2 100644 --- a/app/src/main/res/layout/layout_recommend_live.xml +++ b/app/src/main/res/layout/layout_recommend_live.xml @@ -4,53 +4,15 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - - - - - - - - - - - + android:layout_height="wrap_content" /> + android:layout_marginTop="28dp" />