Compare commits
12 Commits
front_back
...
master
Author | SHA1 | Date | |
---|---|---|---|
3a6b9f7abe | |||
0a5013391a | |||
7ad1843ca5 | |||
155b1a0d7c | |||
c5c3948181 | |||
60023ec60e | |||
11878a27b6 | |||
15752e2014 | |||
65440d8feb | |||
99cca684c9 | |||
01ff55a4d1 | |||
6ce331b2b6 |
123
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,123 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
2
.idea/gradle.xml
generated
@ -6,7 +6,7 @@
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="gradleJvm" value="jbr-21" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
2
.idea/kotlinc.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.24" />
|
||||
<option name="version" value="2.0.0-RC1" />
|
||||
</component>
|
||||
</project>
|
1
.idea/misc.xml
generated
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
|
1
README.md
Normal file
@ -0,0 +1 @@
|
||||
figma:https://www.figma.com/design/brY8RtNsC7Y5J9RFF0sKXJ/Untitled?node-id=0-1&p=f&t=TtXqo7lfd0ltO4wT-0
|
@ -40,6 +40,8 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.lifecycle.view.model)
|
||||
implementation(libs.fragment.navigation)
|
||||
implementation(libs.ktor.client.core)
|
||||
implementation(libs.zbar.code)
|
||||
implementation(libs.ktor.serialization.json)
|
||||
|
@ -5,6 +5,7 @@
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-feature android:name="android.hardware.camera"/>
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
@ -25,10 +26,10 @@
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<activity android:name=".qr.QrActivity" android:exported="true">
|
||||
|
||||
|
||||
</activity>
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
app/src/main/ic_launcher-playstore.png
Normal file
After Width: | Height: | Size: 18 KiB |
@ -1,10 +1,16 @@
|
||||
package com.example.nto_2024_client
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import com.example.nto_2024_client.login.LoginFragment
|
||||
import com.example.nto_2024_client.qr.QrFragment
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
@ -17,6 +23,34 @@ class MainActivity : AppCompatActivity() {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
}
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_login,QrFragment()).commit()
|
||||
// val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
|
||||
// val navController = navHostFragment.navController
|
||||
checkPermissions()
|
||||
}
|
||||
|
||||
private fun checkPermissions(){
|
||||
if(ContextCompat.checkSelfPermission(this,android.Manifest.permission.CAMERA)!= PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(this, arrayOf(android.Manifest.permission.CAMERA),12)
|
||||
}
|
||||
else{
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_login,LoginFragment()).commit()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray,
|
||||
deviceId: Int
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults, deviceId)
|
||||
|
||||
if(requestCode == 12){
|
||||
if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_login,LoginFragment()).commit()
|
||||
Log.d("MyResp","GOOOL")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.example.nto_2024_client.list
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.Observer
|
||||
import com.example.nto_2024_client.R
|
||||
import com.example.nto_2024_client.databinding.FragmentListBinding
|
||||
import com.example.nto_2024_client.list.adapter.ListAdapter
|
||||
|
||||
class ListFragment:Fragment(R.layout.fragment_list) {
|
||||
private lateinit var binding:FragmentListBinding
|
||||
private val listViewModel:ListViewModel by activityViewModels()
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val adapter = ListAdapter()
|
||||
binding.rvView.adapter=adapter
|
||||
binding = FragmentListBinding.bind(view)
|
||||
listViewModel.entry.observe(viewLifecycleOwner, Observer { it->
|
||||
for (listEnterEntity in it){
|
||||
adapter.addEnter(listEnterEntity)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.nto_2024_client.list
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.example.nto_2024_client.list.models.ListEnterEntity
|
||||
import com.example.nto_2024_client.list.network.ListEnterRepoImpl
|
||||
import com.example.nto_2024_client.list.network.ListNetworkEnter
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ListViewModel:ViewModel() {
|
||||
private val listNetworkEnter:ListNetworkEnter = ListNetworkEnter()
|
||||
private val listEnterRepoImpl:ListEnterRepoImpl = ListEnterRepoImpl(listNetworkEnter)
|
||||
|
||||
val entry:MutableLiveData<List<ListEnterEntity>> by lazy {
|
||||
MutableLiveData<List<ListEnterEntity>>()
|
||||
}
|
||||
|
||||
fun getEntry(username:String,password:String){
|
||||
viewModelScope.launch {
|
||||
val result = listEnterRepoImpl.lastEntry(username,password)
|
||||
result.onSuccess { listEntry->
|
||||
entry.value = listEntry
|
||||
Log.d("MyListEntry",entry.value.toString())
|
||||
|
||||
}
|
||||
result.onFailure {
|
||||
Log.d("MyListEntry","Mda")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.example.nto_2024_client.list.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.nto_2024_client.R
|
||||
import com.example.nto_2024_client.databinding.EntryItemBinding
|
||||
import com.example.nto_2024_client.list.models.ListEnterEntity
|
||||
|
||||
class ListAdapter:RecyclerView.Adapter<com.example.nto_2024_client.list.adapter.ListAdapter.EntryHolder>() {
|
||||
|
||||
|
||||
val entryItem=ArrayList<ListEnterEntity>()
|
||||
inner class EntryHolder(item: View):RecyclerView.ViewHolder(item){
|
||||
val binding=EntryItemBinding.bind(item)
|
||||
fun bind(item: ListEnterEntity){
|
||||
binding.textView.text = item.lastEntry
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EntryHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.entry_item,parent,false)
|
||||
return EntryHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return entryItem.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: EntryHolder, position: Int) {
|
||||
holder.bind(entryItem[position])
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun addEnter(lastEnterEntity: ListEnterEntity){
|
||||
entryItem.add(lastEnterEntity)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.example.nto_2024_client.list.models
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
class ListEnterDTO (
|
||||
@SerialName("lastEntry")
|
||||
val lastEntry:String
|
||||
)
|
@ -0,0 +1,5 @@
|
||||
package com.example.nto_2024_client.list.models
|
||||
|
||||
class ListEnterEntity (
|
||||
val lastEntry:String
|
||||
)
|
@ -0,0 +1,7 @@
|
||||
package com.example.nto_2024_client.list.network
|
||||
|
||||
import com.example.nto_2024_client.list.models.ListEnterEntity
|
||||
|
||||
interface ListEnterRepo {
|
||||
suspend fun lastEntry(login:String,password:String):Result<List<ListEnterEntity>>
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.example.nto_2024_client.list.network
|
||||
|
||||
import com.example.nto_2024_client.list.models.ListEnterEntity
|
||||
|
||||
class ListEnterRepoImpl (val listNetworkEnter: ListNetworkEnter):ListEnterRepo{
|
||||
override suspend fun lastEntry(login: String, password: String): Result<List<ListEnterEntity>> {
|
||||
return listNetworkEnter.findLastEntry(login,password).map { listDTO->
|
||||
listDTO.mapNotNull { dto->
|
||||
ListEnterEntity(
|
||||
lastEntry = dto.lastEntry
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,21 @@
|
||||
package com.example.nto_2024_client.register
|
||||
package com.example.nto_2024_client.list.network
|
||||
|
||||
import com.example.nto_2024_client.register.models.RegisterDTO
|
||||
import com.example.nto_2024_client.list.models.ListEnterDTO
|
||||
import com.example.nto_2024_client.login.models.UserDTO
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.client.request.basicAuth
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.post
|
||||
import io.ktor.client.request.setBody
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlin.math.log
|
||||
|
||||
class RegisterNetwork {
|
||||
class ListNetworkEnter {
|
||||
val client = HttpClient(CIO){
|
||||
install(ContentNegotiation){
|
||||
json(Json {
|
||||
@ -23,17 +25,10 @@ class RegisterNetwork {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun register(name:String,password:String,login:String):Result<Unit> = withContext(Dispatchers.IO){
|
||||
suspend fun findLastEntry(login:String,password:String):Result<List<ListEnterDTO>> = withContext(Dispatchers.IO){
|
||||
runCatching {
|
||||
val result = client.post(""){
|
||||
basicAuth(login,password)
|
||||
setBody(RegisterDTO(
|
||||
name = name,
|
||||
password = password,
|
||||
username = login
|
||||
))
|
||||
}
|
||||
val result = client.get("http://10.6.66.81:8080/api/enter/${login}")
|
||||
result.body()
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,41 @@
|
||||
package com.example.nto_2024_client.login
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.Observer
|
||||
import com.example.nto_2024_client.R
|
||||
import com.example.nto_2024_client.databinding.FragmentLoginBinding
|
||||
import com.example.nto_2024_client.list.ListViewModel
|
||||
import com.example.nto_2024_client.login.network.LoginNetwork
|
||||
import com.example.nto_2024_client.login.network.LoginRepoImpl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class LoginFragment:Fragment(R.layout.fragment_login) {
|
||||
private lateinit var binding:FragmentLoginBinding
|
||||
private val loginNetwork: LoginNetwork = LoginNetwork()
|
||||
private val loginRepoImpl: LoginRepoImpl = LoginRepoImpl(loginNetwork)
|
||||
private val loginViewModel:LoginViewModel by activityViewModels()
|
||||
private val listViewModel:ListViewModel by activityViewModels()
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding = FragmentLoginBinding.bind(view)
|
||||
binding.button2.setOnClickListener{
|
||||
CoroutineScope(Dispatchers.Main).launch{
|
||||
val result = loginNetwork.login("gnazarov","admin")
|
||||
result.onSuccess {
|
||||
Log.d("MyLog","Good")
|
||||
}
|
||||
result.onFailure {
|
||||
Log.d("MyLog","Fail")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class LoginFragment:Fragment() {
|
||||
}
|
@ -1,6 +1,33 @@
|
||||
package com.example.nto_2024_client.login
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.example.nto_2024_client.login.network.LoginNetwork
|
||||
import com.example.nto_2024_client.login.network.LoginRepoImpl
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class LoginViewModel:ViewModel() {
|
||||
private val loginNetwork:LoginNetwork = LoginNetwork()
|
||||
private val loginRepoImpl:LoginRepoImpl = LoginRepoImpl(loginNetwork)
|
||||
|
||||
val message:MutableLiveData<String> by lazy {
|
||||
MutableLiveData<String>()
|
||||
}
|
||||
|
||||
|
||||
fun login(login:String,password:String){
|
||||
viewModelScope.launch {
|
||||
val result = loginNetwork.login("gnazarov","admin")
|
||||
result.onSuccess {
|
||||
message.value = "cool"
|
||||
Log.d("MyLogin","True")
|
||||
}
|
||||
result.onFailure {
|
||||
Log.d("MyLogin","Fail")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
package com.example.nto_2024_client.register.models
|
||||
package com.example.nto_2024_client.login.models
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Serializer
|
||||
|
||||
@Serializable
|
||||
data class RegisterDTO (
|
||||
data class UserDTO(
|
||||
@SerialName("name")
|
||||
val name:String,
|
||||
@SerialName("username")
|
||||
val username:String,
|
||||
@SerialName("password")
|
||||
val password:String
|
||||
|
||||
val password:String,
|
||||
@SerialName("photo")
|
||||
val photo:String,
|
||||
@SerialName("jobPos")
|
||||
val jobPos:String
|
||||
)
|
@ -0,0 +1,9 @@
|
||||
package com.example.nto_2024_client.login.models
|
||||
|
||||
class UserEntity(
|
||||
val name:String,
|
||||
val username:String,
|
||||
val password:String,
|
||||
val photo:String,
|
||||
val jobPos:String
|
||||
)
|
@ -0,0 +1,52 @@
|
||||
package com.example.nto_2024_client.login.network
|
||||
|
||||
import android.net.Credentials
|
||||
import android.util.Log
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import io.ktor.client.plugins.auth.Auth
|
||||
import io.ktor.client.plugins.auth.providers.BasicAuthCredentials
|
||||
import io.ktor.client.plugins.auth.providers.basic
|
||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.client.request.basicAuth
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.headers
|
||||
import io.ktor.client.utils.EmptyContent.headers
|
||||
import io.ktor.http.HttpHeaders
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
class LoginNetwork {
|
||||
|
||||
val client = HttpClient(CIO) {
|
||||
install(ContentNegotiation) {
|
||||
json(Json {
|
||||
isLenient = true
|
||||
ignoreUnknownKeys = true
|
||||
})
|
||||
|
||||
}
|
||||
install(Auth) {
|
||||
basic {
|
||||
sendWithoutRequest { true }
|
||||
credentials {
|
||||
BasicAuthCredentials(username = "gnazarov", password = "admin")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun login(login: String, password: String): Result<Unit> = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
val result = client.get("http://10.6.66.81:8080/api/employee/login")
|
||||
if (result.status!= HttpStatusCode.OK){
|
||||
error("jopa")
|
||||
}
|
||||
Unit
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.example.nto_2024_client.login.network
|
||||
interface LoginRepo {
|
||||
suspend fun login(login:String,password:String):Result<Unit>
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.example.nto_2024_client.login.network
|
||||
|
||||
class LoginRepoImpl(val loginNetwork: LoginNetwork):LoginRepo {
|
||||
override suspend fun login(login: String, password: String): Result<Unit> {
|
||||
return loginNetwork.login(login,password)
|
||||
}
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
package com.example.nto_2024_client.login
|
||||
package com.example.nto_2024_client.qr.network
|
||||
|
||||
import com.example.nto_2024_client.login.models.UserDTO
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.client.request.basicAuth
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
class LoginNetwork {
|
||||
|
||||
class QrNetwork {
|
||||
val client = HttpClient(CIO){
|
||||
install(ContentNegotiation){
|
||||
json(Json {
|
||||
@ -21,9 +23,12 @@ class LoginNetwork {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun login(login:String,password:String):Result<Unit> = withContext(Dispatchers.IO){
|
||||
|
||||
suspend fun findQrCode(qrCode:String):Result<UserDTO> = withContext(Dispatchers.IO){
|
||||
runCatching {
|
||||
val result = client.get("")
|
||||
val result = client.get("http://10.6.66.81:8080/api/registration")
|
||||
result.body()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.example.nto_2024_client.register
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
|
||||
class RegisterFragment:Fragment() {
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.example.nto_2024_client.register
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class RegisterViewModel: ViewModel() {
|
||||
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable/background.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
app/src/main/res/drawable/background2.png
Normal file
After Width: | Height: | Size: 18 KiB |
7
app/src/main/res/drawable/history.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="50dp" android:viewportHeight="24" android:viewportWidth="24" android:width="50dp">
|
||||
|
||||
<path android:fillColor="#00000000" android:pathData="M12,8V12L14.5,14.5" android:strokeColor="#1C274C" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.5"/>
|
||||
|
||||
<path android:fillColor="#1C274C" android:pathData="M5.604,5.604L5.074,5.074V5.074L5.604,5.604ZM4.338,6.871L3.588,6.874C3.59,7.286 3.923,7.619 4.334,7.621L4.338,6.871ZM6.88,7.633C7.294,7.635 7.631,7.301 7.633,6.887C7.635,6.473 7.301,6.135 6.887,6.133L6.88,7.633ZM5.075,4.321C5.073,3.907 4.735,3.573 4.321,3.575C3.907,3.577 3.573,3.915 3.575,4.329L5.075,4.321ZM3.75,12C3.75,11.586 3.414,11.25 3,11.25C2.586,11.25 2.25,11.586 2.25,12H3.75ZM16.875,20.445C17.234,20.238 17.357,19.779 17.149,19.42C16.942,19.062 16.483,18.939 16.125,19.147L16.875,20.445ZM19.147,16.125C18.939,16.483 19.062,16.942 19.42,17.149C19.779,17.357 20.238,17.234 20.445,16.875L19.147,16.125ZM5.14,5.071C4.846,5.363 4.844,5.838 5.135,6.132C5.426,6.426 5.901,6.429 6.196,6.137L5.14,5.071ZM18.862,5.138C15.042,1.318 8.869,1.279 5.074,5.074L6.135,6.135C9.334,2.935 14.557,2.954 17.802,6.199L18.862,5.138ZM5.074,5.074L3.808,6.34L4.868,7.401L6.135,6.135L5.074,5.074ZM4.334,7.621L6.88,7.633L6.887,6.133L4.342,6.121L4.334,7.621ZM5.088,6.867L5.075,4.321L3.575,4.329L3.588,6.874L5.088,6.867ZM12,3.75C16.556,3.75 20.25,7.444 20.25,12H21.75C21.75,6.615 17.385,2.25 12,2.25V3.75ZM12,20.25C7.444,20.25 3.75,16.556 3.75,12H2.25C2.25,17.385 6.615,21.75 12,21.75V20.25ZM16.125,19.147C14.912,19.848 13.504,20.25 12,20.25V21.75C13.775,21.75 15.441,21.275 16.875,20.445L16.125,19.147ZM20.25,12C20.25,13.504 19.848,14.912 19.147,16.125L20.445,16.875C21.275,15.441 21.75,13.775 21.75,12H20.25ZM6.196,6.137C7.687,4.661 9.736,3.75 12,3.75V2.25C9.325,2.25 6.901,3.328 5.14,5.071L6.196,6.137Z"/>
|
||||
|
||||
</vector>
|
7
app/src/main/res/drawable/ic_back.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="50dp" android:viewportHeight="1024" android:viewportWidth="1024" android:width="50dp">
|
||||
|
||||
<path android:fillColor="#000000" android:pathData="M224,480h640a32,32 0,1 1,0 64H224a32,32 0,0 1,0 -64z"/>
|
||||
|
||||
<path android:fillColor="#000000" android:pathData="m237.2,512 l265.4,265.3a32,32 0,0 1,-45.3 45.3l-288,-288a32,32 0,0 1,0 -45.3l288,-288a32,32 0,1 1,45.3 45.3L237.2,512z"/>
|
||||
|
||||
</vector>
|
@ -1,30 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
android:viewportWidth="122.88"
|
||||
android:viewportHeight="122.88">
|
||||
<group android:scaleX="0.47"
|
||||
android:scaleY="0.47"
|
||||
android:translateX="32.5632"
|
||||
android:translateY="32.5632">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
android:pathData="M16.28,56.04h8.96v-1.08L25.24,37.12c0,-10.2 4.18,-19.48 10.9,-26.21v-0.01C42.86,4.18 52.14,0 62.36,0C72.56,0 81.84,4.18 88.56,10.9l0.01,0.01c6.72,6.72 10.9,16 10.9,26.21v17.84v1.08h7.14c1.59,0 2.89,1.3 2.89,2.89v61.06c0,1.59 -1.3,2.89 -2.89,2.89L16.28,122.88c-1.59,0 -2.89,-1.3 -2.89,-2.89L13.39,58.93C13.39,57.34 14.69,56.04 16.28,56.04L16.28,56.04zM39.66,56.04h45.39v-1.08L85.05,36.91c0,-6.24 -2.55,-11.92 -6.66,-16.03l-0,0c-4.11,-4.11 -9.79,-6.67 -16.02,-6.67c-6.24,0 -11.92,2.55 -16.03,6.66c-4.11,4.11 -6.66,9.79 -6.66,16.03v18.05L39.66,56.04L39.66,56.04zM62.54,89.45l4.58,21.14l-12.56,0.05l3.68,-21.42c-3.43,-1.1 -5.92,-4.32 -5.92,-8.11c0,-4.7 3.81,-8.51 8.51,-8.51c4.7,0 8.51,3.81 8.51,8.51C69.35,85.23 66.43,88.66 62.54,89.45L62.54,89.45z"
|
||||
android:fillColor="#000000"
|
||||
android:fillType="evenOdd"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
11
app/src/main/res/drawable/ic_navigation.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="25dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:pathData="M12,4C11.448,4 11,4.448 11,5C11,5.552 11.448,6 12,6C12.552,6 13,5.552 13,5C13,4.448 12.552,4 12,4ZM15,5C15,6.657 13.657,8 12,8C10.343,8 9,6.657 9,5C9,3.343 10.343,2 12,2C13.657,2 15,3.343 15,5ZM12,11C11.448,11 11,11.448 11,12C11,12.552 11.448,13 12,13C12.552,13 13,12.552 13,12C13,11.448 12.552,11 12,11ZM15,12C15,13.657 13.657,15 12,15C10.343,15 9,13.657 9,12C9,10.343 10.343,9 12,9C13.657,9 15,10.343 15,12ZM11,19C11,18.448 11.448,18 12,18C12.552,18 13,18.448 13,19C13,19.552 12.552,20 12,20C11.448,20 11,19.552 11,19ZM12,22C13.657,22 15,20.657 15,19C15,17.343 13.657,16 12,16C10.343,16 9,17.343 9,19C9,20.657 10.343,22 12,22Z"
|
||||
android:fillColor="#000000"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_qr_code.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="50dp" android:viewportHeight="24" android:viewportWidth="24" android:width="50dp">
|
||||
|
||||
<path android:fillColor="#080341" android:fillType="evenOdd" android:pathData="M9.75,5.25H5.25V9.75H9.75V5.25ZM3.75,3.75V11.25H11.25V3.75H3.75ZM9.75,14.25H5.25V18.75H9.75V14.25ZM3.75,12.75V20.25H11.25V12.75H3.75ZM14.25,5.25H18.75V9.75H14.25V5.25ZM12.75,11.25V3.75H20.25V11.25H12.75ZM12.75,17.25V12.75H14.25V17.25H12.75ZM6.75,6.75V8.25H8.25V6.75H6.75ZM6.75,17.25V15.75H8.25V17.25H6.75ZM15.75,6.75V8.25H17.25V6.75H15.75ZM18.75,20.25V18H20.25V20.25H18.75ZM18.75,12.75V15H17.25V12.75H15.75V18.75H12.75V20.25H17.25V16.5H20.25V15V12.75H18.75Z"/>
|
||||
|
||||
</vector>
|
7
app/src/main/res/drawable/pencil.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="50dp" android:viewportHeight="16" android:viewportWidth="16" android:width="50dp">
|
||||
|
||||
<path android:fillColor="#000000" android:pathData="M8.293,3.707L1,11V15H5L12.293,7.707L8.293,3.707Z"/>
|
||||
|
||||
<path android:fillColor="#000000" android:pathData="M9.707,2.293L13.707,6.293L15.172,4.828C15.702,4.298 16,3.579 16,2.828C16,1.266 14.734,0 13.172,0C12.421,0 11.702,0.298 11.172,0.828L9.707,2.293Z"/>
|
||||
|
||||
</vector>
|
9
app/src/main/res/drawable/profile.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="50dp" android:viewportHeight="24" android:viewportWidth="24" android:width="50dp">
|
||||
|
||||
<path android:fillColor="#00000000" android:pathData="M12.12,12.78C12.05,12.77 11.96,12.77 11.88,12.78C10.12,12.72 8.72,11.28 8.72,9.51C8.72,7.7 10.18,6.23 12,6.23C13.81,6.23 15.28,7.7 15.28,9.51C15.27,11.28 13.88,12.72 12.12,12.78Z" android:strokeColor="#292D32" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.5"/>
|
||||
|
||||
<path android:fillColor="#00000000" android:pathData="M18.74,19.38C16.96,21.01 14.6,22 12,22C9.4,22 7.04,21.01 5.26,19.38C5.36,18.44 5.96,17.52 7.03,16.8C9.77,14.98 14.25,14.98 16.97,16.8C18.04,17.52 18.64,18.44 18.74,19.38Z" android:strokeColor="#292D32" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.5"/>
|
||||
|
||||
<path android:fillColor="#00000000" android:pathData="M12,22C17.523,22 22,17.523 22,12C22,6.477 17.523,2 12,2C6.477,2 2,6.477 2,12C2,17.523 6.477,22 12,22Z" android:strokeColor="#292D32" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.5"/>
|
||||
|
||||
</vector>
|
8
app/src/main/res/drawable/shape_button.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/orange"/>
|
||||
<corners android:radius="22dp"/>
|
||||
</shape>
|
9
app/src/main/res/drawable/shape_rectangle3.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="263dp"
|
||||
android:height="50dp"
|
||||
android:viewportWidth="263"
|
||||
android:viewportHeight="50">
|
||||
<path
|
||||
android:pathData="M25,0L238,0A25,25 0,0 1,263 25L263,25A25,25 0,0 1,238 50L25,50A25,25 0,0 1,0 25L0,25A25,25 0,0 1,25 0z"
|
||||
android:fillColor="#EBEBEB"/>
|
||||
</vector>
|
BIN
app/src/main/res/font/inter_18pt_bold.ttf
Normal file
BIN
app/src/main/res/font/inter_18pt_regular.ttf
Normal file
BIN
app/src/main/res/font/inter_18pt_semi_bold.ttf
Normal file
@ -1,12 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app = "http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
<!-- <androidx.fragment.app.FragmentContainerView-->
|
||||
<!-- android:id="@+id/fragmentContainerView"-->
|
||||
<!-- android:name="androidx.navigation.fragment.NavHostFragment"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"/>-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_login"
|
||||
android:layout_width="0dp"
|
||||
|
18
app/src/main/res/layout/entry_item.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
48
app/src/main/res/layout/fragment_list.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/orange"
|
||||
app:menu="@menu/top_app_bar"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:layout_anchor="@+id/toolbar"
|
||||
app:layout_anchorGravity="center" />
|
||||
<ImageButton
|
||||
android:background="@android:color/transparent"
|
||||
android:id="@+id/imageButton"
|
||||
android:layout_width="75dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_height="75dp"
|
||||
app:srcCompat="@drawable/history"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:background="@android:color/transparent"
|
||||
app:srcCompat="@drawable/profile"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="561dp"
|
||||
android:layout_gravity="center"
|
||||
tools:listitem="@layout/entry_item"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
83
app/src/main/res/layout/fragment_login.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:background="@drawable/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Login"
|
||||
android:textSize="16pt"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editTextText1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.721" />
|
||||
|
||||
<EditText
|
||||
|
||||
android:id="@+id/editTextText1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="240dp"
|
||||
android:background="@drawable/shape_rectangle3"
|
||||
android:gravity="center"
|
||||
android:inputType="text"
|
||||
android:hint="Логин"
|
||||
android:textColor="@color/dark_grey"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/shape_rectangle3"
|
||||
android:gravity="center"
|
||||
android:inputType="textPassword"
|
||||
android:hint="Пароль"
|
||||
android:textColor="@color/dark_grey"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText1"
|
||||
app:layout_constraintVertical_bias="0.076" />
|
||||
|
||||
<android.widget.Button
|
||||
android:visibility="gone"
|
||||
android:id="@+id/button"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/shape_button"
|
||||
android:text="Регистрация"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText3" />
|
||||
|
||||
<android.widget.Button
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/shape_button"
|
||||
android:text="Вход"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.503"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText3"
|
||||
app:layout_constraintVertical_bias="0.074" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
93
app/src/main/res/layout/fragment_register.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:background="@drawable/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/registration"
|
||||
android:textSize="16pt"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editTextText1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.721" />
|
||||
|
||||
<EditText
|
||||
|
||||
android:id="@+id/editTextText1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="240dp"
|
||||
android:background="@drawable/shape_rectangle3"
|
||||
android:gravity="center"
|
||||
android:inputType="text"
|
||||
android:hint="Имя"
|
||||
android:textColor="@color/dark_grey"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/shape_rectangle3"
|
||||
android:gravity="center"
|
||||
android:inputType="textPassword"
|
||||
android:text="Фамилия"
|
||||
android:textColor="@color/dark_grey"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/shape_rectangle3"
|
||||
android:gravity="center"
|
||||
android:inputType="text"
|
||||
android:text="Пароль"
|
||||
android:textColor="@color/dark_grey"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText2"
|
||||
app:layout_constraintVertical_bias="0.076" />
|
||||
|
||||
<android.widget.Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/shape_button"
|
||||
android:text="Регистрация"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText3" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
69
app/src/main/res/layout/profile.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background2">
|
||||
<!-- Profile pic + name and surname-->
|
||||
<ImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_back"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageButton"
|
||||
app:layout_constraintHorizontal_bias="0.044"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/pencil"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/Profile_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="120dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profile_username"
|
||||
android:layout_width="146dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:fontFamily="@font/inter_18pt_semi_bold"
|
||||
android:text="Name"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Profile_pic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Profile_surrname"
|
||||
android:layout_width="146dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginTop="88dp"
|
||||
android:fontFamily="@font/inter_18pt_semi_bold"
|
||||
android:text="Surname"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Profile_pic" />
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
12
app/src/main/res/menu/list.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="800dp"
|
||||
android:height="800dp"
|
||||
android:viewportWidth="325"
|
||||
android:viewportHeight="325">
|
||||
<path
|
||||
android:pathData="M233.73,325h5.46c1.71,0 3.34,-0.73 4.47,-2l36.1,-40.39c0.98,-1.1 1.53,-2.52 1.53,-4v-4.69h-47.56V325z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M275.29,0H49.71c-3.31,0 -6,2.69 -6,6v313c0,3.31 2.69,6 6,6h168.02v-59.08c0,-4.42 3.58,-8 8,-8h55.56V6C281.29,2.69 278.6,0 275.29,0zM130.92,261.37H76.78c-4.42,0 -8,-3.58 -8,-8c0,-4.42 3.58,-8 8,-8h54.14c4.42,0 8,3.58 8,8C138.92,257.79 135.34,261.37 130.92,261.37zM248.22,200.79H76.78c-4.42,0 -8,-3.58 -8,-8c0,-4.42 3.58,-8 8,-8h171.44c4.42,0 8,3.58 8,8C256.22,197.21 252.64,200.79 248.22,200.79zM248.22,140.21H76.78c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8h171.44c4.42,0 8,3.58 8,8S252.64,140.21 248.22,140.21zM248.22,79.63H76.78c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8h171.44c4.42,0 8,3.58 8,8S252.64,79.63 248.22,79.63z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
11
app/src/main/res/menu/top_app_bar.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/topbar_menu"
|
||||
android:icon="@drawable/ic_navigation"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/Profile"/>
|
||||
</menu>
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 7.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 10 KiB |
19
app/src/main/res/navigation/nav_host.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/nav_host"
|
||||
app:startDestination="@id/loginFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/loginFragment"
|
||||
android:name="com.example.nto_2024_client.login.LoginFragment"
|
||||
android:label="LoginFragment" >
|
||||
<action
|
||||
android:id="@+id/action_loginFragment_to_listFragment"
|
||||
app:destination="@id/listFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/listFragment"
|
||||
android:name="com.example.nto_2024_client.list.ListFragment"
|
||||
android:label="ListFragment" />
|
||||
</navigation>
|
@ -2,4 +2,8 @@
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="grey2">#EBEBEB</color>
|
||||
<color name="orange">#FFB71B</color>
|
||||
<color name="dark_grey">#717171</color>
|
||||
<color name="background">#FFE5A6</color>
|
||||
</resources>
|
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FB9B1E</color>
|
||||
</resources>
|
@ -1,3 +1,8 @@
|
||||
<resources>
|
||||
<string name="app_name">NTO-2024-client</string>
|
||||
<string name="Plaintext">Имя</string>
|
||||
<string name="registration">Регистрация</string>
|
||||
<string name="Login">Вход</string>
|
||||
<string name="Profile">Профиль</string>
|
||||
<string name="list">Лист</string>
|
||||
</resources>
|
@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.7.3"
|
||||
agp = "8.8.0"
|
||||
kotlin = "2.0.0-RC1"
|
||||
coreKtx = "1.15.0"
|
||||
junit = "4.13.2"
|
||||
@ -9,7 +9,9 @@ appcompat = "1.6.1"
|
||||
material = "1.10.0"
|
||||
activity = "1.10.0"
|
||||
constraintlayout = "2.1.4"
|
||||
lifecycleView = "2.8.7"
|
||||
ktor ="3.0.3"
|
||||
navFrag = "2.8.7"
|
||||
zbar = "1.9.7"
|
||||
kotlinSerialization="1.8.0"
|
||||
|
||||
@ -23,6 +25,8 @@ material = { group = "com.google.android.material", name = "material", version.r
|
||||
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
ktor-client-core = {module = "io.ktor:ktor-client-core",version.ref="ktor"}
|
||||
ktor-client-auth = {group="io.ktor",name="ktor-client-auth",version.ref="ktor"}
|
||||
lifecycle-view-model={group="androidx.lifecycle",name="lifecycle-viewmodel-ktx",version.ref="lifecycleView"}
|
||||
fragment-navigation = {group="androidx.navigation",name="navigation-fragment-ktx",version.ref="navFrag"}
|
||||
zbar-code = {group="me.dm7.barcodescanner",name="zbar",version.ref="zbar"}
|
||||
ktor-client-cio = {module="io.ktor:ktor-client-cio",version.ref="ktor"}
|
||||
ktor-client-content-negotiation={module="io.ktor:ktor-client-content-negotiation",version.ref="ktor"}
|
||||
|