From fcbf47faa9f4fda13fc82d8a750b16179c02c412 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Mon, 21 Aug 2023 12:46:57 +0900 Subject: [PATCH] =?UTF-8?q?#210=20=EB=82=B4=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0=20=EB=B0=94=ED=85=80=EC=8B=9C=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/MyPageFragment.kt | 7 +- .../MyPageMoreBottomSheetFragment.kt | 42 ++++-- .../MyPageMoreBottomSheetViewModel.kt | 8 +- .../fragment_my_page_more_bottom_sheet.xml | 128 +++++++++++------- .../mypage/src/main/res/values/strings.xml | 3 +- 5 files changed, 118 insertions(+), 70 deletions(-) diff --git a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/MyPageFragment.kt b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/MyPageFragment.kt index 487156287..853a6ce85 100644 --- a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/MyPageFragment.kt +++ b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/MyPageFragment.kt @@ -40,8 +40,7 @@ class MyPageFragment : setFragmentResultListner() } - private fun setBinding() = - binding.apply { + private fun setBinding() = binding.apply { viewModel = fragmentViewModel.apply { viewLifecycleOwner.apply { repeatOnStarted { token.collect { handleToken(it) } } @@ -203,7 +202,9 @@ class MyPageFragment : MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_PASSWORD.value -> showMyPageMoreDialog(MyPageMoreDialogFragment.DialogType.CHANGE_PASSWORD) MyPageMoreBottomSheetFragment.BottomSheetFlag.WITHDRAWAL.value -> showMyPageMoreDialog(MyPageMoreDialogFragment.DialogType.WITHDRAWAL) MyPageMoreBottomSheetFragment.BottomSheetFlag.LOGOUT.value -> showMyPageMoreDialog(MyPageMoreDialogFragment.DialogType.LOGOUT) - MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_USER_IMAGE.value -> {} + + MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_IMAGE.value -> {} + MyPageMoreBottomSheetFragment.BottomSheetFlag.REMOVE_IMAGE.value -> {} } } diff --git a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetFragment.kt b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetFragment.kt index 2a64f743d..4a2f83df4 100644 --- a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetFragment.kt +++ b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetFragment.kt @@ -32,7 +32,8 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType CHANGE_PASSWORD(302), WITHDRAWAL(303), LOGOUT(304), - CHANGE_USER_IMAGE(305) + CHANGE_IMAGE(305), + REMOVE_IMAGE(306) } enum class BottomSheetType { @@ -82,20 +83,18 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType private fun setBottomSheetType() { when (bottomSheetType) { BottomSheetType.DEFAULT -> defaultBottomSheetVisible() - BottomSheetType.IMAGE ->imageBottomSheetVisible() + BottomSheetType.IMAGE -> imageBottomSheetVisible() } } - private fun defaultBottomSheetVisible() { - binding.changeUserImageTV.visibility = View.GONE + private fun defaultBottomSheetVisible() = binding.apply { + defaultBottomSheetLL.visibility = View.VISIBLE + imageBottomSheetLL.visibility = View.GONE } private fun imageBottomSheetVisible() = binding.apply { - changeNickNameTV.visibility = View.GONE - changePasswordTV.visibility = View.GONE - withdrawalTV.visibility = View.GONE - logoutTV.visibility = View.GONE - changeUserImageTV.visibility = View.VISIBLE + defaultBottomSheetLL.visibility = View.GONE + imageBottomSheetLL.visibility = View.VISIBLE } private fun setBinding() { @@ -117,7 +116,9 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType BottomSheetFlag.CHANGE_PASSWORD -> completeBottomSheetChangePassword() BottomSheetFlag.WITHDRAWAL -> completeBottomSheetWithdrawal() BottomSheetFlag.LOGOUT -> completeBottomSheetLogout() - BottomSheetFlag.CHANGE_USER_IMAGE -> completeBottomSheetChangeUserImage() + + BottomSheetFlag.CHANGE_IMAGE -> completeBottomSheetChangeImage() + BottomSheetFlag.REMOVE_IMAGE -> completeBottomSheetRemoveImage() } } } @@ -139,8 +140,12 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType setFragmentResult(TAG, bundleOf(TAG to BottomSheetFlag.LOGOUT.value)) } - private fun completeBottomSheetChangeUserImage() { - setFragmentResult(TAG, bundleOf(TAG to BottomSheetFlag.CHANGE_USER_IMAGE.value)) + private fun completeBottomSheetChangeImage() { + setFragmentResult(TAG, bundleOf(TAG to BottomSheetFlag.CHANGE_IMAGE.value)) + } + + private fun completeBottomSheetRemoveImage() { + setFragmentResult(TAG, bundleOf(TAG to BottomSheetFlag.REMOVE_IMAGE.value)) } private fun handleFlag(flag: BottomSheetFlag) { @@ -149,13 +154,22 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType BottomSheetFlag.CHANGE_PASSWORD -> highlight(binding.changePasswordTV) BottomSheetFlag.WITHDRAWAL -> highlight(binding.withdrawalTV) BottomSheetFlag.LOGOUT -> highlight(binding.logoutTV) - BottomSheetFlag.CHANGE_USER_IMAGE -> highlight(binding.changeUserImageTV) + + BottomSheetFlag.CHANGE_IMAGE -> highlight(binding.changeImageTV) + BottomSheetFlag.REMOVE_IMAGE -> highlight(binding.removeImageTV) } } private fun highlight(view: TextView) { val flagTextViewList = - listOf(binding.changePasswordTV, binding.withdrawalTV, binding.changeNickNameTV, binding.logoutTV, binding.changeUserImageTV) + listOf( + binding.changePasswordTV, + binding.withdrawalTV, + binding.changeNickNameTV, + binding.logoutTV, + binding.changeImageTV, + binding.removeImageTV, + ) flagTextViewList.forEach { flagTextView -> if (view == flagTextView) { diff --git a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetViewModel.kt b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetViewModel.kt index 8714705be..38f065a98 100644 --- a/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetViewModel.kt +++ b/feature/mypage/src/main/java/com/android/mediproject/feature/mypage/mypagemore/MyPageMoreBottomSheetViewModel.kt @@ -39,8 +39,12 @@ class MyPageMoreBottomSheetViewModel @Inject constructor() : BaseViewModel() { _bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.LOGOUT } - fun changeUserImage(){ - _bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_USER_IMAGE + fun changeImage(){ + _bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_IMAGE + } + + fun removeImage(){ + _bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.REMOVE_IMAGE } sealed class MyPageMoreBottomSheetEvent { diff --git a/feature/mypage/src/main/res/layout/fragment_my_page_more_bottom_sheet.xml b/feature/mypage/src/main/res/layout/fragment_my_page_more_bottom_sheet.xml index 6dcddcf1b..2041bf9be 100644 --- a/feature/mypage/src/main/res/layout/fragment_my_page_more_bottom_sheet.xml +++ b/feature/mypage/src/main/res/layout/fragment_my_page_more_bottom_sheet.xml @@ -18,66 +18,94 @@ android:orientation="vertical" tools:context=".mypagemore.MyPageMoreBottomSheetFragment"> - + android:orientation="vertical"> - + - + - + - + + + + android:orientation="vertical" + android:visibility="gone"> + + + + + 비밀번호 변경 회원 탈퇴 로그아웃 - 내 이미지 변경 + 이미지 변경 + 이미지 제거 확인 취소