Reduced some unused imports

This commit is contained in:
A1pha 2024-11-27 15:15:59 +03:00
parent 7658500289
commit 2e6837390a
11 changed files with 5 additions and 31 deletions

View File

@ -1,7 +1,5 @@
package ru.myitschool.work.data;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.function.Consumer;

View File

@ -4,7 +4,6 @@ import static ru.myitschool.work.core.Constants.SERVER_ADDRESS;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import ru.myitschool.work.data.UserRepositoryImplementation;
import ru.myitschool.work.data.source.UserApi;
public class RetrofitFactory {

View File

@ -1,6 +1,5 @@
package ru.myitschool.work.data.source;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class Credentials {

View File

@ -1,7 +1,5 @@
package ru.myitschool.work.domain.qr;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.function.Consumer;

View File

@ -4,9 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -59,9 +57,7 @@ public class LoginFragment extends Fragment {
binding.error.setVisibility(Utils.visibleOrGone(error != null));
binding.error.setText(error);
});
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
binding.login.setClickable(state.isButtonActive());
});
viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> binding.login.setClickable(state.isButtonActive()));
viewModel.openProfileLiveData.observe(getViewLifecycleOwner(), (unused) -> {
if (getContext() != null) {
@ -72,7 +68,6 @@ public class LoginFragment extends Fragment {
}
if (getView() == null) return;
Log.d("process", "navigated");
Navigation.findNavController(getView()).navigate(
R.id.action_loginFragment_to_userFragment);
});

View File

@ -1,7 +1,5 @@
package ru.myitschool.work.ui.login;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
@ -14,9 +12,7 @@ import ru.myitschool.work.domain.login.IsUserExistUseCase;
public class LoginViewModel extends ViewModel {
private final State INIT_STATE = new State(false);
private final MutableLiveData<State> mutableStateLiveData = new MutableLiveData<State>(
INIT_STATE
);
private final MutableLiveData<State> mutableStateLiveData = new MutableLiveData<State>(INIT_STATE);
public final LiveData<State> stateLiveData = mutableStateLiveData;
private final MutableLiveData<String> mutableErrorLiveData = new MutableLiveData<String>();
public final LiveData<String> errorLiveData = mutableErrorLiveData;
@ -52,7 +48,6 @@ public class LoginViewModel extends ViewModel {
}
isUserExistUseCase.execute(currentLogin, status -> {
if (status.getValue() == null || status.getErrors() != null) {
Log.e("errors", status.getErrors().getLocalizedMessage());
mutableErrorLiveData.postValue("Something went wrong. Try again later");
return;
}

View File

@ -74,10 +74,8 @@ public class UserFragment extends Fragment {
}
});
binding.scan.setOnClickListener(v -> {
Navigation.findNavController(getView()).navigate(
R.id.action_userFragment_to_qrScanFragment);
});
binding.scan.setOnClickListener(v -> Navigation.findNavController(getView()).navigate(
R.id.action_userFragment_to_qrScanFragment));
binding.logout.setOnClickListener(v -> {
if (getContext() != null) {

View File

@ -1,7 +1,5 @@
package ru.myitschool.work.ui.profile;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
@ -9,7 +7,6 @@ import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import ru.myitschool.work.data.UserRepositoryImplementation;
import ru.myitschool.work.domain.entities.Status;
import ru.myitschool.work.domain.entities.UserEntity;
import ru.myitschool.work.domain.user.GetUserByLoginUseCase;

View File

@ -3,9 +3,7 @@ package ru.myitschool.work.ui.qr.result;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

View File

@ -20,9 +20,7 @@ public class QrResultViewModel extends ViewModel {
);
public void update(@NonNull String login, @NonNull String qr) {
pushQrUseCase.execute(new QrEntity(login, qr), status -> {
mutableStateLiveData.postValue(fromStatus(status));
});
pushQrUseCase.execute(new QrEntity(login, qr), status -> mutableStateLiveData.postValue(fromStatus(status)));
}
private State fromStatus(Status<Boolean> status) {

View File

@ -3,7 +3,6 @@ package ru.myitschool.work.utils;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.view.View;
public class Utils {