Skip to content

Commit

Permalink
#6 mypage_fragment/설정 화면 : 5 회원 탈퇴 화면
Browse files Browse the repository at this point in the history
 - 회원 탈퇴 화면 구현
  • Loading branch information
likppi10 committed Aug 23, 2022
1 parent 4291920 commit 19a8786
Show file tree
Hide file tree
Showing 9 changed files with 337 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
android:usesCleartextTraffic="true"
tools:targetApi="31"
>

<activity
android:name=".ui.withdrawal.WithdrawalActivity"
android:exported="false"
/>
<activity
android:name=".ui.manageaccount.ManageAccountActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.ftw.hometerview.ui.searchaddressbuilding.SearchAddressBuildingViewMod
import com.ftw.hometerview.ui.searchcompanyresult.SearchCompanyResultViewModel
import com.ftw.hometerview.ui.splash.SplashViewModel
import com.ftw.hometerview.ui.updatenickname.UpdateNicknameViewModel
import com.ftw.hometerview.ui.withdrawal.WithdrawalViewModel
import com.ftw.hometerview.ui.writtenreview.WrittenReviewViewModel
import dagger.Module
import dagger.Provides
Expand Down Expand Up @@ -114,4 +115,14 @@ class ActivityViewModelModule {
fun provideManageAccountViewModel(): ManageAccountViewModel {
return ManageAccountViewModel()
}

@Provides
@ActivityScoped
fun provideWithdrawalViewModel(
dispatcher: Dispatcher
): WithdrawalViewModel {
return WithdrawalViewModel(
dispatcher
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.ftw.hometerview.R
import com.ftw.hometerview.databinding.ActivityManageAccountBinding
import com.ftw.hometerview.ui.withdrawal.WithdrawalActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand Down Expand Up @@ -61,6 +62,7 @@ class ManageAccountActivity : AppCompatActivity() {
private fun onClickUseUserInfo() { }
private fun onClickLocationForService() { }
private fun onClickOpenSourceLibrary() { }
private fun onClickWithdrawal() { }

}
private fun onClickWithdrawal() {
startActivity(WithdrawalActivity.newIntent(this))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.ftw.hometerview.ui.withdrawal

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.ftw.hometerview.R
import com.ftw.hometerview.databinding.ActivityWithdrawalBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject

@AndroidEntryPoint
class WithdrawalActivity : AppCompatActivity() {

companion object {
fun newIntent(context: Context): Intent {
return Intent(context, WithdrawalActivity::class.java)
}
}

@Inject
lateinit var viewModel: WithdrawalViewModel

private lateinit var binding: ActivityWithdrawalBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView<ActivityWithdrawalBinding>(
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
}
}
Original file line number Diff line number Diff line change
@@ -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<Event> = MutableStateFlow(Event.None)
val event: StateFlow<Event> = _event.asStateFlow()

val withdrawalFirstCheck: MutableStateFlow<Boolean> = MutableStateFlow(false)
val withdrawalSecondCheck: MutableStateFlow<Boolean> = MutableStateFlow(false)
val withdrawalThirdCheck: MutableStateFlow<Boolean> = MutableStateFlow(false)
val withdrawalCheck: MutableStateFlow<Boolean> = 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
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
166 changes: 166 additions & 0 deletions app/src/main/res/layout/activity_withdrawal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>

<data>

<variable
name="viewModel"
type="com.ftw.hometerview.ui.withdrawal.WithdrawalViewModel"
/>
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.withdrawal.WithdrawalActivity"
>

<ImageView
android:id="@+id/back_button"
android:layout_width="@dimen/dp_size_32"
android:layout_height="@dimen/dp_size_32"
android:layout_marginStart="@dimen/dp_size_16"
android:layout_marginTop="@dimen/dp_size_16"
android:src="@drawable/ic_baseline_navigate_before_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<TextView
android:id="@+id/withdrawal_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/pretendard_medium"
android:text="@string/withdrawal_title"
android:textColor="@color/gray_900"
android:textSize="@dimen/sp_size_15"
app:layout_constraintBottom_toBottomOf="@+id/back_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/back_button"
/>

<View
android:id="@+id/divide_view"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_size_1"
android:layout_marginTop="@dimen/dp_size_16"
android:background="@color/gray_200"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/withdrawal_title"
/>

<TextView
android:id="@+id/withdrawal_check_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_size_16"
android:fontFamily="@font/pretendard_semibold"
android:text="@string/withdrawal_check_text"
android:textColor="@color/red_500"
android:textSize="@dimen/sp_size_12"
app:layout_constraintStart_toEndOf="@+id/back_button"
app:layout_constraintTop_toBottomOf="@+id/divide_view"
/>

<ImageView
android:id="@+id/withdrawal_first_check"
android:layout_width="@dimen/dp_size_28"
android:layout_height="@dimen/dp_size_28"
android:layout_marginStart="@dimen/dp_size_12"
android:layout_marginTop="@dimen/dp_size_16"
android:onClick="@{() -> viewModel.onClickWithdrawalFirstCheck()}"
android:src="@drawable/icon_check_disabled"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/withdrawal_check_text"
/>

<TextView
android:id="@+id/withdrawal_first_check_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_size_16"
android:fontFamily="@font/pretendard_regular"
android:text="@string/withdrawal_first_check_text"
android:textColor="@color/gray_900"
android:textSize="@dimen/sp_size_12"
android:layout_marginStart="@dimen/dp_size_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/withdrawal_first_check"
app:layout_constraintTop_toTopOf="@+id/withdrawal_first_check"
/>

<ImageView
android:id="@+id/withdrawal_second_check"
android:layout_width="@dimen/dp_size_28"
android:layout_height="@dimen/dp_size_28"
android:layout_marginStart="@dimen/dp_size_12"
android:layout_marginTop="@dimen/dp_size_16"
android:onClick="@{() -> viewModel.onClickWithdrawalSecondCheck()}"
android:src="@drawable/icon_check_disabled"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/withdrawal_first_check_text"
/>

<TextView
android:id="@+id/withdrawal_second_check_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_size_16"
android:fontFamily="@font/pretendard_regular"
android:text="@string/withdrawal_second_check_text"
android:textColor="@color/gray_900"
android:textSize="@dimen/sp_size_12"
android:layout_marginStart="@dimen/dp_size_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/withdrawal_second_check"
app:layout_constraintTop_toTopOf="@+id/withdrawal_second_check"
/>

<ImageView
android:id="@+id/withdrawal_third_check"
android:layout_width="@dimen/dp_size_28"
android:layout_height="@dimen/dp_size_28"
android:layout_marginStart="@dimen/dp_size_12"
android:layout_marginTop="@dimen/dp_size_16"
android:onClick="@{() -> viewModel.onClickWithdrawalThirdCheck()}"
android:src="@drawable/icon_check_disabled"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/withdrawal_second_check_text"
/>

<TextView
android:id="@+id/withdrawal_third_check_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_size_16"
android:fontFamily="@font/pretendard_regular"
android:text="@string/withdrawal_third_check_text"
android:textColor="@color/gray_900"
android:textSize="@dimen/sp_size_12"
android:layout_marginStart="@dimen/dp_size_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/withdrawal_third_check"
app:layout_constraintTop_toTopOf="@+id/withdrawal_third_check"
/>

<com.ftw.hometerview.design.MainButton
android:id="@+id/withdrawal_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_size_32"
android:layout_marginHorizontal="@dimen/dp_size_16"
android:text="@string/withdrawal_button_text"
android:textAlignment="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@
<string name="loc_for_service_text">위치기반 서비스 이용약관</string>
<string name="open_source_license_text">오픈소스 라이센스</string>
<string name="withdrawal_text">회원 탈퇴</string>
<string name="withdrawal_button_text">탈퇴하기</string>
<string name="withdrawal_check_text">회원 탈뢰 전 아래의 내용을 꼭 확인해 주세요.</string>
<string name="withdrawal_first_check_text">회원 탈퇴 시 회원 정보 및 서비스 이용 기록은 모두 삭제되며, 삭제된 데이터는 복구가 불가능합니다. 다만 법령에 의하여 보관해야 하는 경우 또는 회사 내부 정책에 의하여 보관해야 하는 정보는 탈퇴 후에도 일정 기간 보관됩니다. 자세한 사항은 개인정보처리방침에서 확인하실 수 있습니다.</string>
<string name="withdrawal_second_check_text">회원 탈퇴 후 재가입하더라도 탈퇴 전의 회원 정보 및 서비스 이용 기록은 복구되지 않습니다.</string>
<string name="withdrawal_third_check_text">회원을 탈퇴하더라도 집터뷰 서비스에 기록한 리뷰, 댓글 등의 게시물은 삭제되지 않습니다. 회원을 퇄퇴하면, 개인정보가 삭제되며 게시물을 수정하거나 삭제할 수 없으니게시물 삭제가 필요한 회원은 게시물 삭제 후 탈퇴 신청하시기 바랍니다. </string>

</resources>

0 comments on commit 19a8786

Please sign in to comment.