feat: 마이페이지
- 신규 UI 적용
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package kr.co.vividnext.sodalive.common
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import kr.co.vividnext.sodalive.R
|
||||
|
||||
/**
|
||||
* Function Button Helper
|
||||
* include된 function button 레이아웃에 이미지와 텍스트를 설정하는 헬퍼 클래스
|
||||
*/
|
||||
object FunctionButtonHelper {
|
||||
|
||||
/**
|
||||
* Function button에 이미지와 텍스트를 설정합니다.
|
||||
*
|
||||
* @param buttonView include된 버튼 뷰
|
||||
* @param iconRes 아이콘 drawable 리소스 ID
|
||||
* @param title 버튼 제목
|
||||
* @param clickListener 클릭 리스너 (optional)
|
||||
*/
|
||||
fun setupFunctionButton(
|
||||
buttonView: View,
|
||||
@DrawableRes iconRes: Int,
|
||||
title: String,
|
||||
clickListener: View.OnClickListener? = null
|
||||
) {
|
||||
val iconImageView = buttonView.findViewById<ImageView>(R.id.iv_function_icon)
|
||||
val titleTextView = buttonView.findViewById<TextView>(R.id.tv_function_title)
|
||||
|
||||
iconImageView.setImageResource(iconRes)
|
||||
titleTextView.text = title
|
||||
|
||||
clickListener?.let { buttonView.setOnClickListener(it) }
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,11 @@ import com.google.gson.Gson
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.box.AudioContentBoxActivity
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.FunctionButtonHelper
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.FragmentMyBinding
|
||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
import kr.co.vividnext.sodalive.following.FollowingCreatorActivity
|
||||
import kr.co.vividnext.sodalive.live.reservation_status.LiveReservationStatusActivity
|
||||
import kr.co.vividnext.sodalive.main.MainActivity
|
||||
import kr.co.vividnext.sodalive.mypage.alarm.AlarmListActivity
|
||||
import kr.co.vividnext.sodalive.mypage.auth.Auth
|
||||
@@ -36,7 +33,8 @@ import kr.co.vividnext.sodalive.mypage.point.PointStatusActivity
|
||||
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateActivity
|
||||
import kr.co.vividnext.sodalive.mypage.service_center.ServiceCenterActivity
|
||||
import kr.co.vividnext.sodalive.settings.SettingsActivity
|
||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||
import kr.co.vividnext.sodalive.settings.event.EventActivity
|
||||
import kr.co.vividnext.sodalive.settings.notice.NoticeActivity
|
||||
import kr.co.vividnext.sodalive.splash.SplashActivity
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
@@ -64,20 +62,11 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
}
|
||||
|
||||
private fun setupView() {
|
||||
binding.rlServiceCenter.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
ServiceCenterActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val ivHowToUseLp = binding.ivHowToUse.layoutParams as LinearLayout.LayoutParams
|
||||
ivHowToUseLp.width = screenWidth
|
||||
ivHowToUseLp.height = (200 * screenWidth) / 1080
|
||||
binding.ivHowToUse.layoutParams = ivHowToUseLp
|
||||
binding.ivHowToUse.setOnClickListener {
|
||||
// val ivHowToUseLp = binding.ivIntroduceVoiceon.layoutParams as LinearLayout.LayoutParams
|
||||
// ivHowToUseLp.width = screenWidth
|
||||
// ivHowToUseLp.height = (120 * screenWidth) / 352
|
||||
// binding.ivIntroduceVoiceon.layoutParams = ivHowToUseLp
|
||||
binding.ivIntroduceVoiceon.setOnClickListener {
|
||||
val url = "https://blog.naver.com/sodalive_official"
|
||||
if (URLUtil.isValidUrl(url)) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
@@ -86,14 +75,10 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
|
||||
if (SharedPreferenceManager.token.isNotBlank()) {
|
||||
binding.ivSettings.visibility = View.VISIBLE
|
||||
binding.llProfileContainer.visibility = View.VISIBLE
|
||||
binding.rlProfileContainer.visibility = View.VISIBLE
|
||||
binding.llProfileLoginContainer.visibility = View.GONE
|
||||
binding.llFollowingMemberListContainer.visibility = View.VISIBLE
|
||||
|
||||
binding.rlAlarm.visibility = View.VISIBLE
|
||||
binding.rlCoupon.visibility = View.VISIBLE
|
||||
binding.llLockerContainer.visibility = View.VISIBLE
|
||||
binding.llReservationStatusContainer.visibility = View.VISIBLE
|
||||
binding.llFunctionButtonGrid.visibility = View.VISIBLE
|
||||
|
||||
binding.ivSettings.setOnClickListener {
|
||||
startActivity(
|
||||
@@ -104,7 +89,7 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
)
|
||||
}
|
||||
|
||||
binding.ivEdit.setOnClickListener {
|
||||
binding.tvEditProfile.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
@@ -114,12 +99,10 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
}
|
||||
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
binding.rlCan.visibility = View.GONE
|
||||
binding.rlPoint.visibility = View.GONE
|
||||
binding.llCanPointContainer.visibility = View.GONE
|
||||
} else {
|
||||
binding.rlCan.visibility = View.VISIBLE
|
||||
binding.rlPoint.visibility = View.VISIBLE
|
||||
binding.llTotalCan.setOnClickListener {
|
||||
binding.llCanPointContainer.visibility = View.VISIBLE
|
||||
binding.tvCanAmount.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
@@ -128,7 +111,7 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
)
|
||||
}
|
||||
|
||||
binding.llTotalPoint.setOnClickListener {
|
||||
binding.tvPointAmount.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
@@ -137,6 +120,7 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvChargeCan.visibility = View.VISIBLE
|
||||
binding.tvChargeCan.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
@@ -147,16 +131,37 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
}
|
||||
}
|
||||
|
||||
binding.rlCoupon.setOnClickListener {
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnStorage.root,
|
||||
iconRes = R.drawable.ic_my_storage,
|
||||
title = "보관함"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
CanCouponActivity::class.java
|
||||
requireContext(),
|
||||
AudioContentBoxActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
binding.rlAlarm.setOnClickListener {
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnBlockList.root,
|
||||
iconRes = R.drawable.ic_my_block,
|
||||
title = "차단목록"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireContext(),
|
||||
BlockMemberActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnMorningCall.root,
|
||||
iconRes = R.drawable.ic_my_alarm,
|
||||
title = "모닝콜"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
@@ -165,102 +170,65 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
)
|
||||
}
|
||||
|
||||
binding.llReservationLive.setOnClickListener {
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnNotice.root,
|
||||
iconRes = R.drawable.ic_my_notice,
|
||||
title = "공지사항"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
LiveReservationStatusActivity::class.java
|
||||
NoticeActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvAuth.setOnClickListener {
|
||||
Auth.auth(requireActivity(), requireContext()) {
|
||||
val bootpayResponse = Gson().fromJson(it, BootpayResponse::class.java)
|
||||
val request = AuthVerifyRequest(receiptId = bootpayResponse.data.receiptId)
|
||||
requireActivity().runOnUiThread {
|
||||
viewModel.authVerify(request) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireContext(),
|
||||
SplashActivity::class.java
|
||||
).apply {
|
||||
addFlags(
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TASK or
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
)
|
||||
}
|
||||
)
|
||||
requireActivity().finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SharedPreferenceManager.role == MemberRole.CREATOR.name) {
|
||||
binding.tvMyChannel.visibility = View.VISIBLE
|
||||
binding.tvMyChannel.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireContext(),
|
||||
UserProfileActivity::class.java
|
||||
).apply {
|
||||
putExtra(
|
||||
Constants.EXTRA_USER_ID,
|
||||
SharedPreferenceManager.userId
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.tvMyChannel.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.tvFollowingList.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), FollowingCreatorActivity::class.java))
|
||||
}
|
||||
|
||||
binding.tvBlockMemberList.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), BlockMemberActivity::class.java))
|
||||
}
|
||||
|
||||
binding.tvOrderList.setOnClickListener {
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnEvent.root,
|
||||
iconRes = R.drawable.ic_my_event,
|
||||
title = "이벤트"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(requireContext(), AudioContentBoxActivity::class.java)
|
||||
Intent(
|
||||
requireActivity(),
|
||||
EventActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvPlaylist.setOnClickListener {
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnCustomerService.root,
|
||||
iconRes = R.drawable.ic_my_service_center,
|
||||
title = "고객센터"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(requireContext(), AudioContentBoxActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_START_TAB_POSITION, 1)
|
||||
}
|
||||
Intent(
|
||||
requireActivity(),
|
||||
ServiceCenterActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.tvTotalCan.text = "0"
|
||||
binding.ivSettings.visibility = View.GONE
|
||||
binding.llProfileContainer.visibility = View.GONE
|
||||
binding.llFunctionButtonGrid.visibility = View.GONE
|
||||
|
||||
binding.rlProfileContainer.visibility = View.GONE
|
||||
binding.llProfileLoginContainer.visibility = View.VISIBLE
|
||||
binding.llFollowingMemberListContainer.visibility = View.GONE
|
||||
|
||||
binding.rlAlarm.visibility = View.GONE
|
||||
binding.rlPoint.visibility = View.GONE
|
||||
binding.rlCoupon.visibility = View.GONE
|
||||
binding.llLockerContainer.visibility = View.GONE
|
||||
binding.llReservationStatusContainer.visibility = View.GONE
|
||||
|
||||
binding.llProfileLoginContainer.setOnClickListener {
|
||||
(requireActivity() as MainActivity).showLoginActivity()
|
||||
}
|
||||
|
||||
binding.llTotalCan.setOnClickListener {
|
||||
binding.tvCanAmount.text = "0"
|
||||
binding.tvCanAmount.setOnClickListener {
|
||||
(requireActivity() as MainActivity).showLoginActivity()
|
||||
}
|
||||
|
||||
binding.tvChargeCan.setOnClickListener {
|
||||
binding.tvPointAmount.text = "0"
|
||||
binding.tvPointAmount.setOnClickListener {
|
||||
(requireActivity() as MainActivity).showLoginActivity()
|
||||
}
|
||||
|
||||
binding.tvChargeCan.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,11 +248,46 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
|
||||
viewModel.myPageLiveData.observe(viewLifecycleOwner) {
|
||||
if (it.isAuth) {
|
||||
binding.tvAuth.visibility = View.GONE
|
||||
binding.rlCoupon.visibility = View.VISIBLE
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnIdentityVerification.root,
|
||||
iconRes = R.drawable.ic_my_auth,
|
||||
title = "본인인증 완료"
|
||||
)
|
||||
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnCoupon.root,
|
||||
iconRes = R.drawable.ic_my_coupon,
|
||||
title = "쿠폰등록"
|
||||
) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireActivity(),
|
||||
CanCouponActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.tvAuth.visibility = View.VISIBLE
|
||||
binding.rlCoupon.visibility = View.GONE
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnIdentityVerification.root,
|
||||
iconRes = R.drawable.ic_my_auth,
|
||||
title = "본인인증"
|
||||
) {
|
||||
showAuthDialog()
|
||||
}
|
||||
|
||||
FunctionButtonHelper.setupFunctionButton(
|
||||
buttonView = binding.btnCoupon.root,
|
||||
iconRes = R.drawable.ic_my_coupon,
|
||||
title = "쿠폰등록"
|
||||
) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
"본인인증 후 사용가능합니다.",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
|
||||
showAuthDialog()
|
||||
}
|
||||
}
|
||||
|
||||
binding.ivProfile.load(it.profileUrl) {
|
||||
@@ -294,45 +297,34 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
||||
}
|
||||
binding.tvNickname.text = it.nickname
|
||||
|
||||
if (it.websiteUrl.isNullOrBlank() || !URLUtil.isValidUrl(it.websiteUrl)) {
|
||||
binding.ivWebsite.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivWebsite.visibility = View.VISIBLE
|
||||
binding.ivWebsite.setOnClickListener { _ ->
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.websiteUrl)))
|
||||
binding.tvCanAmount.text = (it.chargeCan + it.rewardCan).moneyFormat()
|
||||
binding.tvPointAmount.text = it.point.moneyFormat()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showAuthDialog() {
|
||||
Auth.auth(requireActivity(), requireContext()) { json ->
|
||||
val bootpayResponse = Gson().fromJson(
|
||||
json,
|
||||
BootpayResponse::class.java
|
||||
)
|
||||
val request = AuthVerifyRequest(receiptId = bootpayResponse.data.receiptId)
|
||||
requireActivity().runOnUiThread {
|
||||
viewModel.authVerify(request) {
|
||||
startActivity(
|
||||
Intent(
|
||||
requireContext(),
|
||||
SplashActivity::class.java
|
||||
).apply {
|
||||
addFlags(
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TASK or
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
)
|
||||
}
|
||||
)
|
||||
requireActivity().finish()
|
||||
}
|
||||
}
|
||||
|
||||
if (it.blogUrl.isNullOrBlank() || !URLUtil.isValidUrl(it.blogUrl)) {
|
||||
binding.ivBlog.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivBlog.visibility = View.VISIBLE
|
||||
binding.ivBlog.setOnClickListener { _ ->
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.blogUrl)))
|
||||
}
|
||||
}
|
||||
|
||||
if (it.instagramUrl.isNullOrBlank() || !URLUtil.isValidUrl(it.instagramUrl)) {
|
||||
binding.ivInstagram.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivInstagram.visibility = View.VISIBLE
|
||||
binding.ivInstagram.setOnClickListener { _ ->
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.instagramUrl)))
|
||||
}
|
||||
}
|
||||
|
||||
if (it.youtubeUrl.isNullOrBlank() || !URLUtil.isValidUrl(it.youtubeUrl)) {
|
||||
binding.ivYoutube.visibility = View.GONE
|
||||
} else {
|
||||
binding.ivYoutube.visibility = View.VISIBLE
|
||||
binding.ivYoutube.setOnClickListener { _ ->
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.youtubeUrl)))
|
||||
}
|
||||
}
|
||||
|
||||
binding.tvTotalCan.text = (it.chargeCan + it.rewardCan).moneyFormat()
|
||||
binding.tvTotalPoint.text = it.point.moneyFormat()
|
||||
binding.tvReservationLive.text = "${it.liveReservationCount}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ActivitySettingsBinding
|
||||
import kr.co.vividnext.sodalive.mypage.alarm.AlarmViewModel
|
||||
import kr.co.vividnext.sodalive.settings.event.EventActivity
|
||||
import kr.co.vividnext.sodalive.settings.notice.NoticeActivity
|
||||
import kr.co.vividnext.sodalive.settings.notification.NotificationSettingsActivity
|
||||
import kr.co.vividnext.sodalive.settings.signout.SignOutActivity
|
||||
import kr.co.vividnext.sodalive.settings.terms.TermsActivity
|
||||
@@ -73,24 +71,6 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>(ActivitySettingsB
|
||||
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
|
||||
binding.rlNotice.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
applicationContext,
|
||||
NoticeActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
binding.rlEvent.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
applicationContext,
|
||||
EventActivity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
binding.rlNotificationSettings.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
@@ -101,6 +81,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>(ActivitySettingsB
|
||||
}
|
||||
|
||||
if (SharedPreferenceManager.isAuth) {
|
||||
binding.dividerContentSettings.visibility = View.VISIBLE
|
||||
binding.rlContentSettings.visibility = View.VISIBLE
|
||||
binding.rlContentSettings.setOnClickListener {
|
||||
startActivity(
|
||||
@@ -111,6 +92,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>(ActivitySettingsB
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.dividerContentSettings.visibility = View.GONE
|
||||
binding.rlContentSettings.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user