|
@@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.lifecycle.Observer
|
|
|
import com.sambath.sbc.R
|
|
|
import com.sambath.sbc.app.App
|
|
|
+import com.sambath.sbc.app.MainActivity
|
|
|
import com.sambath.sbc.app.ShareActivity
|
|
|
import com.sambath.sbc.remote.User
|
|
|
import com.sambath.sbc.screen.register.RegisterActivity
|
|
@@ -26,23 +27,27 @@ class LoginActivity : AppCompatActivity() {
|
|
|
if (user != null) et_username.setText(user?.userName)
|
|
|
loginViewModel.state.observe(this, Observer(this::render))
|
|
|
btn_login.setOnClickListener {
|
|
|
- til_username.isErrorEnabled = false
|
|
|
- til_username.error = null
|
|
|
- til_password.isErrorEnabled = false
|
|
|
- til_password.error = null
|
|
|
- val username = et_username.text //aaaaaa004 Bbbbbb001
|
|
|
- val password = et_password.text
|
|
|
- if (username.isNullOrEmpty()) {
|
|
|
- til_username.error = getString(R.string.err_not_empty)
|
|
|
- til_username.requestFocus()
|
|
|
- return@setOnClickListener
|
|
|
- }
|
|
|
- if (password.isNullOrEmpty()) {
|
|
|
- til_password.error = getString(R.string.err_not_empty)
|
|
|
- til_password.requestFocus()
|
|
|
- return@setOnClickListener
|
|
|
- }
|
|
|
- loginViewModel.login(username.toString(), password.toString())
|
|
|
+// til_username.isErrorEnabled = false
|
|
|
+// til_username.error = null
|
|
|
+// til_password.isErrorEnabled = false
|
|
|
+// til_password.error = null
|
|
|
+// val username = et_username.text //aaaaaa004 Bbbbbb001
|
|
|
+// val password = et_password.text
|
|
|
+// if (username.isNullOrEmpty()) {
|
|
|
+// til_username.error = getString(R.string.err_not_empty)
|
|
|
+// til_username.requestFocus()
|
|
|
+// return@setOnClickListener
|
|
|
+// }
|
|
|
+// if (password.isNullOrEmpty()) {
|
|
|
+// til_password.error = getString(R.string.err_not_empty)
|
|
|
+// til_password.requestFocus()
|
|
|
+// return@setOnClickListener
|
|
|
+// }
|
|
|
+// loginViewModel.login(username.toString(), password.toString())
|
|
|
+
|
|
|
+ val intent = Intent(this, MainActivity::class.java)
|
|
|
+ startActivity(intent)
|
|
|
+ finishAffinity()
|
|
|
}
|
|
|
|
|
|
btn_signup.setOnClickListener {
|