Commit 9212468a authored by shohboz's avatar shohboz

[ADD] MUS-125 Feature, add login api

parent 95a1d1bf
......@@ -65,8 +65,21 @@ class PasswordFragment : BaseFragment(R.layout.fragment_password) {
btnLogin.setOnClickListener(object : ButtonClick() {
override fun onSingleClick(v: View?) {
val phone = inputPassword.text.toString().trim()
viewModel.login(UserAuth(phone, "password"))
val password = inputPassword.text.toString().trim()
when{
password.length < 6 -> {
inputPassword.startAnimation(
android.view.animation.AnimationUtils.loadAnimation(
requireContext(),
R.anim.shake
)
)
}
else ->{
viewModel.login(UserAuth(phone.replace(" ",""), password))
}
}
}
})
......@@ -86,6 +99,12 @@ class PasswordFragment : BaseFragment(R.layout.fragment_password) {
}
is UiStateObject.ERROR -> {
showProgressDialog(false)
bn.inputPassword.startAnimation(
android.view.animation.AnimationUtils.loadAnimation(
requireContext(),
R.anim.shake
)
)
showMessage(it.message)
}
is UiStateObject.LOADING -> {
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -34,7 +35,7 @@
android:layout_marginStart="@dimen/_12sdp"
android:layout_marginTop="@dimen/_14sdp"
android:layout_marginBottom="@dimen/_4sdp"
android:text="Телефон:"
android:text="@string/phone"
android:textColor="@color/black"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
......@@ -66,17 +67,6 @@
android:paddingStart="@dimen/_12sdp" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/txt_check_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_6sdp"
android:visibility="invisible"
android:text="Должно быть не менее 6 символов"
android:textColor="@color/light"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/layout_input_confirm"
app:layout_constraintTop_toBottomOf="@id/layout_input_password" />
<TextView
android:id="@+id/txt_hint_confirm"
......@@ -84,7 +74,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_34sdp"
android:layout_marginBottom="@dimen/_4sdp"
android:text="Пароль:"
android:text="@string/password"
android:textColor="@color/black"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/layout_input_confirm"
......@@ -106,11 +96,12 @@
android:layout_height="match_parent"
android:background="@drawable/edit_text_bgn"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:inputType="number"
android:maxLength="7"
android:textSize="@dimen/_12sdp"
android:paddingVertical="@dimen/_12sdp"
android:paddingStart="@dimen/_12sdp"
/>
tools:ignore="RtlSymmetry" />
</com.google.android.material.textfield.TextInputLayout>
......@@ -119,7 +110,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/_6sdp"
android:text="Забыли пароль?"
android:text="@string/forget_password"
android:background="?android:selectableItemBackground"
android:textColor="@color/light_dark"
android:textStyle="bold"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment