Skip to content

Instantly share code, notes, and snippets.

@dphans
Created April 11, 2018 04:34
Show Gist options
  • Save dphans/da9abe7756452de96cb75bfac6948274 to your computer and use it in GitHub Desktop.
Save dphans/da9abe7756452de96cb75bfac6948274 to your computer and use it in GitHub Desktop.
package com.dinophan.authapp.ui.activities
import android.view.View
import com.dinophan.authapp.R
import com.dinophan.authapp.bases.BaseActivity
import com.dinophan.authapp.databinding.ActivityMainBinding
import com.dinophan.authapp.models.UserModel
import com.dinophan.authapp.modules.mock.APIMock
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
private val userData: UserModel = UserModel()
override fun onActivityCreated(dataBinder: ActivityMainBinding) {
dataBinder.presenter = Presenter()
dataBinder.isRegisterationState = false
dataBinder.isFormSubmitting = false
dataBinder.isFormValidated = [email protected]()
}
@Suppress("UNUSED_PARAMETER")
inner class Presenter {
private var confirmationPassword: String = String()
fun onUsernameChanged(text: CharSequence, start: Int, before: Int, count: Int) {
[email protected] = text.toString()
[email protected]()
}
fun onPasswordChanged(text: CharSequence, start: Int, before: Int, count: Int) {
[email protected] = text.toString()
[email protected]()
}
fun onConfirmationPasswordChanged(text: CharSequence, start: Int, before: Int, count: Int) {
[email protected] = text.toString()
[email protected]()
}
fun onToggleRegisterationState(view: View) {
[email protected]()?.isRegisterationState = !([email protected]()?.isRegisterationState ?: false)
[email protected]()
}
fun onFormSubmit(view: View) {
}
private fun validates() {
[email protected]()?.isFormValidated = [email protected](if ([email protected]()?.isRegisterationState == true) [email protected] else null)
[email protected]()?.formErrorMessage = [email protected]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment