From 19a87868488f2a118e81121ee62990220b4d4044 Mon Sep 17 00:00:00 2001 From: seoggyui Date: Tue, 23 Aug 2022 20:03:36 +0900 Subject: [PATCH] =?UTF-8?q?#6=20mypage=5Ffragment/=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20:=205=20=ED=9A=8C=EC=9B=90=20=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=ED=99=94=EB=A9=B4=20=20-=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20=ED=99=94=EB=A9=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 5 +- .../di/ui/ActivityViewModelModule.kt | 11 ++ .../ui/manageaccount/ManageAccountActivity.kt | 8 +- .../ui/withdrawal/WithdrawalActivity.kt | 104 +++++++++++ .../ui/withdrawal/WithdrawalViewModel.kt | 42 +++++ .../drawable-xhdpi/icon_check_disabled.png | Bin 0 -> 666 bytes .../res/drawable-xhdpi/icon_check_enabled.png | Bin 0 -> 619 bytes .../main/res/layout/activity_withdrawal.xml | 166 ++++++++++++++++++ app/src/main/res/values/strings.xml | 5 + 9 files changed, 337 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt create mode 100644 app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt create mode 100644 app/src/main/res/drawable-xhdpi/icon_check_disabled.png create mode 100644 app/src/main/res/drawable-xhdpi/icon_check_enabled.png create mode 100644 app/src/main/res/layout/activity_withdrawal.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a12c526..46be3fd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,10 @@ android:usesCleartextTraffic="true" tools:targetApi="31" > - + ( + this, + R.layout.activity_withdrawal + ).apply { + viewModel = this@WithdrawalActivity.viewModel + } + observe() + } + + private fun observe() { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + viewModel.event.collect { event -> + when (event) { + WithdrawalViewModel.Event.None -> {} + WithdrawalViewModel.Event.OnClickWithdrawalFirstCheck -> onClickWithdrawalFirstCheck() + WithdrawalViewModel.Event.OnClickWithdrawalSecondCheck -> onClickWithdrawalSecondCheck() + WithdrawalViewModel.Event.OnClickWithdrawalThirdCheck -> onClickWithdrawalThirdCheck() + } + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + viewModel.withdrawalCheck.collect { showBanner -> + binding.withdrawalButton.isEnabled = showBanner + } + } + } + } + + private fun onClickWithdrawalFirstCheck() { + if(viewModel.withdrawalFirstCheck.value){ + viewModel.withdrawalFirstCheck.value = false + binding.withdrawalFirstCheck.setImageResource(R.drawable.icon_check_disabled) + } else{ + viewModel.withdrawalFirstCheck.value = true + binding.withdrawalFirstCheck.setImageResource(R.drawable.icon_check_enabled) + } + viewModel.withdrawalCheck.value = withdrawalCheck() + } + + private fun onClickWithdrawalSecondCheck() { + if(viewModel.withdrawalSecondCheck.value){ + viewModel.withdrawalSecondCheck.value = false + binding.withdrawalSecondCheck.setImageResource(R.drawable.icon_check_disabled) + } else{ + viewModel.withdrawalSecondCheck.value = true + binding.withdrawalSecondCheck.setImageResource(R.drawable.icon_check_enabled) + } + viewModel.withdrawalCheck.value = withdrawalCheck() + } + + private fun onClickWithdrawalThirdCheck() { + if(viewModel.withdrawalThirdCheck.value){ + viewModel.withdrawalThirdCheck.value = false + binding.withdrawalThirdCheck.setImageResource(R.drawable.icon_check_disabled) + } else{ + viewModel.withdrawalThirdCheck.value = true + binding.withdrawalThirdCheck.setImageResource(R.drawable.icon_check_enabled) + } + viewModel.withdrawalCheck.value = withdrawalCheck() + } + + private fun withdrawalCheck(): Boolean { + if(viewModel.withdrawalFirstCheck.value + && viewModel.withdrawalSecondCheck.value + && viewModel.withdrawalThirdCheck.value) return true + return false + } +} diff --git a/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt new file mode 100644 index 0000000..2150203 --- /dev/null +++ b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt @@ -0,0 +1,42 @@ +package com.ftw.hometerview.ui.withdrawal + +import com.ftw.hometerview.dispatcher.Dispatcher +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow + +class WithdrawalViewModel( + dispatcher: Dispatcher +) { + + sealed class Event { + object None : Event() + object OnClickWithdrawalFirstCheck : Event() + object OnClickWithdrawalSecondCheck : Event() + object OnClickWithdrawalThirdCheck : Event() + } + + private val _event: MutableStateFlow = MutableStateFlow(Event.None) + val event: StateFlow = _event.asStateFlow() + + val withdrawalFirstCheck: MutableStateFlow = MutableStateFlow(false) + val withdrawalSecondCheck: MutableStateFlow = MutableStateFlow(false) + val withdrawalThirdCheck: MutableStateFlow = MutableStateFlow(false) + val withdrawalCheck: MutableStateFlow = MutableStateFlow(false) + + fun onClickWithdrawalFirstCheck() { + _event.value = Event.OnClickWithdrawalFirstCheck + _event.value = Event.None + } + + fun onClickWithdrawalSecondCheck() { + _event.value = Event.OnClickWithdrawalSecondCheck + _event.value = Event.None + } + + fun onClickWithdrawalThirdCheck() { + _event.value = Event.OnClickWithdrawalThirdCheck + _event.value = Event.None + } + +} diff --git a/app/src/main/res/drawable-xhdpi/icon_check_disabled.png b/app/src/main/res/drawable-xhdpi/icon_check_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..a9be2d884729094ca9f799803a33275b685fadd6 GIT binary patch literal 666 zcmV;L0%iS)P)1j_-UMoF*+q)c{yQs_IJ9RNWLky3LE|}`+@rOi@ zatVl4{m~n~Pv?R$^T3o1Na>leQH*X&DbH9Fm;xWK(pUVPR>F;vfUNBU*$g%r%bX?1 zWNdSmVqUgc>1ObIzF90VzxnyK!b;j-&hsq$n?F7M z$*1#$_q#=u#V-3D(Brf)XO(4{7h`Fhi%O|e9uz`BYI!mKi4y9?+KA-IBfK_v?)p$KYhdzDgw>^*(Lp9SfyJ$vKw6KFz*LB?5!f z*&<(WzU8A&pS|CJHs*NVVUgfE$5s(!5awJ}nOtwa@5DfLt%V6PxH6e@g_fb6%q*6x zo!=qJymP5FhzZIAT&{0!`T0dTwJ|v~*<>}flq#@L*;lEa9^%C84RZN%?`P@Z@s~I6 ztZ^RSgu1voV_&7Djrwave`BS$GjE)P+C~jYx4NpuV1+DmyoAQB4w94^^at0bw7=O~ z{%Fe0u~Nh@REeIXJh%#N=Gc#)52ZQ$jcXhy!EAA|;}#^%qGe!A0lt0+;_O*T=VBMs z_P%}Eu4q}QLqKT*-|XU<3^HdG%Va0!tp2|v*Y4AYP<%{kYRGN0eW7ZfO=PY1#N3r& z^pI7K*k>`uLYc6+;{@V;z{E#Q(@&$6@~D@jf0Qn$K5KlG(*OVf07*qoM6N<$f~@dQ Axc~qF literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/icon_check_enabled.png b/app/src/main/res/drawable-xhdpi/icon_check_enabled.png new file mode 100644 index 0000000000000000000000000000000000000000..66e1c4fac8702474f7f5dc9692b9d8429c0a3e07 GIT binary patch literal 619 zcmV-x0+juUP)7DJx=a*OnErfy71yOW%Nj#UR)aBdmuni9_-^ ze=bf^A=FR$No{j>KAr8e-Cl32t%^lz(5F46XkSez7%#GnrWB|F$6&k8WnQc(7_N*7 zlEJaV0Q+fOVYY&ib`6Npofr*=vR1~b;3=SX@I7AQj;LAIiqMTsc4*F`y-jYwoJD)B zbklH|(^*FhSNQ%?@k(<$=@?TX&_|(YGee7L^pUGhvNt;?`u-yN{2*G++~)~`EVf(k z3?~PXIV=8*F$ooOktV9|Hfq4(Zj`mO_&dg>DO=Iu=8g@TaDSII$GW<7<1&;CGleG* zY~TqSL9tQ^{&Z31)`5TK7 zX3t7I7h9pE_7y2!(c0~-b@X4p*=cWcRvntujm=rbCd>EfTA2A=RgirYU#PVELNU75 z_0m_7(K@T##BRbED*D$eyvIzPKQP0Sk*TL$4CPk;Nk3J~`6`U3TPy$o002ovPDHLk FV1nvmAXWeX literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_withdrawal.xml b/app/src/main/res/layout/activity_withdrawal.xml new file mode 100644 index 0000000..7ce6f62 --- /dev/null +++ b/app/src/main/res/layout/activity_withdrawal.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6a5c449..bd20aad 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,5 +81,10 @@ 위치기반 서비스 이용약관 오픈소스 라이센스 회원 탈퇴 + 탈퇴하기 + 회원 탈뢰 전 아래의 내용을 꼭 확인해 주세요. + 회원 탈퇴 시 회원 정보 및 서비스 이용 기록은 모두 삭제되며, 삭제된 데이터는 복구가 불가능합니다. 다만 법령에 의하여 보관해야 하는 경우 또는 회사 내부 정책에 의하여 보관해야 하는 정보는 탈퇴 후에도 일정 기간 보관됩니다. 자세한 사항은 개인정보처리방침에서 확인하실 수 있습니다. + 회원 탈퇴 후 재가입하더라도 탈퇴 전의 회원 정보 및 서비스 이용 기록은 복구되지 않습니다. + 회원을 탈퇴하더라도 집터뷰 서비스에 기록한 리뷰, 댓글 등의 게시물은 삭제되지 않습니다. 회원을 퇄퇴하면, 개인정보가 삭제되며 게시물을 수정하거나 삭제할 수 없으니게시물 삭제가 필요한 회원은 게시물 삭제 후 탈퇴 신청하시기 바랍니다.