Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
371aef11f2
82
.kotlin/errors/errors-1740048772972.log
Normal file
82
.kotlin/errors/errors-1740048772972.log
Normal file
@ -0,0 +1,82 @@
|
||||
kotlin version: 2.0.21
|
||||
error message: Daemon compilation failed: null
|
||||
java.lang.Exception
|
||||
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)
|
||||
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:240)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:159)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:111)
|
||||
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
|
||||
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
|
||||
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
|
||||
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
|
||||
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
|
||||
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
|
||||
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
|
||||
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
|
||||
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:174)
|
||||
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:195)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:128)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:170)
|
||||
at org.gradle.internal.Factories$1.create(Factories.java:31)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:267)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:131)
|
||||
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:136)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:165)
|
||||
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:134)
|
||||
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
|
||||
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
|
||||
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
|
||||
at java.base/java.lang.Thread.run(Unknown Source)
|
||||
Caused by: java.nio.file.DirectoryNotEmptyException: C:\Users\User\AppData\Local\Temp\kotlin-backups7383909767525510423
|
||||
at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
|
||||
at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
|
||||
at java.base/java.nio.file.Files.delete(Unknown Source)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction$cleanupStash$2$1$1.invoke(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction$cleanupStash$2$1$1.invoke(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.cleanupStash$lambda$11$lambda$10$lambda$9(CompilationTransaction.kt:244)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
|
||||
at java.base/java.util.ArrayList.forEach(Unknown Source)
|
||||
at java.base/java.util.stream.SortedOps$RefSortingSink.end(Unknown Source)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
|
||||
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
|
||||
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.cleanupStash(CompilationTransaction.kt:244)
|
||||
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.close(CompilationTransaction.kt:254)
|
||||
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.tryCompileIncrementally(IncrementalCompilerRunner.kt:747)
|
||||
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:120)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:675)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1660)
|
||||
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
|
||||
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
|
||||
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
|
||||
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
|
||||
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
|
||||
... 3 more
|
||||
|
||||
|
@ -62,13 +62,13 @@ public class UserRepositoryImpl implements UserRepository, SignUserRepository {
|
||||
historiesDto -> {
|
||||
ArrayList<HistoryEntity> result1 = new ArrayList<>(historiesDto.size());
|
||||
for (HistoryDto history : historiesDto) {
|
||||
final Integer id1 = history.id;
|
||||
final Long id1 = history.id;
|
||||
final String username1 = history.username;
|
||||
final Long time = history.time;
|
||||
final String time = history.time;
|
||||
final String type = history.type;
|
||||
final Integer code = history.code;
|
||||
final Long code = history.code;
|
||||
if (username1 != null && id1 != null){
|
||||
result1.add(new HistoryEntity(id1, username1, time, type, code));
|
||||
result1.add(new HistoryEntity(id1, username1, type, time, code));
|
||||
}
|
||||
}
|
||||
return result1;
|
||||
@ -111,13 +111,14 @@ public class UserRepositoryImpl implements UserRepository, SignUserRepository {
|
||||
callback,
|
||||
user -> {
|
||||
if (user != null) {
|
||||
final Integer id1 = user.id;
|
||||
final String username1 = user.username;
|
||||
final String name = user.name;
|
||||
final String photo = user.photo;
|
||||
final Long lastVisit = user.lastVisit;
|
||||
final Integer idUser = user.idUser;
|
||||
final String position = user.position;
|
||||
if (idUser != null && username != null){
|
||||
return new UserEntity(username1, photo, lastVisit, idUser, position);
|
||||
final String authority = user.authority;
|
||||
if (id1 != null && username != null){
|
||||
return new UserEntity(id1, username1, name, photo, position, authority);
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
|
@ -7,7 +7,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
public class HistoryDto {
|
||||
@Nullable
|
||||
@SerializedName("id")
|
||||
public Integer id;
|
||||
public Long id;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("username")
|
||||
@ -15,7 +15,7 @@ public class HistoryDto {
|
||||
|
||||
@Nullable
|
||||
@SerializedName("time")
|
||||
public Long time;
|
||||
public String time;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("type")
|
||||
@ -23,6 +23,6 @@ public class HistoryDto {
|
||||
|
||||
@Nullable
|
||||
@SerializedName("code")
|
||||
public Integer code;
|
||||
public Long code;
|
||||
|
||||
}
|
||||
|
@ -5,35 +5,32 @@ import androidx.annotation.Nullable;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class UserDto {
|
||||
|
||||
@Nullable
|
||||
@SerializedName("id")
|
||||
public Integer id;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("username")
|
||||
public String username;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("password")
|
||||
public String password;
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("photo")
|
||||
public String photo;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("lastVisit")
|
||||
public Long lastVisit;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("idUser")
|
||||
public Integer idUser;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("status")
|
||||
public int status;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("position")
|
||||
public String position;
|
||||
|
||||
public UserDto(@Nullable String username, @Nullable String password, @Nullable String photo, @Nullable Long lastVisit, @Nullable Integer idUser, int status, @Nullable String position) {
|
||||
@Nullable
|
||||
@SerializedName("authority")
|
||||
public String authority;
|
||||
|
||||
/*public UserDto(@Nullable String username, @Nullable String password, @Nullable String photo, @Nullable Long lastVisit, @Nullable Integer idUser, int status, @Nullable String position) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.photo = photo;
|
||||
|
@ -15,14 +15,14 @@ import ru.myitschool.work.ui.History;
|
||||
public interface UserApi {
|
||||
@GET("api/user")
|
||||
Call<List<UserDto>> getAllUsers();
|
||||
@GET("api/user/{id}")
|
||||
@GET("api/user/{id}")
|
||||
Call<UserDto> getUserByUsername(@Path("username") String Username);
|
||||
@GET("api/user/username/{username}")
|
||||
Call<UserDto> isExistUser(@Path("username") String username);
|
||||
@GET("api/user/login")
|
||||
@GET("api/{username}/auth")
|
||||
Call<Void> isExistUser(@Path("username") String username);
|
||||
@GET("api/login")
|
||||
Call<Void> login();
|
||||
@GET("api/history/user/{id}")
|
||||
Call<List<HistoryDto>> getAllUserHistory(@Path("id") String username);
|
||||
@GET("api/{username}/passing")
|
||||
Call<List<HistoryDto>> getAllUserHistory(@Path("username") String username);
|
||||
/* @GET("api/history/{id}")
|
||||
Call<HistoryDto> getHistoryById(@Path("id") Integer id);
|
||||
*/
|
||||
|
@ -0,0 +1,22 @@
|
||||
package ru.myitschool.work.domain;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import ru.myitschool.work.domain.entities.HistoryEntity;
|
||||
import ru.myitschool.work.domain.entities.Status;
|
||||
import ru.myitschool.work.domain.entities.UserEntity;
|
||||
|
||||
public interface UserRepository {
|
||||
//void getAllUsers(@NonNull Consumer<Status<List<UserEntity>>> callback);
|
||||
|
||||
//void getUser(@NonNull Integer id, @NonNull Consumer<Status<UserEntity>> callback);
|
||||
void getAllUserHistory(@NonNull String username, @NonNull Consumer<Status<List<HistoryEntity>>> callback);
|
||||
//void getVolunteerCenterById(@NonNull Integer id, @NonNull Consumer<Status<HistoryEntity>> callback);
|
||||
//void isExist(@NonNull String username, @NonNull Consumer<Status<Void>> callback);
|
||||
//void register(@NonNull String id, @NonNull Consumer<Status<FullUserEntity>> callback);
|
||||
|
||||
// void login(@NonNull String username, @NonNull String password, @NonNull Consumer<Status<Void>> callback);
|
||||
}
|
@ -7,14 +7,14 @@ import com.google.gson.annotations.SerializedName;
|
||||
public class HistoryEntity {
|
||||
@Nullable
|
||||
@SerializedName("id")
|
||||
public Integer id;
|
||||
public Long id;
|
||||
|
||||
@Nullable
|
||||
public Integer getId() {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(@Nullable Integer id) {
|
||||
public void setId(@Nullable Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -28,11 +28,11 @@ public class HistoryEntity {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getTime() {
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(@Nullable Long time) {
|
||||
public void setTime(@Nullable String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@ -46,19 +46,19 @@ public class HistoryEntity {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getCode() {
|
||||
public Long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(@Nullable Integer code) {
|
||||
public void setCode(@Nullable Long code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public HistoryEntity(@Nullable Integer id, @Nullable String username, @Nullable Long time, @Nullable String type, @Nullable Integer code) {
|
||||
public HistoryEntity(@Nullable Long id, @Nullable String username, @Nullable String type, @Nullable String time, @Nullable Long code) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.time = time;
|
||||
this.type = type;
|
||||
this.time = time;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class HistoryEntity {
|
||||
|
||||
@Nullable
|
||||
@SerializedName("time")
|
||||
public Long time;
|
||||
public String time;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("type")
|
||||
@ -76,6 +76,6 @@ public class HistoryEntity {
|
||||
|
||||
@Nullable
|
||||
@SerializedName("code")
|
||||
public Integer code;
|
||||
public Long code;
|
||||
|
||||
}
|
||||
|
@ -15,32 +15,37 @@ public class UserEntity {
|
||||
public String username;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("photo")
|
||||
public String photo;
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("lastVisit")
|
||||
public Long lastVisit;
|
||||
@SerializedName("photo")
|
||||
public String photo;
|
||||
|
||||
@Nullable
|
||||
@SerializedName("position")
|
||||
public String position;
|
||||
|
||||
public UserEntity(@Nullable String username, @Nullable String photo, @Nullable Long lastVisit, @Nullable Integer id, @Nullable String position) {
|
||||
this.username = username;
|
||||
this.photo = photo;
|
||||
this.lastVisit = lastVisit;
|
||||
@Nullable
|
||||
@SerializedName("authority")
|
||||
public String authority;
|
||||
|
||||
public UserEntity(@Nullable Integer id, @Nullable String username, @Nullable String name, @Nullable String photo, @Nullable String position, @Nullable String authority) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.name = name;
|
||||
this.photo = photo;
|
||||
this.position = position;
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPosition() {
|
||||
return position;
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setPosition(@Nullable String position) {
|
||||
this.position = position;
|
||||
public void setId(@Nullable Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -52,6 +57,15 @@ public class UserEntity {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(@Nullable String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPhoto() {
|
||||
return photo;
|
||||
@ -62,21 +76,20 @@ public class UserEntity {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getLastVisit() {
|
||||
return lastVisit;
|
||||
public String getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setLastVisit(@Nullable Long lastVisit) {
|
||||
this.lastVisit = lastVisit;
|
||||
public void setPosition(@Nullable String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getId() {
|
||||
return id;
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
||||
public void setId(@Nullable Integer id) {
|
||||
this.id = id;
|
||||
public void setAuthority(@Nullable String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import ru.myitschool.work.domain.entities.Status;
|
||||
public interface SignUserRepository {
|
||||
|
||||
void getUserByUsername(@NonNull String username, Consumer<Status<UserEntity>> callback);
|
||||
void isExistUser(@NonNull String login, Consumer<Status<Void>> callback);
|
||||
void isExistUser(@NonNull String username, Consumer<Status<Void>> callback);
|
||||
|
||||
void login(
|
||||
@NonNull String username,
|
||||
|
@ -4,15 +4,22 @@ import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import ru.myitschool.work.R;
|
||||
import ru.myitschool.work.databinding.ActivityRootBinding;
|
||||
import ru.myitschool.work.databinding.FragmentProfileBinding;
|
||||
import ru.myitschool.work.domain.entities.UserEntity;
|
||||
import ru.myitschool.work.ui.profile.ProfileViewModel;
|
||||
import ru.myitschool.work.utils.PreferenceManager;
|
||||
|
||||
public class RootActivity extends AppCompatActivity {
|
||||
private ActivityRootBinding binding;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -30,6 +37,7 @@ public class RootActivity extends AppCompatActivity {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void onClickNavHistory() {
|
||||
|
@ -1,4 +1,62 @@
|
||||
package ru.myitschool.work.ui.admin;
|
||||
|
||||
public class AdminFragment {
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import ru.myitschool.work.R;
|
||||
import ru.myitschool.work.databinding.FragmentAdminBinding;
|
||||
import ru.myitschool.work.databinding.FragmentProfileBinding;
|
||||
import ru.myitschool.work.domain.GetUserByUsernameUseCase;
|
||||
import ru.myitschool.work.domain.entities.UserEntity;
|
||||
import ru.myitschool.work.ui.profile.ProfileViewModel;
|
||||
import ru.myitschool.work.utils.Constants;
|
||||
import ru.myitschool.work.utils.PreferenceManager;
|
||||
|
||||
public class AdminFragment extends Fragment {
|
||||
private static final String KEY_USER_USERNAME = "username";
|
||||
|
||||
private FragmentAdminBinding binding;
|
||||
private PreferenceManager preferenceManager;
|
||||
private AdminViewModel viewModel;
|
||||
|
||||
public AdminFragment() {
|
||||
super(R.layout.fragment_admin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
binding = FragmentAdminBinding.bind(view);
|
||||
preferenceManager = new PreferenceManager(this.getContext());
|
||||
viewModel = new ViewModelProvider(this).get(AdminViewModel.class);
|
||||
binding.searchButton.setOnClickListener(view1 -> {
|
||||
String usernameSearch = binding.search.getText().toString();
|
||||
// TODO : к базе
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
binding = null;
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
public static Bundle getBundle(@NonNull String id) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(KEY_USER_USERNAME, id);
|
||||
return bundle;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,91 @@
|
||||
package ru.myitschool.work.ui.admin;
|
||||
|
||||
public class AdminViewModel {
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ru.myitschool.work.data.UserRepositoryImpl;
|
||||
import ru.myitschool.work.domain.GetAllUserHistoryUseCase;
|
||||
import ru.myitschool.work.domain.GetUserByUsernameUseCase;
|
||||
import ru.myitschool.work.domain.entities.HistoryEntity;
|
||||
import ru.myitschool.work.domain.entities.Status;
|
||||
import ru.myitschool.work.domain.sign.IsUserExistUseCase;
|
||||
import ru.myitschool.work.ui.information.InformationViewModel;
|
||||
import ru.myitschool.work.ui.profile.ProfileViewModel;
|
||||
|
||||
public class AdminViewModel extends ViewModel {
|
||||
private final MutableLiveData<AdminViewModel.State> mutableStateLiveData = new MutableLiveData<>();
|
||||
|
||||
public final LiveData<AdminViewModel.State> stateLiveData = mutableStateLiveData;
|
||||
|
||||
public final GetUserByUsernameUseCase getUserByUsernameUseCase = new GetUserByUsernameUseCase(
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
|
||||
public final GetAllUserHistoryUseCase getAllUserHistoryListUseCase = new GetAllUserHistoryUseCase(
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
private final IsUserExistUseCase isUserExistUseCase = new IsUserExistUseCase(
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
|
||||
public void load(@NonNull String username) {
|
||||
mutableStateLiveData.setValue(new AdminViewModel.State(null, null, true));
|
||||
postUserByUsername(username);
|
||||
}
|
||||
|
||||
private void postUserByUsername(String username) {
|
||||
final String currentUsername = username;
|
||||
if (currentUsername == null || currentUsername.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
isUserExistUseCase.execute(currentUsername, status -> {
|
||||
if (status.getValue() == null || status.getErrors() != null) {
|
||||
Log.d("tagg", status.getErrors().toString());
|
||||
}
|
||||
|
||||
});
|
||||
getUserByUsernameUseCase.execute(currentUsername, status ->{
|
||||
if (status.getValue() == null || status.getErrors() != null) {
|
||||
Log.d("tagg", status.getErrors().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public class State {
|
||||
@Nullable
|
||||
private final String errorMessage;
|
||||
|
||||
@Nullable
|
||||
private final List<HistoryEntity> itemsHistory;
|
||||
|
||||
private final boolean isLoading;
|
||||
|
||||
public State(@Nullable String errorMessage, @Nullable List<HistoryEntity> itemsHistory, boolean isLoading) {
|
||||
this.errorMessage = errorMessage;
|
||||
this.itemsHistory = itemsHistory;
|
||||
this.isLoading = isLoading;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<HistoryEntity> getItemsHistory() {
|
||||
return itemsHistory;
|
||||
}
|
||||
|
||||
public boolean isLoading() {
|
||||
return isLoading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,12 @@ public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.ViewHold
|
||||
}
|
||||
|
||||
public void bind(HistoryEntity item) {
|
||||
binding.time.setText(item.getTime().toString().substring(0, 10) + " "
|
||||
+ item.getTime().toString().substring(11, 16));
|
||||
binding.nameReader.setText(item.getType());
|
||||
//binding.time.setText(item.getTime().toString().substring(0, 10) + " "
|
||||
//+ item.getTime().toString().substring(11, 16));
|
||||
//binding.nameReader.setText(item.getType());
|
||||
binding.time.setText(item.getTime());
|
||||
binding.code.setText(item.getCode().toString());
|
||||
binding.type.setText(item.getType());
|
||||
/*if (item.getType() == 1){
|
||||
binding.type.setText("QR-code");
|
||||
}
|
||||
|
@ -59,12 +59,13 @@ public class InformationFragment extends Fragment {
|
||||
//sharedPreferences = getContext().getSharedPreferences(getString(R.string.app_name), Context.MODE_PRIVATE);
|
||||
preferenceManager = new PreferenceManager(this.getContext());
|
||||
username = preferenceManager.getString(Constants.KEY_USER_USERNAME);
|
||||
Toast.makeText(getContext(), username, Toast.LENGTH_SHORT).show();
|
||||
viewModel = new ViewModelProvider(this).get(InformationViewModel.class);
|
||||
//getInformation();
|
||||
|
||||
binding.scan.setOnClickListener(view1 -> {
|
||||
onClickScan(view);
|
||||
});
|
||||
// binding.scan.setOnClickListener(view1 -> {
|
||||
// onClickScan(view);
|
||||
// });
|
||||
|
||||
binding.logout.setOnClickListener(view2 -> {
|
||||
onClickLogout(view);
|
||||
@ -120,8 +121,9 @@ public class InformationFragment extends Fragment {
|
||||
|
||||
|
||||
|
||||
binding.loading.setVisibility(Utils.visibleOrGone(loadingHistory));
|
||||
//binding.loading.setVisibility(Utils.visibleOrGone(loadingHistory));
|
||||
if (state.isLoading() == false) {
|
||||
binding.refreshLayout.setRefreshing(false);
|
||||
if (state.getItemsHistory() != null) {
|
||||
history = state.getItemsHistory();
|
||||
|
||||
@ -138,12 +140,12 @@ public class InformationFragment extends Fragment {
|
||||
historyAdapter.updateData(history);
|
||||
historyAdapter.notifyDataSetChanged();
|
||||
binding.refreshLayout.setRefreshing(false);
|
||||
} else {
|
||||
Toast.makeText(this.getContext(), "Error", Toast.LENGTH_SHORT).show();
|
||||
takeError();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this.getContext(), "Error", Toast.LENGTH_SHORT).show();
|
||||
takeError();
|
||||
}
|
||||
binding.refreshLayout.setRefreshing(false);
|
||||
//binding.refreshLayout.setRefreshing(false);
|
||||
});
|
||||
/*
|
||||
viewModel.stateHistoryLiveData.observe(getViewLifecycleOwner(), state -> {
|
||||
@ -250,7 +252,7 @@ public class InformationFragment extends Fragment {
|
||||
binding.lastEntry.setVisibility(View.GONE);
|
||||
binding.position.setVisibility(View.GONE);
|
||||
//binding.logout.setVisibility(View.GONE);
|
||||
binding.scan.setVisibility(View.GONE);
|
||||
//binding.scan.setVisibility(View.GONE);
|
||||
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
binding.refreshLayout.setRefreshing(false);
|
||||
|
@ -28,18 +28,17 @@ public class InformationViewModel extends ViewModel {
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
|
||||
/*public ListViewModel() {
|
||||
update();
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
public void changeSelectedUsername(@NonNull String username) {
|
||||
this.username = this.username;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
mutableStateAllUserHistoryLiveData.setValue(new InformationViewModel.State(null, null, false));
|
||||
mutableStateAllUserHistoryLiveData.setValue(new InformationViewModel.State(null, null, true));
|
||||
getHistById();
|
||||
/*getAllUserHistoryUseCase.execute(username, status -> {
|
||||
mutableStateHistoryLiveData.postValue(fromStatus(status));
|
||||
|
@ -23,10 +23,10 @@ import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import ru.myitschool.work.R;
|
||||
import ru.myitschool.work.core.Constants;
|
||||
import ru.myitschool.work.databinding.FragmentLoginBinding;
|
||||
import ru.myitschool.work.ui.StoreAPI;
|
||||
import ru.myitschool.work.ui.login.LoginViewModel;
|
||||
import ru.myitschool.work.utils.Constants;
|
||||
import ru.myitschool.work.utils.OnChangeText;
|
||||
import ru.myitschool.work.utils.PreferenceManager;
|
||||
|
||||
@ -47,10 +47,9 @@ public class LoginFragment extends Fragment {
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
//binding.log.setText("created");
|
||||
preferenceManager = new PreferenceManager(this.getContext());
|
||||
viewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
||||
//sharedPreferences.edit().putString(ru.myitschool.work.ui.Constants.KEY_LOGIN, "5user").apply();
|
||||
|
||||
binding.login.setEnabled(false);
|
||||
|
||||
binding.username.addTextChangedListener(new OnChangeText() {
|
||||
@ -58,7 +57,7 @@ public class LoginFragment extends Fragment {
|
||||
public void afterTextChanged(Editable s) {
|
||||
super.afterTextChanged(s);
|
||||
viewModel.changeUsername(s.toString());
|
||||
if (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);
|
||||
} else {
|
||||
binding.login.setEnabled(false);
|
||||
@ -69,32 +68,7 @@ public class LoginFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
binding.username.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (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.log.setText("changed true");
|
||||
} else {
|
||||
binding.login.setEnabled(false);
|
||||
//binding.log.setText("changed false");
|
||||
}
|
||||
//Log.d("tagg", "changed");
|
||||
if (binding.error.getVisibility() == View.VISIBLE) {
|
||||
binding.error.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
binding.password.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
@ -104,7 +78,7 @@ public class LoginFragment extends Fragment {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
viewModel.changePassword(charSequence.toString());
|
||||
if (binding.password.getText().length() >= 5) {
|
||||
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);
|
||||
} else {
|
||||
binding.login.setEnabled(false);
|
||||
@ -122,70 +96,25 @@ public class LoginFragment extends Fragment {
|
||||
|
||||
binding.login.setOnClickListener(view1 -> {
|
||||
viewModel.confirm();
|
||||
/*if (binding.login.isEnabled()) {
|
||||
if (binding.error.getVisibility() == View.VISIBLE) {
|
||||
binding.error.setVisibility(View.GONE);
|
||||
//binding.log.setText("click enabled");
|
||||
}
|
||||
//binding.log.setText("click");
|
||||
onClickLogin(view);
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
subscribe(viewModel);
|
||||
}
|
||||
|
||||
private void onClickLogin(View view) {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(Constants.SERVER_ADDRESS)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
|
||||
StoreAPI storeApi = retrofit.create(StoreAPI.class);
|
||||
|
||||
String login = binding.username.getText().toString();
|
||||
|
||||
Call<Boolean> call = storeApi.authenticateUser(login);
|
||||
call.enqueue(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onResponse(Call<Boolean> call, Response<Boolean> response) {
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null && response.body()) {
|
||||
preferenceManager.putString(ru.myitschool.work.utils.Constants.KEY_LOGIN, binding.username.getText().toString());
|
||||
Navigation.findNavController(view).navigate(R.id.action_loginFragment_to_informationFragment);
|
||||
//getFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new InformationFragment()).commit();
|
||||
} else {
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (response.code() == 401) {
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
} else if (response.code() == 400) {
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Boolean> call, Throwable t) {
|
||||
binding.error.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void subscribe(LoginViewModel viewModel) {
|
||||
viewModel.errorLiveData.observe(getViewLifecycleOwner(), error -> {
|
||||
Toast.makeText(getContext(), error, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
/*viewModel.stateLiveData.observe(getViewLifecycleOwner(), state -> {
|
||||
binding.confirm.setText(state.getButton());
|
||||
binding.title.setText(state.getTitle());
|
||||
binding.password.setVisibility(Utils.visibleOrGone(state.isPasswordEnabled()));
|
||||
});*/
|
||||
|
||||
viewModel.openListLiveData.observe(getViewLifecycleOwner(), username -> {
|
||||
final View view = getView();
|
||||
Toast.makeText(getContext(), "FFFFFFFFF", Toast.LENGTH_SHORT).show();
|
||||
if (view == null) return;
|
||||
preferenceManager.putString(ru.myitschool.work.utils.Constants.KEY_USER_USERNAME, username);
|
||||
preferenceManager.putString(Constants.KEY_USER_USERNAME, username);
|
||||
preferenceManager.putString(Constants.KEY_USER_ROLE, username);
|
||||
view.getRootView().findViewById(R.id.nav_view).setVisibility(View.VISIBLE);
|
||||
Navigation.findNavController(view).navigate(R.id.action_loginFragment_to_informationFragment);
|
||||
});
|
||||
|
@ -59,11 +59,12 @@ public class LoginViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
public void confirm() {
|
||||
if (userCheckCompleted) {
|
||||
loginUser(username, password);
|
||||
/*if (userCheckCompleted) {
|
||||
checkAuth();
|
||||
} else {
|
||||
checkUserExist();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@ -72,14 +73,17 @@ public class LoginViewModel extends ViewModel {
|
||||
final String currentPassword = password;
|
||||
if (currentPassword == null || currentPassword.isEmpty()) {
|
||||
mutableErrorLiveData.postValue("Password cannot be null");
|
||||
userCheckCompleted = false;
|
||||
return;
|
||||
}
|
||||
if (currentUsername == null || currentUsername.isEmpty()) {
|
||||
mutableErrorLiveData.postValue("Login cannot be null");
|
||||
userCheckCompleted = false;
|
||||
return;
|
||||
}
|
||||
if (!isAccountExist) {
|
||||
mutableErrorLiveData.postValue("This user not exist");
|
||||
userCheckCompleted = false;
|
||||
return;
|
||||
/*createUserUseCase.execute(currentUsername, currentPassword, status -> {
|
||||
if (status.getStatusCode() == 201 && status.getErrors() == null) {
|
||||
@ -101,6 +105,7 @@ public class LoginViewModel extends ViewModel {
|
||||
mutableOpenListLiveData.postValue(currentUsername);
|
||||
} else {
|
||||
mutableErrorLiveData.postValue("Something wrong");
|
||||
userCheckCompleted = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -109,12 +114,14 @@ public class LoginViewModel extends ViewModel {
|
||||
final String currentUsername = username;
|
||||
if (currentUsername == null || currentUsername.isEmpty()) {
|
||||
mutableErrorLiveData.postValue("Login cannot be null");
|
||||
userCheckCompleted = false;
|
||||
return;
|
||||
}
|
||||
isUserExistUseCase.execute(currentUsername, status -> {
|
||||
if (status.getErrors() != null) {
|
||||
//Log.d("tagg", status.getErrors().toString());
|
||||
mutableErrorLiveData.postValue("Something wrong. Try later =(" + status.getErrors());
|
||||
userCheckCompleted = false;
|
||||
return;
|
||||
}
|
||||
userCheckCompleted = true;
|
||||
|
@ -40,7 +40,7 @@ public class ProfileFragment extends Fragment {
|
||||
|
||||
binding.username.setText(userEntity.getUsername());
|
||||
binding.position.setText(userEntity.getPosition());
|
||||
binding.lastTime.setText(userEntity.getLastVisit().toString());
|
||||
binding.lastTime.setText(userEntity.getName());
|
||||
|
||||
});
|
||||
|
||||
|
@ -24,9 +24,9 @@ public class ProfileViewModel extends ViewModel {
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
|
||||
public final GetAllUserHistoryUseCase getAllUserHistoryListUseCase = new GetAllUserHistoryUseCase(
|
||||
/*public final GetAllUserHistoryUseCase getAllUserHistoryListUseCase = new GetAllUserHistoryUseCase(
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
);*/
|
||||
private final IsUserExistUseCase isUserExistUseCase = new IsUserExistUseCase(
|
||||
UserRepositoryImpl.getInstance()
|
||||
);
|
||||
@ -47,6 +47,7 @@ public class ProfileViewModel extends ViewModel {
|
||||
//mutableErrorLiveData.postValue("Something wrong. Try later =(" + status.getErrors());
|
||||
return;
|
||||
}
|
||||
|
||||
//userCheckCompleted = true;
|
||||
/*if (status.getStatusCode() == 200) {
|
||||
if (status.getValue() != null) {
|
||||
|
@ -3,6 +3,8 @@ package ru.myitschool.work.utils;
|
||||
public class Constants {
|
||||
public static final String KEY_PREFERENCE_NAME = "App";
|
||||
public static final String KEY_USER_USERNAME = "userUsername";
|
||||
public static final String KEY_USER_ROLE = "userRole";
|
||||
public static final String KEY_USER_BLOCKED = "userBlocked";
|
||||
public static String KEY_LOGIN = "login";
|
||||
public static String KEY_RESULT = "result";
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
|
||||
<!-- -->
|
||||
</vector>
|
||||
|
@ -24,5 +24,20 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:menu="@menu/bottom_nav_menu"
|
||||
app:labelVisibilityMode="labeled"
|
||||
android:animateLayoutChanges="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/qr_scan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/baseline_qr_code_scanner_24"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:visibility="gone"
|
||||
android:layout_margin="24dp"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -51,50 +52,36 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/refresh"
|
||||
android:text="@string/refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/logout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/scan"
|
||||
android:text="@string/scan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/refresh"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error"
|
||||
android:visibility="gone"
|
||||
android:text="@string/error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/scan"
|
||||
app:layout_constraintTop_toBottomOf="@id/logout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/historylist"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/error"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:id="@+id/historylist"
|
||||
tools:listitem="@layout/item_history"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@id/error"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -1,39 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:tag="iuroi"/>
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameReader"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="iuroxsssssi"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_code"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="kijt"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/time"
|
||||
app:layout_constraintStart_toEndOf="@id/time"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_time">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/type"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/code"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="iuroxsssssi"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="hgfdfbjdhf"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/time"
|
||||
app:layout_constraintStart_toEndOf="@id/nameReader"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_code">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/type"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="iuroxsssssi"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -12,4 +12,8 @@
|
||||
<string name="cancelled">Operation was cancelled</string>
|
||||
<string name="success">Success</string>
|
||||
<string name="wrong">Something wrong</string>
|
||||
|
||||
<string name="time">Time:</string>
|
||||
<string name="type">Enter type:</string>
|
||||
<string name="code">Identificator:</string>
|
||||
</resources>
|
@ -12,4 +12,7 @@
|
||||
<string name="cancelled">Вход был отменён</string>
|
||||
<string name="success">Успешно</string>
|
||||
<string name="wrong">Что-то пошло не так</string>
|
||||
<string name="time">Время:</string>
|
||||
<string name="type">Тип прохода:</string>
|
||||
<string name="code">Идентификатор:</string>
|
||||
</resources>
|
@ -12,4 +12,8 @@
|
||||
<string name="cancelled">Вход был отменён</string>
|
||||
<string name="success">Успешно</string>
|
||||
<string name="wrong">Что-то пошло не так</string>
|
||||
|
||||
<string name="time">Время:</string>
|
||||
<string name="type">Тип прохода:</string>
|
||||
<string name="code">Идентификатор:</string>
|
||||
</resources>
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="close_button">Close</string>
|
||||
<string name="close_button" translatable="false">Close</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user