-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Team-Umbba/Umbba-Android …
…into feat/#57 � Conflicts: � app/src/main/java/com/sopt/umbba_android/presentation/qna/QuestionAnswerViewModel.kt
- Loading branch information
Showing
41 changed files
with
941 additions
and
31 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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteActivity.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 |
---|---|---|
@@ -1,13 +1,29 @@ | ||
package com.sopt.umbba_android.presentation.invite | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.ActivityInviteBinding | ||
import com.sopt.umbba_android.presentation.onboarding.CommunicationActivity | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
|
||
class InviteActivity : BindingActivity<ActivityInviteBinding>(R.layout.activity_invite) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
goCommunicationActivity() | ||
goInviteCodeActivity() | ||
} | ||
|
||
private fun goCommunicationActivity() { | ||
binding.btnStart.setOnClickListener { | ||
startActivity(Intent(this, CommunicationActivity::class.java)) | ||
} | ||
} | ||
|
||
private fun goInviteCodeActivity() { | ||
binding.btnInputCode.setOnClickListener { | ||
startActivity(Intent(this, InviteCodeActivity::class.java)) | ||
} | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
app/src/main/java/com/sopt/umbba_android/presentation/login/AgreePrivacyUseActivity.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,122 @@ | ||
package com.sopt.umbba_android.presentation.login | ||
|
||
import android.content.Intent | ||
import android.graphics.Typeface | ||
import android.os.Bundle | ||
import android.text.Spannable | ||
import android.text.SpannableStringBuilder | ||
import android.text.style.StyleSpan | ||
import android.text.util.Linkify | ||
import android.widget.TextView | ||
import androidx.core.content.ContextCompat | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.ActivityAgreePrivacyUseBinding | ||
import com.sopt.umbba_android.presentation.invite.InviteActivity | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
import java.util.regex.Pattern | ||
|
||
class AgreePrivacyUseActivity : BindingActivity<ActivityAgreePrivacyUseBinding>(R.layout.activity_agree_privacy_use) { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
clickAllAgreeButton() | ||
clickCircleButton() | ||
setHyperLinkAndColorInTermsTextView() | ||
setHyperLinkAndColorInPrivacyTextView() | ||
goInviteActivity() | ||
} | ||
|
||
private fun clickAllAgreeButton() { | ||
with(binding) { | ||
btnAllAgreeCheck.setOnClickListener { | ||
btnAllAgreeCheck.isSelected = !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() { | ||
with(binding) { | ||
setHyperLinkToTextView("서비스 이용약관", tvAgreeTermsAndCondition, "https://www.notion.so/f1a14bf60ed4421f9b3761ef88906adb?pvs=4") | ||
setLinkTextColorToBlack(tvAgreeTermsAndCondition) | ||
setLinkBold(tvAgreeTermsAndCondition, 13) | ||
} | ||
} | ||
|
||
private fun setHyperLinkAndColorInPrivacyTextView() { | ||
with(binding) { | ||
setHyperLinkToTextView("개인정보 수집 및 이용", tvAgreePrivacy, "https://www.notion.so/99fe0f58825d4f87bd3b987fadc623b6?pvs=4") | ||
setLinkTextColorToBlack(tvAgreePrivacy) | ||
setLinkBold(tvAgreePrivacy, 17) | ||
} | ||
} | ||
|
||
private fun setHyperLinkToTextView(text: String, view: TextView, uri: String) { | ||
val transform = Linkify.TransformFilter { match, url -> "" } | ||
val pattern = Pattern.compile(text) | ||
|
||
Linkify.addLinks(view, pattern, uri, null, transform) | ||
} | ||
|
||
private fun setLinkTextColorToBlack(view: TextView) { | ||
view.setLinkTextColor(ContextCompat.getColor(this, R.color.umbba_black)) | ||
} | ||
|
||
private fun setLinkBold(view: TextView, end: Int) { | ||
val sentence = SpannableStringBuilder(view.text) | ||
sentence.setSpan(StyleSpan(Typeface.BOLD), 5, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) | ||
view.text = sentence | ||
} | ||
|
||
private fun goInviteActivity() { | ||
binding.btnNext.setOnClickListener { | ||
startActivity(Intent(this, InviteActivity::class.java)) | ||
} | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/CommunicationActivity.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,21 @@ | ||
package com.sopt.umbba_android.presentation.onboarding | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.ActivityCommunicationBinding | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
|
||
class CommunicationActivity : BindingActivity<ActivityCommunicationBinding>(R.layout.activity_communication) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
goInputInfoActivity() | ||
} | ||
|
||
private fun goInputInfoActivity() { | ||
binding.btnStart.setOnClickListener { | ||
startActivity(Intent(this, InputInfoActivity::class.java)) | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/InputInfoActivity.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 |
---|---|---|
@@ -1,21 +1,108 @@ | ||
package com.sopt.umbba_android.presentation.onboarding | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.text.Editable | ||
import android.text.TextWatcher | ||
import android.view.View | ||
import androidx.activity.viewModels | ||
import com.sopt.umbba_android.R | ||
import com.sopt.umbba_android.databinding.ActivityInputInfoBinding | ||
import com.sopt.umbba_android.presentation.viewmodel.InputInfoViewModel | ||
import com.sopt.umbba_android.util.binding.BindingActivity | ||
import java.util.regex.Pattern | ||
|
||
class InputInfoActivity : BindingActivity<ActivityInputInfoBinding>(R.layout.activity_input_info), | ||
View.OnClickListener { | ||
|
||
private val viewModel by viewModels<InputInfoViewModel>() | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.clickListener = this | ||
binding.viewmodel = viewModel | ||
|
||
checkAllInfoComplete() | ||
validateName() | ||
validateYear() | ||
goSelectFamilyActivity() | ||
} | ||
|
||
override fun onClick(view: View?) { | ||
when (view?.id) { | ||
R.id.iv_basic_back -> finish() | ||
} | ||
} | ||
|
||
private fun validateName() { | ||
with(binding) { | ||
etName.addTextChangedListener(object : TextWatcher { | ||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} | ||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { | ||
val namePattern = Pattern.compile(HANGUL_PATTERN) | ||
if (!etName.text?.matches(namePattern.toRegex())!!) { | ||
layoutInputName.error = "*형식이 올바르지 않습니다." | ||
} else if (etName.text.toString().length > 7) { | ||
layoutInputName.error = "*7글자 이하로 작성해주세요." | ||
} else { | ||
layoutInputName.error = null | ||
} | ||
} | ||
override fun afterTextChanged(p0: Editable?) {} | ||
}) | ||
} | ||
} | ||
|
||
private fun validateYear() { | ||
with(binding) { | ||
etYear.addTextChangedListener(object : TextWatcher { | ||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} | ||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { | ||
val yearPattern = Pattern.compile(NUMBER_PATTERN) | ||
if (!etYear.text?.matches(yearPattern.toRegex())!!) { | ||
layoutInputYear.error = "*형식이 올바르지 않습니다." | ||
} else if (etYear.text.toString().length > 4) { | ||
layoutInputYear.error = "*4글자로 작성해주세요." | ||
} else { | ||
layoutInputYear.error = null | ||
} | ||
} | ||
override fun afterTextChanged(p0: Editable?) {} | ||
}) | ||
} | ||
} | ||
|
||
private fun checkAllInfoComplete() { | ||
viewModel.name.observe(this) { | ||
viewModel.checkInfoComplete() | ||
} | ||
viewModel.man.observe(this) { | ||
viewModel.checkInfoComplete() | ||
} | ||
viewModel.woman.observe(this) { | ||
viewModel.checkInfoComplete() | ||
} | ||
viewModel.year.observe(this) { | ||
viewModel.checkInfoComplete() | ||
} | ||
viewModel.isAllInfoComplete.observe(this) { | ||
binding.btnNext.isEnabled = | ||
binding.layoutInputName.error.isNullOrEmpty() && binding.layoutInputYear.error.isNullOrEmpty() && binding.etYear.text.toString() | ||
.isNotEmpty() && binding.etName.text.toString().isNotEmpty() | ||
} | ||
} | ||
|
||
private fun goSelectFamilyActivity() { | ||
binding.btnNext.setOnClickListener { | ||
if (true) { //초대하는 사람 | ||
startActivity(Intent(this, SelectFamilyActivity::class.java)) | ||
} else { //초대받는 사람 | ||
startActivity(Intent(this, QuestActivity::class.java)) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
const val HANGUL_PATTERN = "^[가-힣]*$" | ||
const val NUMBER_PATTERN = "^([12]\\d{3})*$" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.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,12 @@ | ||
package com.sopt.umbba_android.presentation.onboarding | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.sopt.umbba_android.R | ||
|
||
class OnboardingFinishActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_onboarding_finish) | ||
} | ||
} |
Oops, something went wrong.