Skip to content

Commit

Permalink
#210 내 이미지 변경 바텀시트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Aug 21, 2023
1 parent ce8f1b0 commit 22bdc5c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType
CHANGE_NICKNAME(301),
CHANGE_PASSWORD(302),
WITHDRAWAL(303),
LOGOUT(304)
LOGOUT(304),
CHANGE_USER_IMAGE(305)
}

enum class BottomSheetType {
Expand Down Expand Up @@ -74,9 +75,17 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setBottomSheetType()
setBinding()
}

private fun setBottomSheetType() {
when (bottomSheetType) {
BottomSheetType.DEFAULT -> {}
BottomSheetType.IMAGE -> {}
}
}

private fun setBinding() {
binding.apply {
viewModel = fragmentViewModel.apply {
Expand All @@ -96,6 +105,7 @@ class MyPageMoreBottomSheetFragment(private val bottomSheetType: BottomSheetType
BottomSheetFlag.CHANGE_PASSWORD -> completeBottomSheetChangePassword()
BottomSheetFlag.WITHDRAWAL -> completeBottomSheetWithdrawal()
BottomSheetFlag.LOGOUT -> completeBottomSheetLogout()
BottomSheetFlag.CHANGE_USER_IMAGE -> {}
}
}
}
Expand Down Expand Up @@ -123,11 +133,13 @@ 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)
}
}

private fun highlight(view: TextView) {
val flagTextViewList = listOf(binding.changePasswordTV, binding.withdrawalTV, binding.changeNickNameTV, binding.logoutTV)
val flagTextViewList =
listOf(binding.changePasswordTV, binding.withdrawalTV, binding.changeNickNameTV, binding.logoutTV, binding.changeUserImageTV)

flagTextViewList.forEach { flagTextView ->
if (view == flagTextView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class MyPageMoreBottomSheetViewModel @Inject constructor() : BaseViewModel() {
_bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.LOGOUT
}

fun changeUserImage(){
_bottomsheetFlag.value = MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_USER_IMAGE
}

sealed class MyPageMoreBottomSheetEvent {
data class CompleteBottomSheet(val flag: MyPageMoreBottomSheetFragment.BottomSheetFlag = MyPageMoreBottomSheetFragment.BottomSheetFlag.CHANGE_NICKNAME) :
MyPageMoreBottomSheetEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@
android:textColor="@color/gray3"
android:textSize="18sp" />

<TextView
android:id="@+id/changeUserImageTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:onClick="@{()->viewModel.changeUserImage()}"
android:padding="10dp"
android:text="@string/changeUserImage"
android:visibility="gone"
android:textColor="@color/gray3"
android:textSize="18sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
3 changes: 2 additions & 1 deletion feature/mypage/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<string name="changePassword">비밀번호 변경</string>
<string name="withdrawal">회원 탈퇴</string>
<string name="logout">로그아웃</string>
<string name="changeUserImage">내 이미지 변경</string>
<string name="confirm">확인</string>
<string name="cancel">취소</string>

Expand All @@ -20,4 +21,4 @@

<string name="complete">완료</string>
<string name="changePasswordNotification">비밀번호는 영문 + 숫자 포함 4~10자 입니다.</string>
</resources>
</resources>

0 comments on commit 22bdc5c

Please sign in to comment.