Skip to content

Commit

Permalink
[Feat/#46] 체크 버튼 로직 생성 및 아이콘 selector 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoncheong committed Jul 11, 2023
1 parent 62fcac7 commit d001fd6
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,63 @@ class AgreePrivacyUseActivity : BindingActivity<ActivityAgreePrivacyUseBinding>(
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

clickAllAgreeButton()
clickCircleButton()
setHyperLinkAndColorInTermsTextView()
setHyperLinkAndColorInPrivacyTextView()
goInviteActivity()
}

private fun clickAllAgreeButton() {
binding.btnAllAgreeCheck.setOnClickListener {
binding.btnAllAgreeCheck.isSelected = !binding.btnAllAgreeCheck.isSelected
checkAllAgreeButton()
}
}

private fun checkAllAgreeButton() {
with(binding) {
if (btnAllAgreeCheck.isSelected) {
btnUp14.isSelected = true
btnAgreeTermsAndCondition.isSelected = true
btnAgreePrivacy.isSelected = true
btnNext.isEnabled = true
} else {
btnUp14.isSelected = false
btnAgreeTermsAndCondition.isSelected = false
btnAgreePrivacy.isSelected = false
btnNext.isEnabled = false
}
}
}

private fun clickCircleButton() {
with(binding) {
btnUp14.setOnClickListener {
btnUp14.isSelected = !btnUp14.isSelected
checkAllCircleButton()
}
btnAgreeTermsAndCondition.setOnClickListener {
btnAgreeTermsAndCondition.isSelected = !btnAgreeTermsAndCondition.isSelected
checkAllCircleButton()
}
btnAgreePrivacy.setOnClickListener {
btnAgreePrivacy.isSelected = !btnAgreePrivacy.isSelected
checkAllCircleButton()
}
}
}

private fun checkAllCircleButton() {
with(binding) {
if (btnUp14.isSelected && btnAgreeTermsAndCondition.isSelected && btnAgreePrivacy.isSelected) {
btnAllAgreeCheck.isSelected = true
btnNext.isEnabled = true
} else {
btnAllAgreeCheck.isSelected = false
btnNext.isEnabled = false
}
}
}

private fun setHyperLinkAndColorInTermsTextView() {
Expand Down
34 changes: 19 additions & 15 deletions app/src/main/res/layout/activity_agree_privacy_use.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:layout_marginEnd="28dp"
android:src="@drawable/ic_no_check_48"
android:clickable="true"
android:src="@drawable/sel_btn_agree"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_line1" />

Expand Down Expand Up @@ -111,7 +112,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="28dp"
android:src="@drawable/ic_no_circle_check_48"
android:clickable="true"
android:src="@drawable/sel_btn_agree_circle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_all_agree_description" />

Expand Down Expand Up @@ -147,7 +149,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="28dp"
android:src="@drawable/ic_no_circle_check_48"
android:clickable="true"
android:src="@drawable/sel_btn_agree_circle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_up_14_description" />

Expand All @@ -156,20 +159,21 @@
style="@style/AndroidBody2_2Regular12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/agree_privacy"
android:textColor="@color/umbba_black"
android:layout_marginStart="28dp"
android:layout_marginTop="34dp"
app:layout_constraintTop_toBottomOf="@id/tv_agree_terms_and_condition"
app:layout_constraintStart_toStartOf="parent"/>
android:text="@string/agree_privacy"
android:textColor="@color/umbba_black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_agree_terms_and_condition" />

<ImageView
android:id="@+id/btn_agree_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_no_circle_check_48"
android:layout_marginEnd="28dp"
android:layout_marginTop="17dp"
android:layout_marginEnd="28dp"
android:clickable="true"
android:src="@drawable/sel_btn_agree_circle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_agree_terms_and_condition" />

Expand All @@ -178,14 +182,14 @@
style="@style/AndroidCaptionRegular10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/agree_privacy_description"
android:textColor="@color/grey_800"
android:layout_marginTop="9dp"
android:layout_marginStart="28dp"
android:layout_marginTop="9dp"
android:layout_marginEnd="7dp"
app:layout_constraintTop_toBottomOf="@id/tv_agree_privacy"
android:text="@string/agree_privacy_description"
android:textColor="@color/grey_800"
app:layout_constraintEnd_toStartOf="@id/btn_agree_privacy"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_agree_privacy"/>
app:layout_constraintTop_toBottomOf="@id/tv_agree_privacy" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_next"
Expand All @@ -197,7 +201,7 @@
android:background="@drawable/sel_btn_next_agree"
android:enabled="false"
android:stateListAnimator="@null"
android:text="@string/btn_start_code"
android:text="@string/btn_next"
android:textColor="@color/sel_btn_pri500_text"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down

0 comments on commit d001fd6

Please sign in to comment.