Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
7149b0088a
@ -16,7 +16,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.UiTemplate"
|
||||
tools:targetApi="31">
|
||||
tools:targetApi="34">
|
||||
<activity
|
||||
android:name=".ui.RootActivity"
|
||||
android:exported="true">
|
||||
|
@ -19,6 +19,8 @@ import ru.myitschool.work.ui.qr.result.QrResultDestination
|
||||
import ru.myitschool.work.ui.qr.result.QrResultFragment
|
||||
import ru.myitschool.work.ui.qr.scan.QrScanDestination
|
||||
import ru.myitschool.work.ui.qr.scan.QrScanFragment
|
||||
import ru.myitschool.work.ui.searchuser.SearchUserDestination
|
||||
import ru.myitschool.work.ui.searchuser.SearchUserFragment
|
||||
import ru.myitschool.work.ui.splash.SplashDestination
|
||||
import ru.myitschool.work.ui.splash.SplashFragment
|
||||
|
||||
@ -42,6 +44,7 @@ class RootActivity : AppCompatActivity() {
|
||||
fragment<QrResultFragment, QrResultDestination>()
|
||||
fragment<QrScanFragment, QrScanDestination>()
|
||||
fragment<EntryListFragment, EntryListDestination>()
|
||||
fragment<SearchUserFragment, SearchUserDestination>()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,19 @@
|
||||
package ru.myitschool.work.ui.entrylist.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.graphics.drawable.toDrawable
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ru.myitschool.work.R
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
||||
class AdapterEntryHistory(private val datas: List<EntryHistoryEntity>) : RecyclerView
|
||||
.Adapter<AdapterEntryHistory.MyViewHolder>() {
|
||||
@ -25,8 +30,12 @@ class AdapterEntryHistory(private val datas: List<EntryHistoryEntity>) : Recycle
|
||||
return MyViewHolder(itemView)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
|
||||
holder.dateText.text = datas[position].time.toString()
|
||||
|
||||
|
||||
|
||||
holder.dateText.text = LocalDateTime.parse(datas[position].time).format(DateTimeFormatter.ofPattern("d MMMM yyyy, HH:mm:ss", Locale.getDefault()))
|
||||
holder.identificatorText.text = datas[position].identificator.toString()
|
||||
holder.typeText.text = datas[position].type.toString()
|
||||
|
||||
|
@ -15,6 +15,8 @@ import ru.myitschool.work.ui.entrylist.EntryListDestination
|
||||
import ru.myitschool.work.ui.login.LoginDestination
|
||||
import ru.myitschool.work.ui.qr.result.QrResultDestination
|
||||
import ru.myitschool.work.ui.qr.scan.QrScanDestination
|
||||
import ru.myitschool.work.ui.searchuser.SearchUserDestination
|
||||
import ru.myitschool.work.ui.searchuser.SearchUserFragment
|
||||
import ru.myitschool.work.utils.collectWhenStarted
|
||||
import ru.myitschool.work.utils.visibleOrGone
|
||||
|
||||
@ -59,11 +61,12 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
swipeRefreshLayout.isRefreshing = false
|
||||
binding.position.text = state.position
|
||||
binding.lastEntry.text = state.lastEntry
|
||||
binding.fullname.text = state.fullname
|
||||
if (state.admin){
|
||||
//TODO Приделать админские штучки
|
||||
binding.fullname.text = state.fullname + " admin"
|
||||
binding.admin.visibility = View.VISIBLE
|
||||
}else{
|
||||
binding.fullname.text = state.fullname
|
||||
binding.admin.visibility = View.GONE
|
||||
}
|
||||
Picasso.get()
|
||||
.load(state.imageUrl)
|
||||
@ -94,6 +97,12 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
}
|
||||
}
|
||||
|
||||
is ProfileViewModel.Action.OpenSearch -> {
|
||||
findNavController().navigate(SearchUserDestination) {
|
||||
popUpTo<SearchUserFragment> { inclusive = true }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,6 +111,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
binding.logout.setOnClickListener { viewModel.clickLogout() }
|
||||
binding.scan.setOnClickListener { viewModel.clickScan() }
|
||||
binding.entryList.setOnClickListener{ viewModel.clickLog()}
|
||||
binding.admin.setOnClickListener { viewModel.clickSearch() }
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -55,6 +55,11 @@ class ProfileViewModel @Inject constructor(
|
||||
_action.emit(Action.OpenScan)
|
||||
}
|
||||
}
|
||||
fun clickSearch(){
|
||||
viewModelScope.launch {
|
||||
_action.emit(Action.OpenSearch)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateUserInfo() {
|
||||
viewModelScope.launch {
|
||||
@ -67,7 +72,7 @@ class ProfileViewModel @Inject constructor(
|
||||
imageUrl = value.imageUrl,
|
||||
position = value.position,
|
||||
lastEntry = simpleDateFormat.format(Date(value.lastEntryMillis)),
|
||||
admin = false
|
||||
admin = true
|
||||
)
|
||||
}
|
||||
},
|
||||
@ -102,6 +107,7 @@ class ProfileViewModel @Inject constructor(
|
||||
data object OpenLogin : Action
|
||||
data object OpenScan : Action
|
||||
data object OpenLog : Action
|
||||
data object OpenSearch : Action
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -0,0 +1,6 @@
|
||||
package ru.myitschool.work.ui.searchuser
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data object SearchUserDestination
|
@ -0,0 +1,28 @@
|
||||
package ru.myitschool.work.ui.searchuser
|
||||
|
||||
import androidx.fragment.app.viewModels
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.serialization.Serializable
|
||||
import ru.myitschool.work.R
|
||||
|
||||
@Serializable
|
||||
@AndroidEntryPoint
|
||||
class SearchUserFragment : Fragment(R.layout.fragment_search_user) {
|
||||
|
||||
companion object {
|
||||
fun newInstance() = SearchUserFragment()
|
||||
}
|
||||
|
||||
private val viewModel: SearchUserViewModel by viewModels()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// TODO: Use the ViewModel
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package ru.myitschool.work.ui.searchuser
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class SearchUserViewModel @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
) : ViewModel() {
|
||||
// TODO: Implement the ViewModel
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton2"
|
||||
style="@style/Theme.UiTemplate.FAB.Gray"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/ic_back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/text_login"
|
||||
android:padding="35dp"
|
||||
style="@style/Theme.UiTemplate.TextH1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/admin_main" />
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Theme.UiTemplate.Input"
|
||||
android:id="@+id/input_username"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintWidth_max="400dp"
|
||||
app:layout_constraintWidth_percent="0.8"
|
||||
android:layout_height="58dp">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/username"
|
||||
style="@style/Theme.UiTemplate.Input.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/admin_input_hint">
|
||||
</com.google.android.material.textfield.TextInputEditText>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Theme.UiTemplate.Button"
|
||||
android:layout_marginTop="58dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/admin_button" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
58
app/src/main/res/layout/fragment_search_user.xml
Normal file
58
app/src/main/res/layout/fragment_search_user.xml
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton2"
|
||||
style="@style/Theme.UiTemplate.FAB.Gray"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/ic_back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/text_login"
|
||||
android:padding="35dp"
|
||||
style="@style/Theme.UiTemplate.TextH1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/admin_main" />
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Theme.UiTemplate.Input"
|
||||
android:id="@+id/input_username"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintWidth_max="400dp"
|
||||
app:layout_constraintWidth_percent="0.8"
|
||||
android:layout_height="58dp">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/username"
|
||||
style="@style/Theme.UiTemplate.Input.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/admin_input_hint">
|
||||
</com.google.android.material.textfield.TextInputEditText>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Theme.UiTemplate.Button"
|
||||
android:layout_marginTop="58dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/admin_button" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -34,7 +34,7 @@ object Version {
|
||||
|
||||
object Android {
|
||||
object Sdk {
|
||||
const val min = 24
|
||||
const val min = 28
|
||||
const val compile = 34
|
||||
const val target = 34
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user