Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
fdd274011e | |||
eaf36da2f0 | |||
5ff7aa29ac | |||
64bf956730 | |||
1620228061 |
@ -0,0 +1,38 @@
|
||||
package ru.myitschool.work.ui.createemployee;
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import ru.myitschool.work.R;
|
||||
|
||||
public class CreateUserFragment extends Fragment {
|
||||
|
||||
private CreateUserViewModel mViewModel;
|
||||
|
||||
public static CreateUserFragment newInstance() {
|
||||
return new CreateUserFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_create_user, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mViewModel = new ViewModelProvider(this).get(CreateUserViewModel.class);
|
||||
// TODO: Use the ViewModel
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package ru.myitschool.work.ui.createemployee;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class CreateUserViewModel extends ViewModel {
|
||||
// TODO: Implement the ViewModel
|
||||
}
|
@ -43,7 +43,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
|
||||
binding = ActivityLoginBinding.bind(v);
|
||||
viewModel = new ViewModelProvider(this).get(ActivityLoginBinding.class);
|
||||
viewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
||||
|
||||
binding.email.addTextChangedListener(new TextChangedListener<>(binding.email) {
|
||||
@Override
|
||||
@ -59,21 +59,21 @@ public class LoginActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
binding.btEnter.setOnClickListener(this.onClickListenerLoginButton);
|
||||
binding.btEnter.setOnClickListener(this::onClickListenerLoginButton);
|
||||
|
||||
subscribe();
|
||||
});
|
||||
}
|
||||
|
||||
private void subscribe() {
|
||||
viewModel.errorLiveData.observe(getViewLifecycleOwner(), error -> {
|
||||
viewModel.errorLiveData.observe(this, error -> {
|
||||
binding.btEnter.setEnabled(true);
|
||||
Snackbar.make(requireView(), error, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(findViewById(android.R.id.content), error, Snackbar.LENGTH_LONG).show();
|
||||
});
|
||||
viewModel.openLiveData.observe(getViewLifecycleOwner(), employee -> {
|
||||
viewModel.openLiveData.observe(this, employee -> {
|
||||
binding.btEnter.setEnabled(true);
|
||||
|
||||
SharedPreferences settings = requireView().getContext().getSharedPreferences(
|
||||
SharedPreferences settings = this.getSharedPreferences(
|
||||
SettingConstants.PREFS_FILE, Context.MODE_PRIVATE
|
||||
);
|
||||
settings.edit().putLong(SettingConstants.PREF_ID, employee.getId()).apply();
|
||||
|
@ -4,12 +4,13 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import ru.myitschool.work.api.data.SignRepositoryImpl;
|
||||
import ru.myitschool.work.api.domain.entity.employee.EmpolyeeEntity;
|
||||
import ru.myitschool.work.api.domain.useCases.sign.LoginEmployeeUseCase;
|
||||
|
||||
public class LoginViewModel {
|
||||
public class LoginViewModel extends ViewModel {
|
||||
private final MutableLiveData<String> mutableErrorLiveData = new MutableLiveData<>();
|
||||
public final LiveData<String> errorLiveData = mutableErrorLiveData;
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
package ru.myitschool.work.ui.main;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import ru.myitschool.work.R;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_main);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
}
|
||||
}
|
76
app/src/main/java/ru/myitschool/work/ui/main/MainActivity.kt
Normal file
76
app/src/main/java/ru/myitschool/work/ui/main/MainActivity.kt
Normal file
@ -0,0 +1,76 @@
|
||||
package ru.myitschool.work.ui.main
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.example.myapplication.core.RoleConstants
|
||||
import com.example.myapplication.core.SettingConstants
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import ru.myitschool.work.R
|
||||
import ru.myitschool.work.ui.createemployee.CreateUserFragment
|
||||
import ru.myitschool.work.ui.login.LoginActivity
|
||||
import ru.myitschool.work.ui.profile.ProfileFragment
|
||||
import ru.myitschool.work.ui.qr.scan.QrScanFragment
|
||||
import ru.myitschool.work.ui.userlist.CompanyInfoFragment
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var settings: SharedPreferences
|
||||
|
||||
private lateinit var bottomNavigationView: BottomNavigationView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_main)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
}
|
||||
|
||||
settings = getSharedPreferences(SettingConstants.PREFS_FILE, Context.MODE_PRIVATE)
|
||||
|
||||
if (settings.getLong(SettingConstants.PREF_ID, SettingConstants.ERROR_ID) == SettingConstants.ERROR_ID) {
|
||||
Log.d("Test", "(MainActivity) Пользователь не зарегистрирован, запускаем регистрацию.")
|
||||
startActivity(Intent(this, LoginActivity::class.java))
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.teal_200)
|
||||
|
||||
bottomNavigationView = findViewById(R.id.bottom_navigation_view)
|
||||
|
||||
if (settings.getString(SettingConstants.PREF_ROLE, SettingConstants.DEF_VALUE) == RoleConstants.ROLE_USER) {
|
||||
val menuItem = bottomNavigationView.menu.getItem(1);
|
||||
menuItem.setVisible(false)
|
||||
}
|
||||
|
||||
bottomNavigationView.setOnItemSelectedListener{ item ->
|
||||
// if (item.itemId == bottomNavigationView.selectedItemId) return@setOnItemSelectedListener false
|
||||
|
||||
when (item.itemId) {
|
||||
R.id.scaner -> replaceFragment(QrScanFragment())
|
||||
R.id.office -> replaceFragment(CompanyInfoFragment())
|
||||
R.id.createEmployee -> replaceFragment(CreateUserFragment())
|
||||
//R.id.employees -> replaceFragment(EmployeesListFragment())
|
||||
R.id.profile -> replaceFragment(ProfileFragment())
|
||||
}
|
||||
window.statusBarColor = ContextCompat.getColor(this, R.color.grey)
|
||||
|
||||
return@setOnItemSelectedListener true
|
||||
}
|
||||
}
|
||||
|
||||
private fun replaceFragment(fragment: Fragment) {
|
||||
supportFragmentManager.beginTransaction().replace(R.id.container, fragment).commit()
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ru.myitschool.work.ui.qr.scan
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
// НЕ ИЗМЕНЯЙТЕ ЭТОТ ФАЙЛ. В ТЕСТАХ ОН БУДЕМ ВОЗВРАЩЁН В ИСХОДНОЕ СОСТОЯНИЕ
|
||||
@Serializable
|
||||
data object QrScanDestination {
|
||||
const val REQUEST_KEY = "qr_result"
|
||||
private const val KEY_QR_DATA = "key_qr"
|
||||
|
||||
fun newInstance(): QrScanFragment {
|
||||
return QrScanFragment()
|
||||
}
|
||||
|
||||
fun getDataIfExist(bundle: Bundle): String? {
|
||||
return if (bundle.containsKey(KEY_QR_DATA)) {
|
||||
bundle.getString(KEY_QR_DATA)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
internal fun packToBundle(data: String): Bundle {
|
||||
return bundleOf(
|
||||
KEY_QR_DATA to data
|
||||
)
|
||||
}
|
||||
}
|
139
app/src/main/java/ru/myitschool/work/ui/scan/QrScanFragment.kt
Normal file
139
app/src/main/java/ru/myitschool/work/ui/scan/QrScanFragment.kt
Normal file
@ -0,0 +1,139 @@
|
||||
package ru.myitschool.work.ui.qr.scan
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
import androidx.camera.mlkit.vision.MlKitAnalyzer
|
||||
import androidx.camera.view.LifecycleCameraController
|
||||
import androidx.camera.view.PreviewView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.setFragmentResult
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.mlkit.vision.barcode.BarcodeScanner
|
||||
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
|
||||
import com.google.mlkit.vision.barcode.BarcodeScanning
|
||||
import com.google.mlkit.vision.barcode.common.Barcode
|
||||
import ru.myitschool.work.R
|
||||
import ru.myitschool.work.databinding.FragmentQrScanBinding
|
||||
import ru.myitschool.work.utils.collectWhenStarted
|
||||
import ru.myitschool.work.utils.visibleOrGone
|
||||
|
||||
// НЕ ИЗМЕНЯЙТЕ ЭТОТ ФАЙЛ. В ТЕСТАХ ОН БУДЕМ ВОЗВРАЩЁН В ИСХОДНОЕ СОСТОЯНИЕ
|
||||
class QrScanFragment : Fragment(R.layout.fragment_qr_scan) {
|
||||
private var _binding: FragmentQrScanBinding? = null
|
||||
private val binding: FragmentQrScanBinding get() = _binding!!
|
||||
|
||||
private var barcodeScanner: BarcodeScanner? = null
|
||||
private var isCameraInit: Boolean = false
|
||||
private val permissionLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.RequestPermission()
|
||||
) { isGranted -> viewModel.onPermissionResult(isGranted) }
|
||||
|
||||
private val viewModel: QrScanViewModel by viewModels()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentQrScanBinding.bind(view)
|
||||
sendResult(bundleOf())
|
||||
subscribe()
|
||||
initCallback()
|
||||
}
|
||||
|
||||
private fun initCallback() {
|
||||
binding.close.setOnClickListener { viewModel.close() }
|
||||
}
|
||||
|
||||
private fun subscribe() {
|
||||
viewModel.state.collectWhenStarted(this) { state ->
|
||||
binding.loading.visibleOrGone(state is QrScanViewModel.State.Loading)
|
||||
binding.viewFinder.visibleOrGone(state is QrScanViewModel.State.Scan)
|
||||
if (!isCameraInit && state is QrScanViewModel.State.Scan) {
|
||||
startCamera()
|
||||
isCameraInit = true
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.action.collectWhenStarted(this) { action ->
|
||||
when (action) {
|
||||
is QrScanViewModel.Action.RequestPermission -> requestPermission(action.permission)
|
||||
is QrScanViewModel.Action.CloseWithCancel -> {
|
||||
goBack()
|
||||
}
|
||||
is QrScanViewModel.Action.CloseWithResult -> {
|
||||
sendResult(QrScanDestination.packToBundle(action.result))
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestPermission(permission: String) {
|
||||
permissionLauncher.launch(permission)
|
||||
}
|
||||
|
||||
private fun startCamera() {
|
||||
val context = requireContext()
|
||||
val cameraController = LifecycleCameraController(context)
|
||||
val previewView: PreviewView = binding.viewFinder
|
||||
val executor = ContextCompat.getMainExecutor(context)
|
||||
|
||||
val options = BarcodeScannerOptions.Builder()
|
||||
.setBarcodeFormats(Barcode.FORMAT_QR_CODE)
|
||||
.build()
|
||||
val barcodeScanner = BarcodeScanning.getClient(options)
|
||||
this.barcodeScanner = barcodeScanner
|
||||
|
||||
cameraController.setImageAnalysisAnalyzer(
|
||||
executor,
|
||||
MlKitAnalyzer(
|
||||
listOf(barcodeScanner),
|
||||
ImageAnalysis.COORDINATE_SYSTEM_VIEW_REFERENCED,
|
||||
executor
|
||||
) { result ->
|
||||
result?.getValue(barcodeScanner)?.firstOrNull()?.let { value ->
|
||||
viewModel.findBarcode(value)
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
cameraController.bindToLifecycle(this)
|
||||
previewView.controller = cameraController
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
barcodeScanner?.close()
|
||||
barcodeScanner = null
|
||||
_binding = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun goBack() {
|
||||
findNavControllerOrNull()?.popBackStack()
|
||||
?: requireActivity().onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
private fun sendResult(bundle: Bundle) {
|
||||
setFragmentResult(
|
||||
QrScanDestination.REQUEST_KEY,
|
||||
bundle
|
||||
)
|
||||
findNavControllerOrNull()
|
||||
?.previousBackStackEntry
|
||||
?.savedStateHandle
|
||||
?.set(QrScanDestination.REQUEST_KEY, bundle)
|
||||
}
|
||||
|
||||
private fun findNavControllerOrNull(): NavController? {
|
||||
return try {
|
||||
findNavController()
|
||||
} catch (_: Throwable) {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package ru.myitschool.work.ui.qr.scan
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Application
|
||||
import android.content.pm.PackageManager
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.google.mlkit.vision.barcode.common.Barcode
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import ru.myitschool.work.utils.MutablePublishFlow
|
||||
|
||||
// НЕ ИЗМЕНЯЙТЕ ЭТОТ ФАЙЛ. В ТЕСТАХ ОН БУДЕМ ВОЗВРАЩЁН В ИСХОДНОЕ СОСТОЯНИЕ
|
||||
class QrScanViewModel(
|
||||
application: Application
|
||||
) : AndroidViewModel(application) {
|
||||
|
||||
private val _action = MutablePublishFlow<Action>()
|
||||
val action = _action.asSharedFlow()
|
||||
|
||||
private val _state = MutableStateFlow<State>(initialState)
|
||||
val state = _state.asStateFlow()
|
||||
|
||||
init {
|
||||
checkPermission()
|
||||
}
|
||||
|
||||
fun onPermissionResult(isGranted: Boolean) {
|
||||
viewModelScope.launch {
|
||||
if (isGranted) {
|
||||
_state.update { State.Scan }
|
||||
} else {
|
||||
_action.emit(Action.CloseWithCancel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkPermission() {
|
||||
viewModelScope.launch {
|
||||
val isPermissionGranted = ContextCompat.checkSelfPermission(
|
||||
getApplication(),
|
||||
CAMERA_PERMISSION
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
if (isPermissionGranted) {
|
||||
_state.update { State.Scan }
|
||||
} else {
|
||||
delay(1000)
|
||||
_action.emit(Action.RequestPermission(CAMERA_PERMISSION))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun findBarcode(barcode: Barcode) {
|
||||
viewModelScope.launch {
|
||||
barcode.rawValue?.let { value ->
|
||||
_action.emit(Action.CloseWithResult(value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun close() {
|
||||
viewModelScope.launch {
|
||||
_action.emit(Action.CloseWithCancel)
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface State {
|
||||
data object Loading : State
|
||||
|
||||
data object Scan : State
|
||||
}
|
||||
|
||||
sealed interface Action {
|
||||
data class RequestPermission(
|
||||
val permission: String
|
||||
) : Action
|
||||
data object CloseWithCancel : Action
|
||||
data class CloseWithResult(
|
||||
val result: String
|
||||
) : Action
|
||||
}
|
||||
|
||||
private companion object {
|
||||
val initialState = State.Loading
|
||||
|
||||
const val CAMERA_PERMISSION = Manifest.permission.CAMERA
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
||||
public abstract class TextChangedListener<T> implements TextWatcher {
|
||||
private final T target;
|
||||
private final T target;
|
||||
|
||||
public TextChangedListener(T target) {
|
||||
this.target = target;
|
||||
|
BIN
app/src/main/res/drawable/ic_create_employee.png
Normal file
BIN
app/src/main/res/drawable/ic_create_employee.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 B |
Binary file not shown.
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 564 B |
BIN
app/src/main/res/ic_create_employee/Add Administrator.png
Normal file
BIN
app/src/main/res/ic_create_employee/Add Administrator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 B |
@ -19,7 +19,8 @@
|
||||
android:layout_marginTop="220dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginBottom="270dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="20dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".ui.profile.ProfileFragment">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
@ -69,7 +73,7 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/descriptionLay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -79,7 +83,8 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="#B1B1CF">
|
||||
android:backgroundTint="#B1B1CF"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
@ -101,6 +106,7 @@
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:maxLines="10" />
|
||||
|
||||
<TextView
|
||||
@ -110,13 +116,13 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="-45dp"
|
||||
android:layout_marginEnd="270dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="279dp"
|
||||
android:text="@string/description" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<RelativeLayout
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/workTimeLay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="120dp"
|
||||
@ -126,7 +132,8 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="#B1B1CF">
|
||||
android:backgroundTint="#B1B1CF"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
@ -146,7 +153,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="37dp"
|
||||
android:layout_marginTop="75dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:maxLines="1" />
|
||||
|
||||
@ -158,7 +165,7 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:maxLines="1" />
|
||||
|
||||
@ -169,13 +176,13 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="-54dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="270dp"
|
||||
android:text="@string/contacts" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<RelativeLayout
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/relLay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
@ -185,7 +192,8 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="#B1B1CF">
|
||||
android:backgroundTint="#B1B1CF"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
@ -216,10 +224,11 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="-54dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="301dp"
|
||||
android:text="@string/address" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
@ -1,9 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/search_lay"
|
||||
android:layout_width="wrap_content"
|
||||
@ -48,4 +52,6 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
248
app/src/main/res/layout/fragment_create_user.xml
Normal file
248
app/src/main/res/layout/fragment_create_user.xml
Normal file
@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".ui.createemployee.CreateUserFragment"
|
||||
android:background="@drawable/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/ic_user" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/addEmployee"
|
||||
android:textSize="25dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/name_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="119dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/name_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Имя"
|
||||
android:background="#FFFFFF" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/surname_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/name_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/surname_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Фамилия"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/patronomic_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/surname_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/patronomic_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Отчество"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/telephone_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/patronomic_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/telephone_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Телефон"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/email_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/telephone_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/email_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Электронная почта"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/password_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/email_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/password_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Пароль"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/officename_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/password_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/officename_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Название офиса"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/possition_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/officename_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
app:shapeAppearance="@style/rounded">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/position_create"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:hint="Должность"
|
||||
android:background="#FFFFFF"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/role_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/possition_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:background="@color/white"
|
||||
android:entries="@array/roles"/>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_create_lay"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/role_create_lay"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="70dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="70dp"
|
||||
android:text="Создать"
|
||||
android:backgroundTint="#B1CFBB"
|
||||
android:textColor="@color/black"
|
||||
app:shapeAppearance="@style/rounded"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".ui.profile.ProfileFragment">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
@ -215,4 +219,6 @@
|
||||
android:text="@string/email"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".ui.profile.ProfileFragment">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
@ -33,7 +37,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:id="@+id/profile_image_view"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_alignParentStart="true"
|
||||
@ -41,7 +45,8 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="140dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_marginEnd="140dp" />
|
||||
android:layout_marginEnd="140dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
@ -57,6 +62,7 @@
|
||||
android:padding="8dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/changeProfile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="100dp"
|
||||
@ -79,7 +85,7 @@
|
||||
android:layout_marginEnd="0dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/fio"
|
||||
android:id="@+id/fio_et"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentStart="true"
|
||||
@ -105,7 +111,7 @@
|
||||
android:id="@+id/role_et"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_below="@+id/fio"
|
||||
android:layout_below="@+id/fio_et"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="32dp"
|
||||
@ -206,4 +212,6 @@
|
||||
android:text="@string/email"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
@ -3,15 +3,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardBackgroundColor="#B1B1CF"
|
||||
>
|
||||
app:cardCornerRadius="15dp"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<View
|
||||
android:layout_width="10dp"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginLeft="273dp"
|
||||
android:layout_marginLeft="265dp"
|
||||
android:layout_marginRight="-5dp"
|
||||
android:background="#B1CFBB"/>
|
||||
|
||||
@ -24,7 +24,9 @@
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:id="@+id/profile_image"/>
|
||||
android:id="@+id/profile_image"
|
||||
style="@style/Circle"
|
||||
android:background="@color/black"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -15,6 +15,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/createEmployee"
|
||||
android:title="@string/createEmployee"
|
||||
android:icon="@drawable/ic_create_employee"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/employees"
|
||||
android:title="@string/employees"
|
||||
|
@ -7,4 +7,5 @@
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="grey">#11FFFFFF</color>
|
||||
</resources>
|
@ -23,7 +23,7 @@
|
||||
<string name="profile">Профиль</string>
|
||||
<string name="office">Офис</string>
|
||||
<string name="scaning">Сканировать</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="info">Информация о сотруднике</string>
|
||||
<string name="redact">Редактировать</string>
|
||||
@ -39,4 +39,11 @@
|
||||
<string name="address">Адрес</string>
|
||||
<string name="contacts">Контакты</string>
|
||||
<string name="description">Описание</string>
|
||||
<string name="createEmployee">Создать сотрудника</string>
|
||||
<string name="addEmployee">Добавить сотрудника</string>
|
||||
|
||||
<string-array name="roles">
|
||||
<item>Админ</item>
|
||||
<item>Пользователь</item>
|
||||
</string-array>
|
||||
</resources>
|
30
app/src/main/res/values/styles.xml
Normal file
30
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Widget.Theme.MyApplication.ButtonBar.Fullscreen" parent="">
|
||||
<item name="android:background">@color/black</item>
|
||||
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="App.Custom.Indicator" parent="Widget.Material3.BottomNavigationView.ActiveIndicator">
|
||||
<item name="android:color">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="rounded" parent="ShapeAppearance.MaterialComponents.SmallComponent">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">20dp</item>
|
||||
</style>
|
||||
|
||||
<style name="roundedImageView" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">16dp</item>
|
||||
</style>
|
||||
<style name="roundedImageViewSmall" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">6dp</item>
|
||||
</style>
|
||||
|
||||
<style name="circleImageView" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">50%</item>
|
||||
</style>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user