Some logs removed
This commit is contained in:
parent
8125f02c91
commit
6266e01a0d
@ -49,10 +49,8 @@ public class LoginFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
private void subscribe(LoginViewModel viewModel) {
|
private void subscribe(LoginViewModel viewModel) {
|
||||||
viewModel.errorLiveData.observe(getViewLifecycleOwner(), error -> {
|
viewModel.errorLiveData.observe(getViewLifecycleOwner(), error ->
|
||||||
binding.error.setVisibility(Utils.visibleOrGone(error != null));
|
binding.error.setVisibility(Utils.visibleOrGone(error != null)));
|
||||||
binding.error.setText(error);
|
|
||||||
});
|
|
||||||
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
|
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
|
||||||
binding.login.setClickable(state.isButtonActive());
|
binding.login.setClickable(state.isButtonActive());
|
||||||
if (state.isButtonActive()) {
|
if (state.isButtonActive()) {
|
||||||
|
@ -3,7 +3,6 @@ package ru.myitschool.work.ui.profile;
|
|||||||
import static ru.myitschool.work.ui.qr.result.QrResultFragment.RESPONSE_KEY;
|
import static ru.myitschool.work.ui.qr.result.QrResultFragment.RESPONSE_KEY;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -40,15 +39,13 @@ public class UserFragment extends Fragment {
|
|||||||
viewModel = new ViewModelProvider(this).get(UserViewModel.class);
|
viewModel = new ViewModelProvider(this).get(UserViewModel.class);
|
||||||
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
|
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
|
||||||
UserEntity entity = state.getItem();
|
UserEntity entity = state.getItem();
|
||||||
if (entity == null) {
|
if (state.getErrorMessage() != null) {
|
||||||
return;
|
|
||||||
} else if (state.getErrorMessage() != null) {
|
|
||||||
binding.error.setVisibility(View.VISIBLE);
|
binding.error.setVisibility(View.VISIBLE);
|
||||||
binding.error.setText(state.getErrorMessage());
|
binding.error.setText(state.getErrorMessage());
|
||||||
|
|
||||||
binding.logout.setVisibility(View.GONE);
|
binding.logout.setVisibility(View.GONE);
|
||||||
binding.scan.setVisibility(View.GONE);
|
binding.scan.setVisibility(View.GONE);
|
||||||
} else {
|
} else if (entity != null) {
|
||||||
binding.photo.setVisibility(Utils.visibleOrGone(entity.getPhotoUrl() != null));
|
binding.photo.setVisibility(Utils.visibleOrGone(entity.getPhotoUrl() != null));
|
||||||
binding.position.setVisibility(Utils.visibleOrGone(entity.getPosition() != null));
|
binding.position.setVisibility(Utils.visibleOrGone(entity.getPosition() != null));
|
||||||
binding.lastEntry.setVisibility(Utils.visibleOrGone(entity.getLast_visit() != null));
|
binding.lastEntry.setVisibility(Utils.visibleOrGone(entity.getLast_visit() != null));
|
||||||
@ -66,7 +63,6 @@ public class UserFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (getContext() != null && Utils.getLogin(getContext()) != null) {
|
if (getContext() != null && Utils.getLogin(getContext()) != null) {
|
||||||
Log.d("login", Utils.getLogin(getContext()));
|
|
||||||
viewModel.update(Utils.getLogin(getContext()));
|
viewModel.update(Utils.getLogin(getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:background="@color/white">
|
android:background="@color/white">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -23,8 +22,9 @@
|
|||||||
android:textSize="24sp" />
|
android:textSize="24sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:paddingStart="20dp"
|
android:paddingHorizontal="20dp"
|
||||||
android:fontFamily="@font/manrope_light"
|
android:fontFamily="@font/manrope_light"
|
||||||
android:id="@+id/username"
|
android:id="@+id/username"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -50,7 +50,8 @@
|
|||||||
android:textColor="@color/warn_button_color"
|
android:textColor="@color/warn_button_color"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="Some error"/>
|
android:visibility="gone"
|
||||||
|
android:text="@string/error"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user