From c87ed7e2835ffe77d17ae0e1cdbea1989d489fbe Mon Sep 17 00:00:00 2001 From: seongh06 Date: Mon, 30 Sep 2024 02:59:20 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#66]=20=EC=9D=B4=EC=9A=A9=EC=95=BD?= =?UTF-8?q?=EA=B4=80=20view=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lck/presentation/login/LoginFragment.kt | 2 +- .../presentation/login/SignupTosFragment.kt | 133 ++++++++++++++++++ .../main/res/drawable/shape_selected_oval.xml | 16 +++ .../fragment_mypage_profile_withdraw.xml | 2 +- app/src/main/res/navigation/login_graph.xml | 14 +- 5 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/umc/everyones/lck/presentation/login/SignupTosFragment.kt create mode 100644 app/src/main/res/drawable/shape_selected_oval.xml diff --git a/app/src/main/java/umc/everyones/lck/presentation/login/LoginFragment.kt b/app/src/main/java/umc/everyones/lck/presentation/login/LoginFragment.kt index 1944331a..9af8cc27 100644 --- a/app/src/main/java/umc/everyones/lck/presentation/login/LoginFragment.kt +++ b/app/src/main/java/umc/everyones/lck/presentation/login/LoginFragment.kt @@ -123,7 +123,7 @@ class LoginFragment : BaseFragment(R.layout.fragment_login } private fun navigateToSignupNicknameScreen() { - navigator.navigate(R.id.action_loginFragment_to_signupNicknameFragment) + navigator.navigate(R.id.action_loginFragment_to_signupTosFragment) } companion object { diff --git a/app/src/main/java/umc/everyones/lck/presentation/login/SignupTosFragment.kt b/app/src/main/java/umc/everyones/lck/presentation/login/SignupTosFragment.kt new file mode 100644 index 00000000..04519af7 --- /dev/null +++ b/app/src/main/java/umc/everyones/lck/presentation/login/SignupTosFragment.kt @@ -0,0 +1,133 @@ +package umc.everyones.lck.presentation.login + +import android.view.LayoutInflater +import android.view.View +import android.widget.Toast +import androidx.activity.viewModels +import androidx.appcompat.app.AlertDialog +import androidx.core.content.ContextCompat +import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController +import dagger.hilt.android.AndroidEntryPoint +import umc.everyones.lck.R +import umc.everyones.lck.databinding.ActivitiyTestBinding +import umc.everyones.lck.databinding.DialogNicknameConfirmBinding +import umc.everyones.lck.databinding.FragmentSignupSuccessBinding +import umc.everyones.lck.databinding.FragmentSignupTosBinding +import umc.everyones.lck.presentation.base.BaseActivity +import umc.everyones.lck.presentation.base.BaseFragment +import umc.everyones.lck.presentation.test.TestViewModel +import umc.everyones.lck.util.extension.repeatOnStarted +import umc.everyones.lck.util.extension.setOnSingleClickListener + +@AndroidEntryPoint +class SignupTosFragment : BaseFragment(R.layout.fragment_signup_tos) { + // + private val viewModel: SignupViewModel by activityViewModels() + private val navigator by lazy { findNavController() } + + private var isAgree1Checked = false + private var isAgree2Checked = false + + override fun initObserver() { + + } + + override fun initView() { + binding.tvSignupTosDetailsAgree1.setOnClickListener { + // 세부 정보 보기 클릭 시 다이얼로그 표시 + showDetailsDialog1() + } + + binding.tvSignupTosDetailsAgree2.setOnClickListener { + // 세부 정보 보기 클릭 시 다이얼로그 표시 + showDetailsDialog2() + } + + binding.ivSignupTosNext.setOnClickListener { + if (!isAgree1Checked || !isAgree2Checked) { + Toast.makeText(requireContext(), "모든 동의 항목을 체크해주세요.", Toast.LENGTH_SHORT).show() + } else { + navigateToSignupNickname() + } + } + + binding.viewSignupTosAgreeCircle.setOnClickListener { + toggleAgreement(1) + } + + binding.viewSignupTosAgree1Circle.setOnClickListener { + toggleAgreement(2) + } + } + + private fun showDetailsDialog1() { + val dialogView = + LayoutInflater.from(requireContext()).inflate(R.layout.dialog_signup_tos_details_agree_1, null) + + val dialogBinding = DialogNicknameConfirmBinding.bind(dialogView) + + val dialog = AlertDialog.Builder(requireContext()) + .setView(dialogView) + .setCancelable(false) + .create() + + dialog.window?.setBackgroundDrawableResource(android.R.color.transparent) + dialog.show() + + val layoutParams = dialog.window?.attributes + layoutParams?.dimAmount = 0.8f + dialog.window?.attributes = layoutParams + + dialogBinding.btnConfirm.setOnSingleClickListener { + dialog.dismiss() + toggleAgreement(1) + } + } + + private fun showDetailsDialog2() { + val dialogView = + LayoutInflater.from(requireContext()).inflate(R.layout.dialog_signup_tos_details_agree_2, null) + + val dialogBinding = DialogNicknameConfirmBinding.bind(dialogView) + + val dialog = AlertDialog.Builder(requireContext()) + .setView(dialogView) + .setCancelable(false) + .create() + + dialog.window?.setBackgroundDrawableResource(android.R.color.transparent) + dialog.show() + + val layoutParams = dialog.window?.attributes + layoutParams?.dimAmount = 0.8f + dialog.window?.attributes = layoutParams + + dialogBinding.btnConfirm.setOnSingleClickListener { + dialog.dismiss() + toggleAgreement(2) + } + } + + private fun navigateToSignupNickname() { + navigator.navigate(R.id.action_signupTosFragment_to_signupNicknameFragment) + } + + private fun toggleAgreement(agreementNumber: Int) { + if (agreementNumber == 1) { + isAgree1Checked = !isAgree1Checked + updateCircleView(binding.viewSignupTosAgreeCircle, isAgree1Checked) + } else if (agreementNumber == 2) { + isAgree2Checked = !isAgree2Checked + updateCircleView(binding.viewSignupTosAgree1Circle, isAgree2Checked) + } + } + + private fun updateCircleView(view: View, isChecked: Boolean) { + view.background = if (isChecked) { + ContextCompat.getDrawable(requireContext(), R.drawable.shape_selected_oval) + } else { + ContextCompat.getDrawable(requireContext(), R.drawable.shape_oval) + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_selected_oval.xml b/app/src/main/res/drawable/shape_selected_oval.xml new file mode 100644 index 00000000..14c21f95 --- /dev/null +++ b/app/src/main/res/drawable/shape_selected_oval.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mypage_profile_withdraw.xml b/app/src/main/res/layout/fragment_mypage_profile_withdraw.xml index df6fb2ff..ad80f268 100644 --- a/app/src/main/res/layout/fragment_mypage_profile_withdraw.xml +++ b/app/src/main/res/layout/fragment_mypage_profile_withdraw.xml @@ -41,7 +41,7 @@ android:layout_width="321dp" android:layout_height="wrap_content" android:text="" - style="@style/TextAppearance.LCK.Bold.List_14sp" + style="@style/TextAppearance.LCK.Light.Body_14sp" android:textColor="@color/white" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/navigation/login_graph.xml b/app/src/main/res/navigation/login_graph.xml index c44a183a..82e3a25e 100644 --- a/app/src/main/res/navigation/login_graph.xml +++ b/app/src/main/res/navigation/login_graph.xml @@ -11,8 +11,18 @@ android:label="Login" tools:layout="@layout/fragment_login"> + android:id="@+id/action_loginFragment_to_signupTosFragment" + app:destination="@id/signupTosFragment" /> + + + +