-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6 mypage_fragment/설정 화면 : 5 회원 탈퇴 화면
- 회원 탈퇴 화면 구현
- Loading branch information
Showing
9 changed files
with
337 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters