feat: last
This commit is contained in:
parent
116eb2f04b
commit
a7de8a2898
@ -67,9 +67,9 @@ public class InformationFragment extends Fragment {
|
|||||||
// onClickScan(view);
|
// onClickScan(view);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
binding.logout.setOnClickListener(view2 -> {
|
/*binding.logout.setOnClickListener(view2 -> {
|
||||||
onClickLogout(view);
|
onClickLogout(view);
|
||||||
});
|
});*/
|
||||||
|
|
||||||
binding.refreshLayout.setOnRefreshListener(() -> {
|
binding.refreshLayout.setOnRefreshListener(() -> {
|
||||||
viewModel.load();
|
viewModel.load();
|
||||||
@ -250,9 +250,9 @@ public class InformationFragment extends Fragment {
|
|||||||
|
|
||||||
private void takeError() {
|
private void takeError() {
|
||||||
//binding.photo.setVisibility(View.GONE);
|
//binding.photo.setVisibility(View.GONE);
|
||||||
binding.fullname.setVisibility(View.GONE);
|
//binding.fullname.setVisibility(View.GONE);
|
||||||
binding.lastEntry.setVisibility(View.GONE);
|
//binding.lastEntry.setVisibility(View.GONE);
|
||||||
binding.position.setVisibility(View.GONE);
|
//binding.position.setVisibility(View.GONE);
|
||||||
//binding.logout.setVisibility(View.GONE);
|
//binding.logout.setVisibility(View.GONE);
|
||||||
//binding.scan.setVisibility(View.GONE);
|
//binding.scan.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
@ -58,11 +58,11 @@ public class LoginFragment extends Fragment {
|
|||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
super.afterTextChanged(s);
|
super.afterTextChanged(s);
|
||||||
viewModel.changeUsername(s.toString());
|
viewModel.changeUsername(s.toString());
|
||||||
if (binding.password.getText().length() >= 5 && binding.username.getText().length() >= 3 && binding.username.getText().toString().matches("[0-9a-zA-Z]+") && (binding.username.getText().toString().charAt(0) + "").matches("[0-9]+")) {
|
//if (binding.password.getText().length() >= 5 && binding.username.getText().length() >= 3 && binding.username.getText().toString().matches("[0-9a-zA-Z]+") && (binding.username.getText().toString().charAt(0) + "").matches("[0-9]+")) {
|
||||||
binding.login.setEnabled(true);
|
binding.login.setEnabled(true);
|
||||||
} else {
|
//} else {
|
||||||
binding.login.setEnabled(false);
|
// binding.login.setEnabled(false);
|
||||||
}
|
//}
|
||||||
if (binding.error.getVisibility() == View.VISIBLE) {
|
if (binding.error.getVisibility() == View.VISIBLE) {
|
||||||
binding.error.setVisibility(View.GONE);
|
binding.error.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -79,11 +79,11 @@ public class LoginFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
viewModel.changePassword(charSequence.toString());
|
viewModel.changePassword(charSequence.toString());
|
||||||
if (binding.password.getText().length() >= 5 && binding.username.getText().length() >= 3 && binding.username.getText().toString().matches("[0-9a-zA-Z]+") && (binding.username.getText().toString().charAt(0) + "").matches("[0-9]+")) {
|
//if (binding.password.getText().length() >= 5 && binding.username.getText().length() >= 3 && binding.username.getText().toString().matches("[0-9a-zA-Z]+") && (binding.username.getText().toString().charAt(0) + "").matches("[0-9]+")) {
|
||||||
binding.login.setEnabled(true);
|
binding.login.setEnabled(true);
|
||||||
} else {
|
//} else {
|
||||||
binding.login.setEnabled(false);
|
// binding.login.setEnabled(false);
|
||||||
}
|
//}
|
||||||
if (binding.error.getVisibility() == View.VISIBLE) {
|
if (binding.error.getVisibility() == View.VISIBLE) {
|
||||||
binding.error.setVisibility(View.GONE);
|
binding.error.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class ProfileFragment extends Fragment {
|
|||||||
if (state.getUser() != null && state.getErrorMessage() == null) {
|
if (state.getUser() != null && state.getErrorMessage() == null) {
|
||||||
binding.username.setText(userEntity.getUsername());
|
binding.username.setText(userEntity.getUsername());
|
||||||
binding.position.setText(userEntity.getPosition());
|
binding.position.setText(userEntity.getPosition());
|
||||||
binding.name.setText(userEntity.getName());
|
binding.lastTime.setText(userEntity.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -11,6 +11,7 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -26,6 +27,7 @@ import ru.myitschool.work.databinding.FragmentResultBinding;
|
|||||||
import ru.myitschool.work.domain.entities.UserEntity;
|
import ru.myitschool.work.domain.entities.UserEntity;
|
||||||
import ru.myitschool.work.ui.Door;
|
import ru.myitschool.work.ui.Door;
|
||||||
import ru.myitschool.work.ui.StoreAPI;
|
import ru.myitschool.work.ui.StoreAPI;
|
||||||
|
import ru.myitschool.work.ui.login.LoginViewModel;
|
||||||
import ru.myitschool.work.ui.profile.ProfileViewModel;
|
import ru.myitschool.work.ui.profile.ProfileViewModel;
|
||||||
import ru.myitschool.work.utils.Constants;
|
import ru.myitschool.work.utils.Constants;
|
||||||
import ru.myitschool.work.utils.PreferenceManager;
|
import ru.myitschool.work.utils.PreferenceManager;
|
||||||
@ -58,6 +60,7 @@ public class ResultFragment extends Fragment {
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
preferenceManager = new PreferenceManager(this.getContext());
|
preferenceManager = new PreferenceManager(this.getContext());
|
||||||
|
|
||||||
|
viewModel = new ViewModelProvider(this).get(ResultViewModel.class);
|
||||||
code = preferenceManager.getString(Constants.KEY_RESULT);
|
code = preferenceManager.getString(Constants.KEY_RESULT);
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
Toast.makeText(this.getContext(), code, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this.getContext(), code, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -5,18 +5,10 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/iconmain"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/root_fragment"
|
|
||||||
app:layout_constraintHorizontal_bias="0.17"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
app:layout_constraintTop_toBottomOf="@id/image"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
||||||
|
@ -5,6 +5,15 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/iconmain"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/root_fragment"
|
||||||
|
app:layout_constraintHorizontal_bias="0.17"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/username"
|
android:id="@+id/username"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user