Skip to content
Snippets Groups Projects
Commit b87299e9 authored by Taras's avatar Taras
Browse files

Setup views clicks

parent 7b0c6831
No related branches found
No related tags found
No related merge requests found
......@@ -2,11 +2,13 @@ package com.futo.circles.feature.validate_email
import android.os.Bundle
import android.view.View
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment
import by.kirich1409.viewbindingdelegate.viewBinding
import com.futo.circles.R
import com.futo.circles.core.HasLoadingState
import com.futo.circles.databinding.ValidateEmailFragmentBinding
import com.futo.circles.extensions.showDialog
import org.koin.androidx.viewmodel.ext.android.viewModel
class ValidateEmailFragment : Fragment(R.layout.validate_email_fragment), HasLoadingState {
......@@ -17,7 +19,39 @@ class ValidateEmailFragment : Fragment(R.layout.validate_email_fragment), HasLoa
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupViews()
setupObservers()
}
private fun setupViews() {
with(binding) {
tilEmail.editText?.doAfterTextChanged {
it?.let { btnSendCode.setButtonEnabled(it.isNotEmpty()) }
}
tilEmail.setEndIconOnClickListener {
showDialog(
R.string.email,
R.string.email_usage_explanation
)
}
tilValidationCode.setEndIconOnClickListener {
showDialog(
R.string.validation_code,
R.string.validation_code_explanation
)
}
btnSendCode.setOnClickListener {
startLoading(btnSendCode)
viewModel.sendCode(tilEmail.editText?.text?.toString()?.trim() ?: "")
}
btnValidate.setOnClickListener {
startLoading(btnValidate)
viewModel.validateEmail(tilValidationCode.editText?.text?.toString()?.trim() ?: "")
}
}
}
private fun setupObservers() {
}
}
\ No newline at end of file
......@@ -7,5 +7,13 @@ class ValidateEmailViewModel(
private val dataSource: ValidateEmailDataSource
) : ViewModel() {
fun sendCode(email: String) {
}
fun validateEmail(code: String) {
}
}
\ No newline at end of file
......@@ -71,6 +71,8 @@
<string name="email">Email</string>
<string name="validation_code">Validation code</string>
<string name="send_validation_code">Send validation code</string>
<string name="email_usage_explanation">Must be a currently valid and active address.\n\nDon\'t worry - we will only use this address for security and other alerts about your account. We don't send spam, and we don't sell your address.</string>
<string name="validation_code_explanation">We sent a 6-digit code to your email address to validate your account.\n\nEnter the code here to verify that this address belongs to you.</string>
<plurals name="member_plurals">
<item quantity="one">%d member</item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment