feat: last commit

This commit is contained in:
a1pha 2025-02-20 17:05:01 +03:00
parent 5297d47340
commit c3adf16666
3 changed files with 3 additions and 4 deletions
app/src/main
java/ru/myitschool/work/ui
res/layout

@ -27,9 +27,6 @@ class ViewUserAsAdminFragment : Fragment(R.layout.fragment_user) {
binding.findUser.visibleOrGone(false)
binding.logout.visibleOrGone(false)
val adapter = PassesListAdapter()
binding.passes.adapter = adapter
viewModel.state.collectWithLifecycle(this) { state ->
binding.refresh.isRefreshing = state is AdminViewModel.State.Loading
binding.content.visibleOrGone(state is AdminViewModel.State.Show)

@ -35,14 +35,15 @@ class UserFragment : Fragment(R.layout.fragment_user) {
when (state) {
is UserViewModel.State.Loading -> Unit
is UserViewModel.State.Show -> {
adapter.submitList(state.passes)
val user = state.userEntity
adapter.submitList(state.passes)
binding.scan.visibleOrGone(!user.isCardBlocked)
binding.findUser.visibleOrGone(user.isAdmin)
binding.fullname.text = user.name
binding.position.text = user.position
binding.lastEntry.text = user.lastVisit
Picasso.get().load(user.photoUrl).into(binding.photo)
}
}
}

@ -160,6 +160,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/passes"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"